You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by robert stephens <st...@acm.org> on 2004/11/24 19:03:10 UTC

Lock on toursDB After App Disconnect Using org.apache.derby.jdbc.EmbeddedDriver

I understand that the org.apache.derby.jdbc.EmbeddedDriver does not 
support simultaneous connections to a Cloudscape database however it 
appears that even after the Java app that was using the database 
disconnects and quits.  See  "Interesting Experiment" in --- 3 --- 
below.

Problem Example ---------> For example, I can connect to the example 
"derbyDB" database from App1 and can connecto to the example "toursDB" 
from App2 but after disconnecting and quiting both App1 and 
App2.............App2 is never able to start by itself and connect to 
the "derbyDB" because "once upon a time" App1 had connected to it even 
though App1 is no longer running.

I'm doing this on MacOS X so there is a possibility that since they (I 
think) try to share the JavaVM over multiple apps it could be that the 
Apple JavaVM was still running.

Also note that I am not doing any of this connecting from the command 
line but always through one of 2 Java/GUI based apps with App1 being 
DbVisualizer Free 4.1.1. which is a free Java app you can download from 
http://www.dbvis.com/products/dbvis/index.html and App2 being Sun Java 
Studio Creator which is downloadable from Sun at 
http://wwws.sun.com/software/products/jscreator/

However, I did try the following following to make sure all databases 
and engines were shut down:

--- 1 --- Using DbVisualizer 4.1.1 made a connection (per the 
Apache/Derby doc) jdbc:derby:;shutdown=true and 
jdbc:derby:pathTo_toursDB;shutdown=true

--- 2 --- Re-booted MacOS X to make sure no Apple JavaVM was still 
running

---3 --- Interesting experiment.......using the command line ij tool 
(java org.apache.derby.tools.ij) I created a new testdb by doing ij> 
connect 'jdbc:derby:testdb;create=true';

I verified that Sun Java Studio Creator can connect just fine to this 
newly created Cloudscape database testdb (and it does just fine) - then 
I quit this application.

I then connected to testdb with DbVisualizer 4.1.1 and it connects to 
testdb just fine. I then click the DbVisualizer disconnect button and 
quit the app.

When I start Sun Java Studio again and try to connect to it again I get 
a "Can't start database" Error message even after doing all the reboot 
and jdbc:derby:;shutdown=true stuff above

***** the real interesting part ***** prior to connecting to testdb 
from ANY app if I save a copy of the testdb/log directory, I am able to 
get Sun Java Studio to connect to testdb if I swap back in the original 
testdb/log directory and take out the testdb/log directory that was 
present when the apps each connnected the first time.

I'm thinking there is some info stored in the testdb/log/log1.dat file 
that isn't getting cleaned up after disconnect somehow and this is 
making Sun Java Studio Creator think the testdb (or toursDB) is still 
open (some file is still open) or locked.


Copy toursDB to new location solves this --> Re: Lock on toursDB After App Disconnect Using org.apache.derby.jdbc.EmbeddedDriver

Posted by robert stephens <st...@acm.org>.
Looks like I was able to solve the problem by simply copying the 
toursDB database directory to a new location. Now App1 and App2 can 
access the toursDB Cloudscape database with no problem. I discovered 
that prior to copying the toursDB to a new location the App's were 
throwing an exception with text that contained something like  "can't 
start database" and ce1.dat in use??

Now that I've copied toursDB to a new location and make connections to 
that new copy the problem is solved. I guess this must have been due to 
some sort of file permissions problem on the original database. Thanks 
for all the comments. I've enclosed the complete description of the 
problem (not just the question of multiple connections) below for 
reference.

thanks again,

robert stephens
stephensr@acm.org

On Nov 24, 2004, at 7:51 PM, Stanley Bradbury wrote:

> robert stephens wrote:
>
>> I understand that the org.apache.derby.jdbc.EmbeddedDriver does not 
>> support simultaneous connections to a Cloudscape database however it 
>> appears that even after the Java app that was using the database 
>> disconnects and quits.  See  "Interesting Experiment" in --- 3 --- 
>> below.
>>
>> Problem Example ---------> For example, I can connect to the example 
>> "derbyDB" database from App1 and can connecto to the example 
>> "toursDB" from App2 but after disconnecting and quiting both App1 and 
>> App2.............App2 is never able to start by itself and connect to 
>> the "derbyDB" because "once upon a time" App1 had connected to it 
>> even though App1 is no longer running.
>>
>> I'm doing this on MacOS X so there is a possibility that since they 
>> (I think) try to share the JavaVM over multiple apps it could be that 
>> the Apple JavaVM was still running.
>
> NOTE:  See responses by me and others in the Derby User Discussion area
>
>

Begin forwarded message:

> From: robert stephens <st...@acm.org>
> Date: November 24, 2004 5:54:28 PM CST
> To: "Derby Discussion" <de...@db.apache.org>
> Subject: But Why Can't I Connect to toursDB --> Re: Lock on toursDB 
> After App Disconnect Using org.apache.derby.jdbc.EmbeddedDriver
> Reply-To: "Derby Discussion" <de...@db.apache.org>
>
> ok, but that wasn't my main point - Please read the rest of my posting 
> enclosed again below!! Specifically please have a look at item --- 3 
> --- and ***** the real interesting part *****  and let me know if you 
> have any comments on what's going on.....................
>
> Problem Example ---------> For example, I can connect to the example 
> "derbyDB" database from App1 and can connecto to the example "toursDB" 
> from App2 but after disconnecting and quiting both App1 and 
> App2.............App2 is never able to start by itself and connect to 
> the "derbyDB" because "once upon a time" App1 had connected to it even 
> though App1 is no longer running.
>
> I'm doing this on MacOS X so there is a possibility that since they (I 
> think) try to share the JavaVM over multiple apps it could be that the 
> Apple JavaVM was still running.
>
> Also note that I am not doing any of this connecting from the command 
> line but always through one of 2 Java/GUI based apps with App1 being 
> DbVisualizer Free 4.1.1. which is a free Java app you can download 
> from http://www.dbvis.com/products/dbvis/index.html and App2 being Sun 
> Java Studio Creator which is downloadable from Sun at 
> http://wwws.sun.com/software/products/jscreator/
>
> However, I did try the following following to make sure all databases 
> and engines were shut down:
>
> --- 1 --- Using DbVisualizer 4.1.1 made a connection (per the 
> Apache/Derby doc) jdbc:derby:;shutdown=true and 
> jdbc:derby:pathTo_toursDB;shutdown=true
>
> --- 2 --- Re-booted MacOS X to make sure no Apple JavaVM was still 
> running
>
> ---3 --- Interesting experiment.......using the command line ij tool 
> (java org.apache.derby.tools.ij) I created a new testdb by doing ij> 
> connect 'jdbc:derby:testdb;create=true';
>
> I verified that Sun Java Studio Creator can connect just fine to this 
> newly created Cloudscape database testdb (and it does just fine) - 
> then I quit this application.
>
> I then connected to testdb with DbVisualizer 4.1.1 and it connects to 
> testdb just fine. I then click the DbVisualizer disconnect button and 
> quit the app.
>
> When I start Sun Java Studio again and try to connect to it again I 
> get a "Can't start database" Error message even after doing all the 
> reboot and jdbc:derby:;shutdown=true stuff above
>
> ***** the real interesting part ***** prior to connecting to testdb 
> from ANY app if I save a copy of the testdb/log directory, I am able 
> to get Sun Java Studio to connect to testdb if I swap back in the 
> original testdb/log directory and take out the testdb/log directory 
> that was present when the apps each connnected the first time.
>
> I'm thinking there is some info stored in the testdb/log/log1.dat file 
> that isn't getting cleaned up after disconnect somehow and this is 
> making Sun Java Studio Creator think the testdb (or toursDB) is still 
> open (some file is still open) or locked.
>
>
>
>
> On Nov 24, 2004, at 1:46 PM, Daniel John Debrunner wrote:
>
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>> robert stephens wrote:
>>
>>> I understand that the org.apache.derby.jdbc.EmbeddedDriver does not
>>> support simultaneous connections to a Cloudscape database
>>
>> Just to be clear, the embedded driver does support multiple 
>> simultaneous
>>  connections from within a single Java virtual machine. Derby supports
>> multiple users, multiple connections, multiple threads, transactions,
>> row locking etc.
>>
>> With the embedded driver the limitation is that only a single Java
>> virtual machine can connect to the database files. The optional 
>> network
>> server allows multiple connections to the database from multiple java
>> virtual machines using DB2's JDBC universal driver.
>>
>> Dan.
>> -----BEGIN PGP SIGNATURE-----
>> Version: GnuPG v1.2.5 (MingW32)
>> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>>
>> iD8DBQFBpOUbIv0S4qsbfuQRApC6AKDYyfrjhvoUYd0Pohv0Fcv+gnwOIQCeMJkl
>> aJfy/9+UlVyoV2I/XxSd/SE=
>> =aKNI
>> -----END PGP SIGNATURE-----
>>
>


Copy toursDB to new location solves this --> Re: Lock on toursDB After App Disconnect Using org.apache.derby.jdbc.EmbeddedDriver

Posted by robert stephens <st...@acm.org>.
Looks like I was able to solve the problem by simply copying the 
toursDB database directory to a new location. Now App1 and App2 can 
access the toursDB Cloudscape database with no problem. I discovered 
that prior to copying the toursDB to a new location the App's were 
throwing an exception with text that contained something like  "can't 
start database" and ce1.dat in use??

Now that I've copied toursDB to a new location and make connections to 
that new copy the problem is solved. I guess this must have been due to 
some sort of file permissions problem on the original database. Thanks 
for all the comments. I've enclosed the complete description of the 
problem (not just the question of multiple connections) below for 
reference.

thanks again,

robert stephens
stephensr@acm.org

On Nov 24, 2004, at 7:51 PM, Stanley Bradbury wrote:

> robert stephens wrote:
>
>> I understand that the org.apache.derby.jdbc.EmbeddedDriver does not 
>> support simultaneous connections to a Cloudscape database however it 
>> appears that even after the Java app that was using the database 
>> disconnects and quits.  See  "Interesting Experiment" in --- 3 --- 
>> below.
>>
>> Problem Example ---------> For example, I can connect to the example 
>> "derbyDB" database from App1 and can connecto to the example 
>> "toursDB" from App2 but after disconnecting and quiting both App1 and 
>> App2.............App2 is never able to start by itself and connect to 
>> the "derbyDB" because "once upon a time" App1 had connected to it 
>> even though App1 is no longer running.
>>
>> I'm doing this on MacOS X so there is a possibility that since they 
>> (I think) try to share the JavaVM over multiple apps it could be that 
>> the Apple JavaVM was still running.
>
> NOTE:  See responses by me and others in the Derby User Discussion area
>
>

Begin forwarded message:

> From: robert stephens <st...@acm.org>
> Date: November 24, 2004 5:54:28 PM CST
> To: "Derby Discussion" <de...@db.apache.org>
> Subject: But Why Can't I Connect to toursDB --> Re: Lock on toursDB 
> After App Disconnect Using org.apache.derby.jdbc.EmbeddedDriver
> Reply-To: "Derby Discussion" <de...@db.apache.org>
>
> ok, but that wasn't my main point - Please read the rest of my posting 
> enclosed again below!! Specifically please have a look at item --- 3 
> --- and ***** the real interesting part *****  and let me know if you 
> have any comments on what's going on.....................
>
> Problem Example ---------> For example, I can connect to the example 
> "derbyDB" database from App1 and can connecto to the example "toursDB" 
> from App2 but after disconnecting and quiting both App1 and 
> App2.............App2 is never able to start by itself and connect to 
> the "derbyDB" because "once upon a time" App1 had connected to it even 
> though App1 is no longer running.
>
> I'm doing this on MacOS X so there is a possibility that since they (I 
> think) try to share the JavaVM over multiple apps it could be that the 
> Apple JavaVM was still running.
>
> Also note that I am not doing any of this connecting from the command 
> line but always through one of 2 Java/GUI based apps with App1 being 
> DbVisualizer Free 4.1.1. which is a free Java app you can download 
> from http://www.dbvis.com/products/dbvis/index.html and App2 being Sun 
> Java Studio Creator which is downloadable from Sun at 
> http://wwws.sun.com/software/products/jscreator/
>
> However, I did try the following following to make sure all databases 
> and engines were shut down:
>
> --- 1 --- Using DbVisualizer 4.1.1 made a connection (per the 
> Apache/Derby doc) jdbc:derby:;shutdown=true and 
> jdbc:derby:pathTo_toursDB;shutdown=true
>
> --- 2 --- Re-booted MacOS X to make sure no Apple JavaVM was still 
> running
>
> ---3 --- Interesting experiment.......using the command line ij tool 
> (java org.apache.derby.tools.ij) I created a new testdb by doing ij> 
> connect 'jdbc:derby:testdb;create=true';
>
> I verified that Sun Java Studio Creator can connect just fine to this 
> newly created Cloudscape database testdb (and it does just fine) - 
> then I quit this application.
>
> I then connected to testdb with DbVisualizer 4.1.1 and it connects to 
> testdb just fine. I then click the DbVisualizer disconnect button and 
> quit the app.
>
> When I start Sun Java Studio again and try to connect to it again I 
> get a "Can't start database" Error message even after doing all the 
> reboot and jdbc:derby:;shutdown=true stuff above
>
> ***** the real interesting part ***** prior to connecting to testdb 
> from ANY app if I save a copy of the testdb/log directory, I am able 
> to get Sun Java Studio to connect to testdb if I swap back in the 
> original testdb/log directory and take out the testdb/log directory 
> that was present when the apps each connnected the first time.
>
> I'm thinking there is some info stored in the testdb/log/log1.dat file 
> that isn't getting cleaned up after disconnect somehow and this is 
> making Sun Java Studio Creator think the testdb (or toursDB) is still 
> open (some file is still open) or locked.
>
>
>
>
> On Nov 24, 2004, at 1:46 PM, Daniel John Debrunner wrote:
>
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>> robert stephens wrote:
>>
>>> I understand that the org.apache.derby.jdbc.EmbeddedDriver does not
>>> support simultaneous connections to a Cloudscape database
>>
>> Just to be clear, the embedded driver does support multiple 
>> simultaneous
>>  connections from within a single Java virtual machine. Derby supports
>> multiple users, multiple connections, multiple threads, transactions,
>> row locking etc.
>>
>> With the embedded driver the limitation is that only a single Java
>> virtual machine can connect to the database files. The optional 
>> network
>> server allows multiple connections to the database from multiple java
>> virtual machines using DB2's JDBC universal driver.
>>
>> Dan.
>> -----BEGIN PGP SIGNATURE-----
>> Version: GnuPG v1.2.5 (MingW32)
>> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>>
>> iD8DBQFBpOUbIv0S4qsbfuQRApC6AKDYyfrjhvoUYd0Pohv0Fcv+gnwOIQCeMJkl
>> aJfy/9+UlVyoV2I/XxSd/SE=
>> =aKNI
>> -----END PGP SIGNATURE-----
>>
>


Re: Lock on toursDB After App Disconnect Using org.apache.derby.jdbc.EmbeddedDriver

Posted by Stanley Bradbury <br...@Mutagen.Net>.
robert stephens wrote:

> I understand that the org.apache.derby.jdbc.EmbeddedDriver does not 
> support simultaneous connections to a Cloudscape database however it 
> appears that even after the Java app that was using the database 
> disconnects and quits.  See  "Interesting Experiment" in --- 3 --- below.
>
> Problem Example ---------> For example, I can connect to the example 
> "derbyDB" database from App1 and can connecto to the example "toursDB" 
> from App2 but after disconnecting and quiting both App1 and 
> App2.............App2 is never able to start by itself and connect to 
> the "derbyDB" because "once upon a time" App1 had connected to it even 
> though App1 is no longer running.
>
> I'm doing this on MacOS X so there is a possibility that since they (I 
> think) try to share the JavaVM over multiple apps it could be that the 
> Apple JavaVM was still running.

NOTE:  See responses by me and others in the Derby User Discussion area