my dog learned polymorphism*
The moose likes Object Relational Mapping and the fly likes Can we set connection timeout through Hibernate without using C3P0? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Can we set connection timeout through Hibernate without using C3P0?" Watch "Can we set connection timeout through Hibernate without using C3P0?" New topic
Author

Can we set connection timeout through Hibernate without using C3P0?

Suresh Gopi
Ranch Hand

Joined: Mar 08, 2007
Posts: 49
Hello Friends,

I want to close the db connection after 'n' seconds of idle time.

In my hibernate config file, I'm getting the datasource reference fom JNDI.
Is it possible to set connection timeout value?


It looks like C3P0 connection pool implementation allows use to set the connection timeout?

Can i use both? i.e App server connection pool (datasource from JNDI) and C3P0 connection ppol mechanism?


(It is web app runs on App server.)

Please provide some pointers... Thanks in Advance!..



Regards<br />Suresh
Mudit Srivastava
Ranch Hand

Joined: Apr 30, 2007
Posts: 38
If you are using the JNDI App Server Pooling, then C3P0 is not required in your configuration file. which application server are you using ?
Suresh Gopi
Ranch Hand

Joined: Mar 08, 2007
Posts: 49
Thanks for your reply first Mudit!

i'm using Weblogic 8.1
Mudit Srivastava
Ranch Hand

Joined: Apr 30, 2007
Posts: 38
should be a piece a cake then, just remove the c3p0 settings from the hibernate.cfg.xml and you're good to go.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Can we set connection timeout through Hibernate without using C3P0?