Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java derby database server won't start anymore

I inherited some source code that uses a derby database but starting the server doesn't work anymore.

public void startDatabase(){
    try {
        Class.forName("org.apache.derby.jdbc.ClientDriver");
        System.setProperty("derby.system.home", "D:\\runtime-my.product\\log");

        NetworkServerControl nsc = new NetworkServerControl(InetAddress.getByName("localhost"), 1527)
        nsc.start(null);
        nsc.ping();
    catch (Exception e){
        e.printStackTrace();
    }
}

When nsc.ping() is exectued, the following exception is thrown:

Exception: java.lang.Exception: DRDA_NoIO.S:Could not connect to Derby Network Server on host 127.0.0.1, port 1527: Connection refused: connect

Is there anything obvious missing or wrong with those lines of codes?

like image 708
Markus Avatar asked Oct 29 '25 07:10

Markus


1 Answers

Check whether the server is started. You need to start the server explicitly. or via setting the system property derby.drda.startNetworkServer=true.

like image 69
RahulArackal Avatar answered Oct 31 '25 21:10

RahulArackal