rainu
rainu

Reputation: 763

accessing derby database from eclipse and ij simultaneously

I am developing an dynamic web project in eclipse which requires me to connect to a database and display the fields that I have chosen.

I have created a database named javadb. I am able to access the javadb from ij scripting tool and the eclipse IDE individually but not from both at a time. When I deploy my web app on tomcat server and run the application which is using the database javadb and when I try to connect to the database through the ij tool using the command connect 'jdbc:derby:javadb';
the error shown is

ERROR XJ040: Failed to start database 'javadb' with class loader sun.misc.Launcher$AppClassLoader@74b10b, see the next exception for details.
ERROR XSDB6: Another instance of Derby may have already booted the database /home/computer/javadb.

I am start the apache derby network server using the command

java -jar $DERBY_HOME/lib/derbyrun.jar server start

I am only able to access the javadb only after shutting down the server and restarting it.

I am using Eclipse Kepler , Apache derby 10.10 to create database, Apache tomcat 7 as server. Operating system Ubuntu 12.04

Can anyone please help me out with this problem.

Upvotes: 0

Views: 1109

Answers (2)

KerenSi
KerenSi

Reputation: 389

I also got the same exception, and this is what helped me - delete .lck files in the root directory of the database. Delete them after you make sure no other app is accessing the db.

Upvotes: 1

Bryan Pendleton
Bryan Pendleton

Reputation: 16359

In the embedded configuration, a Derby database can only be accessed by one Java application at a time.

In order to have multiple applications accessing the same Derby database simultaneously, you need to run Derby in a client-server configuration, and ensure that a Derby server is running.

Other than deploying the Derby server, the only other changes you have to make are to change your connection URL and your JDBC class name.

Here's some documentation: http://db.apache.org/derby/docs/10.10/adminguide/cadminov17524.html and http://db.apache.org/derby/docs/10.10/adminguide/cadminov825266.html

Upvotes: 0

Related Questions