I want to use jdbc directly in a project for service mix. I have tried to install ojdbc7.jar with
bundle:install wrap:file:F:/tmp/ojdbc7.jar
after starting I get 264 | Active | 80 | 0 | wrap_file_F__tmp_ojd bc7.jar
My code is:
try (final Connection con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521/orcl2", "bla", "bla")) {
String sql = "Insert INTO message values('" + fall.getMessageid() + "','" + fall.getXml() + "')";
final Statement statement = con.createStatement();
statement.executeUpdate(sql);
} catch (Exception e) {
String msg = "Error while trying to persist Fall with msgid " + fall.getMessageid();
log.error(msg, e);
throw new AdvisException(msg, e);
}
I get java.sql.SQLException: No suitable driver found for jdbc:oracle:thin:@localhost:1521/orcl2
Do I have to add some extra configuration or something?
edit:
I think I must import the installed bundle somehow in the MANIFEST.MF
Problem 1:
I have declared the dependency
<dependency>
<groupId>com.oracle</groupId>
<artifactId>oracle-jdbc</artifactId>
<version>6.0.0</version>
</dependency>
and use
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.5.3</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
<Import-Package>*</Import-Package>
<Private-Package>de.iteos</Private-Package>
</instructions>
</configuration>
but the ojdbc6 does not show up the imports:
Import-Package: javax.jws,javax.xml.bind,javax.xml.bind.annotation,javax
.xml.bind.annotation.adapters,javax.xml.datatype,javax.xml.namespace,ja
vax.xml.parsers,javax.xml.transform,javax.xml.transform.stream,javax.xm
l.ws,javax.xml.xpath,org.apache.activemq,org.apache.activemq.camel.comp
onent,org.apache.camel;version="[2.16,3)",org.slf4j;version="[1.7,2)",o
rg.w3c.dom,org.xml.sax
Why?
Problem 2: the name of the bundle after the install is probably not compatible How can I change this?
I have solved the problem by copying the ojdbc driver to apache-servicemix-7.0.1\lib\ext