I'm currently using BoneCP as a connection pool manager since there is no real alternative (c3p0 is dead). I'm using hibernate 4 and spring 3.1 and everything works fine. The only thing that bothers me is the registration of a custom driver, like oracle.jdbc.driver.OracleDriver
.
When the application is starting and some information is loaded form the database I get the following message:
java.sql.SQLException: No suitable driver found for jdbc:oracle:thin:@localhost:xxx:xxxx
The datasource is registered as follows :
<bean id="mainDataSource" class="com.jolbox.bonecp.BoneCPDataSource" destroy method="close">
<property name="driverClass" ref="hibernate.connection.driver_class" />
<property name="jdbcUrl" ref="hibernate.connection.url" />
<property name="username" ref="hibernate.connection.username" />
<property name="password" ref="hibernate.connection.password" />
<property name="poolName" ref="hibernate.connection.username"/>
...
</bean>
This datasource is then injected into a sessionfactory.
When running this application in a jetty container in eclipse it works perfectly. When deployed on Tomcat 6.x or Websphere 8.x it is unable to find the specified driver.
I have tried to add this driver to the spring datasourcemanager:
<bean id="myDataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" ref="hibernate.connection.driver_class"/>
<property name="url" ref="hibernate.connection.url"/>
<property name="username" ref="hibernate.connection.username"/>
<property name="password" ref="hibernate.connection.password"/>
</bean>
This "fixed" my problem, but now I get a connection closed exception when loading data from the database. (at startup). I'm able to use my application, but sometimes this connection closed error occurs again on random moments.
I have seen that the BoneCP team confirmed the first issue as a BoneCP bug but is has not been committed yet. I have tried to implement the suggested solution from this bug tracker site, but I get the connection closed error again.
Any suggestions?