简体   繁体   中英

Stardog DB connection with Java

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.

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM