aspose file tools*
The moose likes JDBC and the fly likes Failed to start error in Apache Derby Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Failed to start error in Apache Derby" Watch "Failed to start error in Apache Derby" New topic
Author

Failed to start error in Apache Derby

Yohan Weerasinghe
Ranch Hand

Joined: Oct 07, 2010
Posts: 499

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]


Are you better than me? Then please show me my mistakes..
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19783
    
  20

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?


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Yohan Weerasinghe
Ranch Hand

Joined: Oct 07, 2010
Posts: 499

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

Joined: Oct 21, 2008
Posts: 1107

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

Joined: Oct 07, 2010
Posts: 499

Thanks a lot for all of your replies. The issue is now solved
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19783
    
  20

Would you like to tell us how, so others can learn from your experience?
Yohan Weerasinghe
Ranch Hand

Joined: Oct 07, 2010
Posts: 499

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
 
subject: Failed to start error in Apache Derby