Just as a note. Supporting JDBC in OSGi has been standardized in the OSGi 4.2 Enterprise Release (chapter 125) [1].
So if you get a JDBC driver that supports that specification you can obtain your JDBC drivers through the OSGi service registry without any classloader tricks. Best regards, David [1] http://www.osgi.org/Download/Release4V42 On 11 November 2010 22:43, Joel Schuster <[email protected]> wrote: > If you must use the JDBC driver directly then the issue is with the > classloader as the DriverManager is trying to load it 'behind the scenes'. > Read my blog article on how to work around this: > > http://joelschuster.blogspot.com/ > > However, I highly recommend using JPA via Eclipselink instead which works > great with OSGi. > > For the Oracle Driver... we OSGi-ified it using bnd. The turns the ojdbc6.jar > into a OSGi bundle which then is used by EclipseLink. > > - Joel > > ________________________________________ > From: Justin Edelson [[email protected]] On Behalf Of Justin Edelson > [[email protected]] > Sent: Thursday, November 11, 2010 10:55 AM > To: [email protected] > Subject: Re: Oracle JDBC in OSGI > > Ask Oracle. > > On Nov 11, 2010, at 12:48 PM, Larry T <[email protected]> wrote: > >> >> I'm trying to migrate a simple application into our OSGi framework. I've got >> the typical code that does: >> >> Class.forName("oracle.jdbc.driver.OracleDriver"); >> connection = DriverManager.getConnection(url, user, pass); >> >> and i get a CNFE on the driver. I don't have an OSGi-ified ojdbc6.jar >> bundle, so I tried to embed the stuff in my bundle by using the following in >> my pom: >> >> <Embed-Dependency>*;scope=compile;artifactId=ojdbc6</Embed-Dependency> >> >> Which gets past the CNFE, but then I get the following when deploying my >> bundle: >> >> org.osgi.framework.BundleException: Unresolved constraint in bundle <my >> bundle name>: Unable to reolve 275.0: missing requirement [275.0] package; >> (package=com.sun.security.auth.module) >> >> I don't want to go down the path of finding all dependencies and embedding >> them. Isn't there an OSGi-ified bundle for ojdbc6.jar around? There must >> be others who are using JDBC from within OSGi, right? >> >> Thanks, >> Larry >> -- >> View this message in context: >> http://old.nabble.com/Oracle-JDBC-in-OSGI-tp30192290p30192290.html >> Sent from the Apache Felix - Users mailing list archive at Nabble.com. >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [email protected] >> For additional commands, e-mail: [email protected] >> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]

