File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Failed to start error in Apache Derby

 
Yohan Weerasinghe
Ranch Hand
Posts: 507
Java Netbeans IDE Oracle
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First, this is my first time with Apache Derby. I am using netbeans, willing to use embedded apache derby, downloaded derby seperatly (it is also in glassfish, but I reset it to my downloaded one)and I followed the following tutorial for configuring and installing the database. Then, I attached the derby.jar file to my project, using project properties.

http://netbeans.org/kb/docs/ide/java-db.html#starting

The attached image will show my database status in netbeans


My database name is "contact". Table name is "FRIENDS".

Following is my test code

**DatabaseConnector.java**



**DatabaseUI.java**



But, when I am trying to insert data into the database, it is giving me the following error




Why is this? Please help!


Apart from that first main question, I would like to ask another 2 questions.

2. I have to give the explicit location of the database as the connection here. But, when I give this to a client, how can I do that?
3. I have to start the database connection manually using netbeans. Is there anyway to start the database connection automatically? Using code?


I have posted this in another place too, but still no good. Please help me. Thanks
javadb-gif.gif
[Thumbnail for javadb-gif.gif]
 
Rob Spoor
Sheriff
Pie
Posts: 20388
46
Chrome Eclipse IDE Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The exception looks clear enough to me:
Yohan Weerasinghe wrote:

You are running another program that uses the same database, or have incorrectly closed such a program. The database is marked as "in use".

The NullPointerExceptions after that are caused by this error; your Connection object remains null but you still try to use it.

I have posted this in another place too, but still no good. Please help me. Thanks

Can you also tell us which other place that is, with a direct link to the thread in question?
 
Yohan Weerasinghe
Ranch Hand
Posts: 507
Java Netbeans IDE Oracle
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rob Spoor wrote:The exception looks clear enough to me:
Yohan Weerasinghe wrote:

You are running another program that uses the same database, or have incorrectly closed such a program. The database is marked as "in use".

The NullPointerExceptions after that are caused by this error; your Connection object remains null but you still try to use it.


Thanks for the reply Rob, I really appreciate it. But, the case is, there is no such a connection open. I have tried this using all the connection closing techniques I know, including restarting and shutting down the computer.Still, I get the same. Is this is happening because I replaced the derby given by glassfish with the one I downloaded? I don't think anyway. Please help.

Can you also tell us which other place that is, with a direct link to the thread in question?

here
 
Wendy Gibbons
Bartender
Posts: 1107
Eclipse IDE Oracle VI Editor
  • 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you sure net beans isn't connected to it, does it have any helpful features to help you with your database programming..

and I think Rob was a bit harsh I only found that bit in the exception as I was hunting for it, as it is always biting my bum
 
Yohan Weerasinghe
Ranch Hand
Posts: 507
Java Netbeans IDE Oracle
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot for all of your replies. The issue is now solved
 
Rob Spoor
Sheriff
Pie
Posts: 20388
46
Chrome Eclipse IDE Java Windows
  • 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Would you like to tell us how, so others can learn from your experience?
 
Yohan Weerasinghe
Ranch Hand
Posts: 507
Java Netbeans IDE Oracle
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sure..But, seems like I have followed the way of "Network Derby". I am looking for embedded one, which can be moved from machine to machine, along with the program (yes, new DB will get created in every machine, it is OK ). Not something like MS SQL Server which you need to connect all the computers into another machine which has the DB. Will post the complete answer when it is figured out, or, start a new question here if I failed
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic