Reputation: 173
java.sql.SQLNonTransientConnectionException: java.net.ConnectException :
Error connecting to server localhost on port 1527 with message Connection refused: connect.
I am using Netbeans.
If I go to the Services Tab and rightclick Java DB and start Server it works fine.
How can I do this programmaticly at Runtime. I just need whatever method will start the Java DB Server.
Upvotes: 2
Views: 2190
Reputation: 18714
You need to start the NetworkServerControl additional documentation can be found here
NetworkServerControl server = new NetworkServerControl(InetAddress.getByName("localhost"), port);
Upvotes: 1
Reputation: 10389
Have a look at how to use JavaDB with a desktop application. They describe how to start it programmatically there.
Upvotes: 2