Hi
I have created in BaseX 8.1 a huge database named 'dblp'(~1,5 Go) and I am trying to communicate with it from Java (Eclipse IDE). I have used the Example.java and BaseXClient.java classes provided in BaseX documentation (basex-examples) in order to connect to the BaseX server
try { // initialize timer final long time = System.nanoTime();
// create session final BaseXClient session = new BaseXClient("localhost", 1984, "admin", "admin");
// version 1: perform command and print returned string System.out.println(session.execute("info"));
// version 2 (faster): perform command and pass on result to output stream final OutputStream out = System.out; session.execute("xquery 1 to 10", out);
// close session session.close();
// print time needed final double ms = (System.nanoTime() - time) / 1000000d; System.out.println("\n\n" + ms + " ms");
} catch(final IOException ex) { // print exception ex.printStackTrace(); }
But the connection is always refused. The console shows this error
java.net.ConnectException: Connection refused: connect at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method) at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source) at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source) at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source) at java.net.AbstractPlainSocketImpl.connect(Unknown Source) at java.net.PlainSocketImpl.connect(Unknown Source) at java.net.SocksSocketImpl.connect(Unknown Source) at java.net.Socket.connect(Unknown Source) at dblp.BaseXClient.<init>(BaseXClient.java:47) at dblp.Example.main(Example.java:24)
So could you please show me where is the problem?
Thank you in advance