Re: Cannot connect a second time to an embedded Cloudscape/Derby
Hi, tried to shutdown my derby db between the two connection attempts. But I received an exception when connecting the second time to the derby db, telling me that the db is already shutdown. Do I have to specify special restart options in the connection string? Thanks for posting it also in the dev list. Regards Thomas [EMAIL PROTECTED] wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Thomas Neumann wrote: Hello, since I had problems with our local mailer daemon to confirm my subscription to the derby mailing list I do not know if this mail was send to the other list members. So this actually the second trial to send this mail. Sorry for any inconvenience if you have received this mail twice. I have a problem with the embedded Cloudscape/Derby version on Windows in my maven build script. This build script uses the maven hibernate plug in to create the dbms. The connection URL for the db is jdbc:derby:db/derby/dmstest;create=true This works fine. Afterwards when the schema creation is finished in a second step unit tests should run on this db using the same connection URL. They fail with the following exception. Caused by: SQL Exception: Failed to start database 'db/derby/dmstest', see the next exception for details. at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Util.java) at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Util.java) at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Util.java) at org.apache.derby.impl.jdbc.EmbedConnection.newSQLException(EmbedConnection.java) at org.apache.derby.impl.jdbc.EmbedConnection.bootDatabase(EmbedConnection.java) at org.apache.derby.impl.jdbc.EmbedConnection.(EmbedConnection.java) at org.apache.derby.impl.jdbc.EmbedConnection20.(EmbedConnection20.java) at org.apache.derby.impl.jdbc.EmbedConnection30.(EmbedConnection30.java) at org.apache.derby.jdbc.Driver30.getNewEmbedConnection(Driver30.java) at org.apache.derby.jdbc.Driver169.connect(Driver169.java) at org.apache.derby.jdbc.EmbeddedDriver.connect(EmbeddedDriver.java) at org.apache.tools.ant.taskdefs.JDBCTask.getConnection(JDBCTask.java:342) This is the same exception as if a second JVM is running with an embedded Cloudscape/Derby instance in it already accessing the same database. But I sware there is no second JVM running. Another curiosity on this, the same build script is running on a linux box without any problems. I'm using windows xp pro, JDK 1.4.2-06 and Cloudscape/Derby 10 for this scenario Can anybody give me a hint or knows a workaround for this problem? Thanks in advance If the initial jvm is still running you need to take care to shutdown the derby database properly. To do this you should connect with: jdbc:derby:db/derby/dmstest;shutdown=true or to shutdown derby completely jdbc:derby:;shutdown=true There have been issues in the past with the db.lck file getting cleaned up properly otherwise on Linux/Unix I think, but I thought that was fixed in 1.4.2. I will cc derby-dev so someone with more knowledge on the issue can comment. Thanks Kathey -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.5 (MingW32) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFB9p9zG0h36bFmkocRAgrbAJ9z6131JwkyfbUI9V+2I/PgxndkGgCeNsVS uQMDQ5q6k1OFTcqInjFA7pA= =RuNC -END PGP SIGNATURE-
Re: Cannot connect a second time to an embedded Cloudscape/Derby DB (2)
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Thomas Neumann wrote: > Hello, > > since I had problems with our local mailer daemon to confirm my > subscription to the derby mailing list I do not know if this mail was > send to the other list members. So this actually the second trial to > send this mail. Sorry for any inconvenience if you have received this > mail twice. > > I have a problem with the embedded Cloudscape/Derby version on Windows > in my maven build script. This build script uses the maven hibernate > plug in to create the dbms. The connection URL for the db is > jdbc:derby:db/derby/dmstest;create=true > This works fine. Afterwards when the schema creation is finished in a > second step unit tests should run on this db using the same connection > URL. They fail with the following exception. > > Caused by: SQL Exception: Failed to start database 'db/derby/dmstest', > see the next exception for details. > at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Util.java) > at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Util.java) > at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Util.java) > at > org.apache.derby.impl.jdbc.EmbedConnection.newSQLException(EmbedConnection.java) > > at > org.apache.derby.impl.jdbc.EmbedConnection.bootDatabase(EmbedConnection.java) > > at org.apache.derby.impl.jdbc.EmbedConnection.(EmbedConnection.java) > at org.apache.derby.impl.jdbc.EmbedConnection20.(EmbedConnection20.java) > at org.apache.derby.impl.jdbc.EmbedConnection30.(EmbedConnection30.java) > at org.apache.derby.jdbc.Driver30.getNewEmbedConnection(Driver30.java) > at org.apache.derby.jdbc.Driver169.connect(Driver169.java) > at org.apache.derby.jdbc.EmbeddedDriver.connect(EmbeddedDriver.java) > at org.apache.tools.ant.taskdefs.JDBCTask.getConnection(JDBCTask.java:342) > > This is the same exception as if a second JVM is running with an > embedded Cloudscape/Derby instance in it already accessing the same > database. But I sware there is no second JVM running. > > Another curiosity on this, the same build script is running on a linux > box without any problems. > > I'm using windows xp pro, JDK 1.4.2-06 and Cloudscape/Derby 10 for this > scenario > > Can anybody give me a hint or knows a workaround for this problem? > > Thanks in advance > > > If the initial jvm is still running you need to take care to shutdown the derby database properly. To do this you should connect with: jdbc:derby:db/derby/dmstest;shutdown=true or to shutdown derby completely jdbc:derby:;shutdown=true There have been issues in the past with the db.lck file getting cleaned up properly otherwise on Linux/Unix I think, but I thought that was fixed in 1.4.2. I will cc derby-dev so someone with more knowledge on the issue can comment. Thanks Kathey -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.5 (MingW32) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFB9p9zG0h36bFmkocRAgrbAJ9z6131JwkyfbUI9V+2I/PgxndkGgCeNsVS uQMDQ5q6k1OFTcqInjFA7pA= =RuNC -END PGP SIGNATURE-
Re: Cannot connect a second time to an embedded Cloudscape/Derby
Thanks for link on the maven info. I tried a workaround by not using the embedded version of derby for my tests. So I started up a network server of derby that is running inside JBoss and access it via the db2jcc drivers. So the build script worked without a problem. It was able to connect twice to the network server. Which is not supprising, since it is a standard scenario. But it showed me that the build script is working fine. Beside this I just fixed another incompatiblity between Windows and Linux in another piece of software of us. The problem arised out of the fact, that the interaction between locks and channels in the Java NIO package is different on Windows than on Linux. On Linux the locks are handled on a per OS process/JVM level. So that when I open a channel on a file on Linux and lock this file, another channel in the *same* OS process/JVM is still able to access the file. While under Windows the second channel would receive an exception because this file is locked by the first channel, even it is running in the *same* JVM. I could guess that there is something similar inside derby. Since derby is locking the db-file when the DBMS is started. So I could imagine that when I access the derby db the second time a second channel is opened, and there are still locks around of the first channel that is used during the first time. Which results in a exception that is than translated to the error "Failed to start database" on windows.And on Linux it would work perfectly fine. Well it's just a guess and I'm not familiar with the architecture of derby to go through the source code to verify this possiblity. Does anybody have experience with a similar scenario? Thanks Thomas [EMAIL PROTECTED] wrote: This doesn't address why you get the failure on Windows and not on Linux. But I searched for "maven" on the derby lists and found the instructions Jeremy posted in December on using derby from maven: http://mail-archives.apache.org/eyebrowse/[EMAIL PROTECTED]&msgId=2033145 I wonder if eliminating one moving part from your scenario might help isolate the actual problem. -jean Thomas Neumann wrote: Hello, since I had problems with our local mailer daemon to confirm my subscription to the derby mailing list I do not know if this mail was send to the other list members. So this actually the second trial to send this mail. Sorry for any inconvenience if you have received this mail twice. I have a problem with the embedded Cloudscape/Derby version on Windows in my maven build script. This build script uses the maven hibernate plug in to create the dbms. The connection URL for the db is jdbc:derby:db/derby/dmstest;create=true This works fine. Afterwards when the schema creation is finished in a second step unit tests should run on this db using the same connection URL. They fail with the following exception. Caused by: SQL Exception: Failed to start database 'db/derby/dmstest', see the next exception for details. at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Util.java) at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Util.java) at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Util.java) at org.apache.derby.impl.jdbc.EmbedConnection.newSQLException(EmbedConnection.java) at org.apache.derby.impl.jdbc.EmbedConnection.bootDatabase(EmbedConnection.java) at org.apache.derby.impl.jdbc.EmbedConnection.(EmbedConnection.java) at org.apache.derby.impl.jdbc.EmbedConnection20.(EmbedConnection20.java) at org.apache.derby.impl.jdbc.EmbedConnection30.(EmbedConnection30.java) at org.apache.derby.jdbc.Driver30.getNewEmbedConnection(Driver30.java) at org.apache.derby.jdbc.Driver169.connect(Driver169.java) at org.apache.derby.jdbc.EmbeddedDriver.connect(EmbeddedDriver.java) at org.apache.tools.ant.taskdefs.JDBCTask.getConnection(JDBCTask.java:342) This is the same exception as if a second JVM is running with an embedded Cloudscape/Derby instance in it already accessing the same database. But I sware there is no second JVM running. Another curiosity on this, the same build script is running on a linux box without any problems. I'm using windows xp pro, JDK 1.4.2-06 and Cloudscape/Derby 10 for this scenario Can anybody give me a hint or knows a workaround for this problem? Thanks in advance
Re: Cannot connect a second time to an embedded Cloudscape/Derby DB (2)
This doesn't address why you get the failure on Windows and not on Linux. But I searched for "maven" on the derby lists and found the instructions Jeremy posted in December on using derby from maven: http://mail-archives.apache.org/eyebrowse/[EMAIL PROTECTED]&msgId=2033145 I wonder if eliminating one moving part from your scenario might help isolate the actual problem. -jean Thomas Neumann wrote: Hello, since I had problems with our local mailer daemon to confirm my subscription to the derby mailing list I do not know if this mail was send to the other list members. So this actually the second trial to send this mail. Sorry for any inconvenience if you have received this mail twice. I have a problem with the embedded Cloudscape/Derby version on Windows in my maven build script. This build script uses the maven hibernate plug in to create the dbms. The connection URL for the db is jdbc:derby:db/derby/dmstest;create=true This works fine. Afterwards when the schema creation is finished in a second step unit tests should run on this db using the same connection URL. They fail with the following exception. Caused by: SQL Exception: Failed to start database 'db/derby/dmstest', see the next exception for details. at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Util.java) at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Util.java) at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Util.java) at org.apache.derby.impl.jdbc.EmbedConnection.newSQLException(EmbedConnection.java) at org.apache.derby.impl.jdbc.EmbedConnection.bootDatabase(EmbedConnection.java) at org.apache.derby.impl.jdbc.EmbedConnection.(EmbedConnection.java) at org.apache.derby.impl.jdbc.EmbedConnection20.(EmbedConnection20.java) at org.apache.derby.impl.jdbc.EmbedConnection30.(EmbedConnection30.java) at org.apache.derby.jdbc.Driver30.getNewEmbedConnection(Driver30.java) at org.apache.derby.jdbc.Driver169.connect(Driver169.java) at org.apache.derby.jdbc.EmbeddedDriver.connect(EmbeddedDriver.java) at org.apache.tools.ant.taskdefs.JDBCTask.getConnection(JDBCTask.java:342) This is the same exception as if a second JVM is running with an embedded Cloudscape/Derby instance in it already accessing the same database. But I sware there is no second JVM running. Another curiosity on this, the same build script is running on a linux box without any problems. I'm using windows xp pro, JDK 1.4.2-06 and Cloudscape/Derby 10 for this scenario Can anybody give me a hint or knows a workaround for this problem? Thanks in advance
