Virtual import jdbc connection fails

Hi Stardog Team,

we had the following issue:

Try to load data from a jdbc postgres db remotly and pushing it remotely to a stardog instance, the message is:
Unable to load class: org.postgresql.Driver from ClassLoader:sun.misc.Launcher$AppClassLoader@1e80bfe8;ClassLoader:java.net.URLClassLoader@7c977e2a

The failing code snippet:
/opt/stardog/bin/stardog-admin --server http://172.27.0.2:5820 virtual import -p ********* -u ***** -g $CTGRAPH ctDB /data/stardog/psql.properties /data/mappings/mapping.ttl

the /data/stardog/psql.properties file looks like this:
jdbc.url=jdbc:postgresql://172.27.0.3:5432/aact?currentSchema=ctgov
jdbc.driver=org.postgresql.Driver
jdbc.username=********
jdbc.password=********

we copied the postgresql-42.2.5.jar driver to:
/opt/stardog/client/api
/opt/stardog/server/dbms

and modyfied the CLASSPATH pointing to these paths.

Need the odbc driver also be prepared on the stardog machine itself or is the virtual import job executes on the client container?

We used version 6.1.1 for client and server, the former 5.3.6 version ends just with with "connection refused"

greetings

Christian

Hi Christian,

"Unable to load class: org.postgresql.Driver" means that Stardog is unable to find the JDBC jar on its classpath.

Try setting an environment variable called $STARDOG_EXT to a directory somewhere, and put the jar in there. Then restart your server and hopefully it will pick that directory up.

I'd also suggest that you revert the changes that you made to the class path. What you did should have worked but it would have required you to restart the server. @Stephen 's suggestion would be the preferred way to do it.

If I understand correctly what you're asking, the jar needs to be installed on the server and not on any client machines. The database connection and mapping takes place on the server not the client.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.