• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to deploy swing jar with derby database ?

 
Tempex Palton
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I'm using Netbeans with JDK 7. I'm developing a swing desktop application with embedded derby database.

I'm using the following code.



When i'm running this piece of code in Netbeans it's working fine. But when I close NetBeans and doubly click on the JAR file, it's throwing the following error:
java.net.ConnectException : Error connectiong to server localhost on port 1527 with message Connection refused : Connect

So, how to connect derby DB for distributed jar ?
How can i overcome this. Please help...

 
K. Tsang
Bartender
Posts: 3583
16
Android Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The problem you are facing is probably because once you close Netbeans, the Derby DB engine is shut down.

You should try this:
Build jar as usual
Keep Netbeans running, run the jar pointing the derby jdbc in the classpath in a command prompt (not through Netbeans)

If this works then it's definitely the DB engine. Make sure the derby database is running in the background.

If this doesn't work, check your classpath again
 
Dave Tolls
Ranch Hand
Posts: 2095
15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's the embedded driver, so the db is running in the app.
Or at least it should be, since that's the driver being used.
Except the URL for the DB is not the embedded URL structure.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic