0

I'm trying to do something really simple: will connect to the DB, read some records, and display them in a nice interface.

So far all I've done is start and stop the server, using the following code:

Server aServer = Stardog
                .buildServer()
                .bind(SNARLProtocolConstants.EMBEDDED_ADDRESS)
                .start();

To operate this, I had to download and import SLF4J, and also import all libraries found in my stardog / server.

Then I could start and stop the server, but my problem is I can not connect to my database.

I am using the following code to try to connect:

try (Connection aConn = ConnectionConfiguration
                .to("myDB")
                .credentials("admin", "admin")
                .connect())
        {
            aConn.begin();
            ...
            ...
        }

I affirm that I am sure that my credential data and database name are correct.

That try, going straight finally, catch bypasses.

In addition I can say, I was leading me by the link below. I'm coding in Eclipse 4.5.2, and using Java 1.8.

What am I doing wrong?. Thank you.

cesAR
  • 606
  • 5
  • 16
  • Strangely the connection string that worked for me was: `connection = ConnectionConfiguration.from("snarl://localhost:5820/myDB").credentials("admin", "admin").connect();` Note that the name of the DB is integrated into the server address. The address of the server mentioned as an example, is the local address used by default. It may be useful for someone. – cesAR Jul 18 '16 at 15:52

1 Answers1

1

If the only jars you've included in the classpath are what's in stardog / server, then the likely cause is that you're missing some required dependencies.

Probably, either the contents of client/http and/or client/snarl.

But really, you shouldn't be managing that manually, use Gradle or Maven.

Michael
  • 4,858
  • 19
  • 32
  • I followed your instructions. I added completely client and server folders. Thus it worked perfectly. I'm working on Eclipse. It was not easy to make it work Maven, so I chose to add the libraries manually. Thanks for your help!. – cesAR Jul 18 '16 at 15:49