Connecting to a remote server

Hi,

I'm trying to connect to a stardog server which lives on a another machine on my local network. I've previously done fine via dotNetRDF in c#, but now I'm working on a project which requires me to connect to stardog from a java application.

I have tried the following:

Connection aConn = ConnectionConfiguration
				.to("http://172.20.100.5:5820/BraveNew")
					.credentials("admin", "admin")
					.connect();

and I get the following exception:

com.complexible.stardog.StardogException: connection refused

I can still connect fine via the web interface. I'm sure I'm making a daft mistake, but I've tried every variation I can find suggested and it doesn't work for me.

Kind Regards

Chris

That looks ok. There is the possiblity that the remote database isn't running, isnt' running on the port you think it is, or that there is a firewall that is blocking port 5820.

You may want to try connecting to the remote database with the cli to confirm that its running and you can connect.

You can specify the remote database to connect to in the cli as part of the database connection string.

try starodg-admin server status with the --server argument set to your remote server.

Hi Chris,

ConnectionConfiguration.to actually accepts just the database name. You could do the following:

Connection aConn = ConnectionConfiguration
    .to("BraveNew")
    .server("http://172.20.100.5:5820")
    .credentials("admin", "admin")
    .connect();

To use a connection string like you have, you might be able to try from:

Connection aConn = ConnectionConfiguration
				.from("http://172.20.100.5:5820/BraveNew")
					.credentials("admin", "admin")
					.connect();

Many thanks for your assistance thus far, making the change you suggest changes the exception I get to:

com.complexible.stardog.StardogException: JsonObject
at com.complexible.stardog.protocols.client.SPECClientUtil.toStardogException(SPECClientUtil.java:86)
at com.complexible.stardog.protocols.client.SPECClientUtil.toStardogException(SPECClientUtil.java:34)
at com.complexible.stardog.protocols.http.client.HttpConnection.create(HttpConnection.java:49)
at com.complexible.stardog.protocols.http.client.HttpDriver.connect(HttpDriver.java:75)
at com.complexible.stardog.api.DriverManager.getConnection(DriverManager.java:74)
at com.complexible.stardog.api.ConnectionConfiguration.connect(ConnectionConfiguration.java:126)
at org.uob.brave.datalink.DirectDatalink.InsertData(DirectDatalink.java:66[The line shown below]

The exception still comes at the same line i.e.

   Connection aConn = ConnectionConfiguration
		    .to("BraveNew")
		    .server("http://172.20.100.5:5820")
		    .credentials("admin", "admin")
		    .connect();

So this is progress.

Just incase anyone finds this in the future: I was using*very * wrong imports via maven - they were dated and didn't match my server version.

Hello,

I also got the same problem as this one. What version of dependency that you use?
Here is my current dependency

   <dependency>
			<groupId>com.complexible.stardog</groupId>
			<artifactId>client-http</artifactId>
			<version>4.2.4</version>
			<type>pom</type>
		</dependency>

Thank you.