OSGi and database drivers
I've been trying to deploy a bundle to servicemix which creates a hsqldb datasource.
So far I've had no success with the following exception:
Caused by: java.sql.SQLException: No suitable driver found for jdbc:hsqldb:mem:temp
at java.sql.DriverManager.getConnection(DriverManager.java:602)
at java.sql.DriverManager.getConnection(DriverManager.java:154)
I've deployed a bundle to osgi that contains the HSQLDB driver like so:
karaf@root> packages:exports | grep hsql
205 org.hsqldb; version="1.8.0.10"
205 org.hsqldb.index; version="1.8.0.10"
205 org.hsqldb.jdbc; version="1.8.0.10"
205 org.hsqldb.lib; version="1.8.0.10"
205 org.hsqldb.lib.java; version="1.8.0.10"
205 org.hsqldb.persist; version="1.8.0.10"
205 org.hsqldb.resources; version="1.8.0.10"
205 org.hsqldb.rowio; version="1.8.0.10"
205 org.hsqldb.sample; version="1.8.0.10"
205 org.hsqldb.scriptio; version="1.8.0.10"
205 org.hsqldb.store; version="1.8.0.10"
205 org.hsqldb.types; version="1.8.0.10"
205 org.hsqldb.util; version="1.8.0.10"
205 org.hsqldb.util.sqltool; version="1.8.0.10"
Then within my bundle in the Spring configuration I've got the following:
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="org.hsqldb.jdbcDriver"/>
<property开发者_JS百科 name="url" value="jdbc:hsqldb:mem:temp"/>
<property name="username" value="sa" />
<property name="password" value="" />
</bean>
And the manifest for the bundle:
Import-Package: org.hsqldb
Have I missed something? Any ideas will be great as I'm struggling to find anything online.
Having realised no formal answer has been given for this question, as I wrote in the above comment, the solution was simple. It was purely the case of upgrading to Java 6.
精彩评论