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 Sunitha Kambhampati <ks...@gmail.com> on 2005/11/10 23:04:43 UTC

Connect to a 'database in a jar' when using network server

Hi All,

What is the correct way to connect to a database in a jar using the 
client driver. Is this possible currently ?

I tried the following:
1.  created database tdb3, created a jar with the database in it . Jar 
file is tdb3.jar
2.  Put tdb3.jar in classpath of network server and started the server.

When I try to connect to database tdb3, using ij , I get
ij version 10.1
ij> connect 'jdbc:derby://localhost:1527/tdb3';
ERROR 08004: The application server rejected establishment of the 
connection.  A
n attempt was made to access a database, tdb3, which was not found.

When I try to use embedded ( and classpath is set to tdb3) , I can of 
course connect OK with the url
ij>connect 'jdbc:derby:classpath:tdb3';
ij>

Thanks,
Sunitha.

Re: Connect to a 'database in a jar' when using network server

Posted by Rajesh Kartha <ka...@Source-Zone.Org>.
Hi Sunitha

Once the database is booted by the server using 
'jdbc:derby://localhost:1527/classpath:adb' -  the first time,  the 
later connections
can use 'jdbc:derby://localhost:1527/adb'.

Here is what I tired:

_First Connection:_

C:\temp>java org.apache.derby.tools.ij
ij version 10.2
ij> connect 'jdbc:derby://localhost:1527/adb';
ERROR 08004: The application server rejected establishment of the 
connection.  A
n attempt was made to access a database, adb, which was not found.
ij> connect 'jdbc:derby://localhost:1527/classpath:adb';
ij> select * from foo.table1;
ID
-----------
1

1 row selected
ij> quit;

_Later connections :_

C:\temp>java org.apache.derby.tools.ij
ij version 10.2
ij> connect 'jdbc:derby://localhost:1527/adb';
ij> select * from foo.table1;
ID
-----------
1

1 row selected

Needless to say, if the server is recycled, the  above steps needs to be 
repeated.

Hope the above helps.

Regards,
Rajesh

Sunitha Kambhampati wrote:

> Hi All,
>
> What is the correct way to connect to a database in a jar using the 
> client driver. Is this possible currently ?
>
> I tried the following:
> 1.  created database tdb3, created a jar with the database in it . Jar 
> file is tdb3.jar
> 2.  Put tdb3.jar in classpath of network server and started the server.
>
> When I try to connect to database tdb3, using ij , I get
> ij version 10.1
> ij> connect 'jdbc:derby://localhost:1527/tdb3';
> ERROR 08004: The application server rejected establishment of the 
> connection.  A
> n attempt was made to access a database, tdb3, which was not found.
>
> When I try to use embedded ( and classpath is set to tdb3) , I can of 
> course connect OK with the url
> ij>connect 'jdbc:derby:classpath:tdb3';
> ij>
>
> Thanks,
> Sunitha.
>