You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-user@db.apache.org by Paul French <pa...@kirona.com> on 2008/10/01 22:22:42 UTC

IBM J9 Personal Profile 1.1 + OSGi + Derby

Hello All,
 
I noticed I derby.jar is an OSGi bundle and so I installed it in my OSGi
container (Knopflerfish 2.0.5) running on IBM J9 PP1.1
 
I included the required jdbc.jar (JSR169) in the bootpath of the J9 jvm. I
can install the bundle no problems. When I try and start the bundle I get:
 
java.lang.NoClassDefFoundError: java.sql.Driver
 
>From reading this page on the wiki
http://wiki.apache.org/db-derby/JavaMESupport?highlight=(j2me)
 
I know java.sql.Driver does not exist in JSR169.
 
Hence how do I tell the derby bundle not to use java.sql.Driver and use
instead javax.sql.DataSource
 
Any help would be appreciated.
 
Many Thanks
Paul

Re: IBM J9 Personal Profile 1.1 + OSGi + Derby

Posted by Stanley Bradbury <St...@gmail.com>.
Paul French wrote:
> Hello All,
>  
> I noticed I derby.jar is an OSGi bundle and so I installed it in my 
> OSGi container (Knopflerfish 2.0.5) running on IBM J9 PP1.1
>  
> I included the required jdbc.jar (JSR169) in the bootpath of the J9 
> jvm. I can install the bundle no problems. When I try and start the 
> bundle I get:
>  
> java.lang.NoClassDefFoundError: java.sql.Driver
>  
> From reading this page on the wiki 
> http://wiki.apache.org/db-derby/JavaMESupport?highlight=(j2me 
> <http://wiki.apache.org/db-derby/JavaMESupport?highlight=%28j2me>)
>  
> I know java.sql.Driver does not exist in JSR169.
>  
> Hence how do I tell the derby bundle not to use java.sql.Driver and 
> use instead javax.sql.DataSource
>  
> Any help would be appreciated.
>  
> Many Thanks
> Paul
Hi Paul -

I'm confused.  Derby should load the driver you tell it to load.  You 
need to use

org.apache.derby.jdbc.EmbeddedSimpleDataSource

The example program SimpleMobileApp.java (in the DEMO/PROGRAMS folder) shows you how to set up a program to run in this environment.




Re: IBM J9 Personal Profile 1.1 + OSGi + Derby

Posted by Daniel John Debrunner <dj...@apache.org>.
Paul French wrote:
> Thanks Dan,
> 
> I had a look at the source code last night and noticed the EmbeddedActivator
> instantiates a EmbeddedDataSource which by default uses java.sql.Driver.
> 
> I will probably write my own Activator instead. The problem now is the
> DriverManager provides static methods to return connections where as we need
> to deal with an instance of a javax.sql.DataSource to get connections. The
> current Activator instantiates an EmbeddedDataSource and does not need to
> retain a reference to it since connections are obtained via the static
> DriverManager.getConnection method.

I don't see the current activator 
(org.apache.derby.osgi.EmbeddedActivator) creating an EmbeddedDataSource??

> Ideally current EmbeddedActivator needs to do both. I suppose it can check
> for the existence of the java.sql.Driver class whether to use a
> EmbeddedDataSource or EmbeddedSimpleDataSource. But since the
> java.sql.DriverManager and javax.sql.DataSource provided connections in a
> different way I'm not sure how to accommodate both?

Not sure what you mean here, the activator doesn't create connections. 
Its only purpose is to start the core engine up, applications would 
continue to get connections using whichever api they prefer, DataSource 
(all) or DriverManager (jdbc 3, jdbc 4).

Really EmbeddedActivator should be booting the engine using internal 
methods similar to how EmbeddedSimpleDataSource.findSriver() does, and 
shutting down the engine using EmbeddedSimpleDataSource to get a 
connection and not DriverManager.

Dan.


RE: IBM J9 Personal Profile 1.1 + OSGi + Derby

Posted by Paul French <pa...@kirona.com>.
Thanks Dan,

I had a look at the source code last night and noticed the EmbeddedActivator
instantiates a EmbeddedDataSource which by default uses java.sql.Driver.

I will probably write my own Activator instead. The problem now is the
DriverManager provides static methods to return connections where as we need
to deal with an instance of a javax.sql.DataSource to get connections. The
current Activator instantiates an EmbeddedDataSource and does not need to
retain a reference to it since connections are obtained via the static
DriverManager.getConnection method.

Ideally current EmbeddedActivator needs to do both. I suppose it can check
for the existence of the java.sql.Driver class whether to use a
EmbeddedDataSource or EmbeddedSimpleDataSource. But since the
java.sql.DriverManager and javax.sql.DataSource provided connections in a
different way I'm not sure how to accommodate both?

Any ideas?

Thanks
Paul

-----Original Message-----
From: Daniel John Debrunner [mailto:djd@apache.org] 
Sent: 02 October 2008 01:00
To: Derby Discussion
Subject: Re: IBM J9 Personal Profile 1.1 + OSGi + Derby

Paul French wrote:
> Hello All,
>  
> I noticed I derby.jar is an OSGi bundle and so I installed it in my 
> OSGi container (Knopflerfish 2.0.5) running on IBM J9 PP1.1
>  
> I included the required jdbc.jar (JSR169) in the bootpath of the J9 jvm. 
> I can install the bundle no problems. When I try and start the bundle I
get:
>  
> java.lang.NoClassDefFoundError: java.sql.Driver
>  
>  From reading this page on the wiki
> http://wiki.apache.org/db-derby/JavaMESupport?highlight=(j2me)
>  
> I know java.sql.Driver does not exist in JSR169.
>  
> Hence how do I tell the derby bundle not to use java.sql.Driver and 
> use instead javax.sql.DataSource

This is an outstanding bug, DERBY-873:

http://issues.apache.org/jira/browse/DERBY-873

Dan.

__________ NOD32 3488 (20081002) Information __________

This message was checked by NOD32 antivirus system.
http://www.eset.com



Re: IBM J9 Personal Profile 1.1 + OSGi + Derby

Posted by Daniel John Debrunner <dj...@apache.org>.
Paul French wrote:
> Hello All,
>  
> I noticed I derby.jar is an OSGi bundle and so I installed it in my OSGi 
> container (Knopflerfish 2.0.5) running on IBM J9 PP1.1
>  
> I included the required jdbc.jar (JSR169) in the bootpath of the J9 jvm. 
> I can install the bundle no problems. When I try and start the bundle I get:
>  
> java.lang.NoClassDefFoundError: java.sql.Driver
>  
>  From reading this page on the wiki 
> http://wiki.apache.org/db-derby/JavaMESupport?highlight=(j2me)
>  
> I know java.sql.Driver does not exist in JSR169.
>  
> Hence how do I tell the derby bundle not to use java.sql.Driver and use 
> instead javax.sql.DataSource

This is an outstanding bug, DERBY-873:

http://issues.apache.org/jira/browse/DERBY-873

Dan.

Re: IBM J9 Personal Profile 1.1 + OSGi + Derby

Posted by Myrna van Lunteren <m....@gmail.com>.
On Wed, Oct 1, 2008 at 1:22 PM, Paul French <pa...@kirona.com> wrote:
> Hello All,
>
> I noticed I derby.jar is an OSGi bundle and so I installed it in my OSGi
> container (Knopflerfish 2.0.5) running on IBM J9 PP1.1
>
> I included the required jdbc.jar (JSR169) in the bootpath of the J9 jvm. I
> can install the bundle no problems. When I try and start the bundle I get:
>
> java.lang.NoClassDefFoundError: java.sql.Driver
>
> From reading this page on the wiki
> http://wiki.apache.org/db-derby/JavaMESupport?highlight=(j2me)
>
> I know java.sql.Driver does not exist in JSR169.
>
> Hence how do I tell the derby bundle not to use java.sql.Driver and use
> instead javax.sql.DataSource
>
> Any help would be appreciated.
>
> Many Thanks
> Paul

Hi,

I wonder
1. Did you get more of a stack trace? Maybe in a log file somewhere?
2. What is the exact output when you do: "j9 -version"  ?

Note, that we support the Foundation (1.1) Profile - as far as I can
tell, Personal Profile is a superset of that...

Myrna