Can't connect to arangodb using Java API

840 views Asked by At

I have a problem when accessing arangodb using Java driver. When i run my application, it runs but neither it shows any response and nor it throws any error. Then i think it must be something on my connection to the remote arangodb server, and i tried to connect using Python arangodb, and it's success to connect.

Anyone knows what's the problem with my arangodb Java application? Is there any difference between java connector and python to arango? I'm using java driver arango 5.0.1

Here's what I've tried:

Java Driver :

public static void main(String[] args) {
        // TODO Auto-generated method stub

        @SuppressWarnings("deprecation")
        ArangoDB arangodb = new ArangoDB.Builder().timeout(100).host("10.22.21.70",8599).user("xxx").password("xxx").useProtocol(Protocol.VST).build(); 
        System.out.println("Test Start");
        ArangoDatabase db = arangodb.db("data");

        boolean tes = db.exists();

        System.out.println("success");
        arangodb.shutdown();
    }

This program continues to run like this, without being terminated and throwing an error : enter image description here

Using Python Arango :

import json
from arango import ArangoClient
from pyArango.connection import *


USER = 'xxx'
PASS = 'xxx'
HOST = '10.22.21.70'
DATABASE = 'data'
PORTT = 8599

client = ArangoClient(host=HOST,port=PORTT)
db = client.db(DATABASE,username=USER,password=PASS)

query = 'FOR s IN Email FILTER s.date>= "2018-11-07" LIMIT 0,2 RETURN s'
queryResult = db.aql.execute(query,batch_size=2,count=True)
res = queryResult.batch()


print(res)

And also i've tried to use telnet to the remote server, and it shows blank screen, which means no problem with the connection between my local host with the remote host.

Thanks

2

There are 2 answers

0
rashtao On

You are setting a timeout of 100ms, maybe you have higher network latencies while connecting to the remote server? To double check if this is the problem you can try without setting the timeout.

0
ramazan polat On

I'm using java driver arango 5.0.1

I had the same issue. Using v4.2.2 solved the problem. If someone could explain why drivers are not compatible, that would be great.