I'm a relative Hibernate noob. I've been searching for a couple of days for the answer to this, but I have yet to find one that meets my needs.
I've got an application that might write to a database when it is run. We are using spring to do our configuration. Right now, the application is configured to use a C3P0 pooled data source (because somebody copied it from our tomcat configuration), but it does not need a pooled data source.
The problem that I'm getting is that, when the db is not needed (and not available), C3P0 thinks it is a deadlock (I'm guessing because the deadlock detection occurs before the driver times out trying to connect). This gives me ugly errors in the output, which isn't acceptable as this is an externally used tool.
What I would like to do is have a configuration that doesn't attempt to connect to the database unless I actually perform an operation. If it fails then because the db is not available, that's fine.
Is this possible when using Spring to configure the datasource? Which datasource should I use? If not, what is the best strategy in this case?
Thanks!
tj
|