Database connection problem encountered using d2rq

89 Views Asked by At

When I convert the data in MySQL into RDF, when using generate-mapping -u root -p 123456 -o kg_demo_movie_mapping.ttl "jdbc:mysql:///kg_demo_movie?useSSL=false&serverTimezone=UTC" I report an error.Loading class com.mysql.jdbc.Driver'. This is deprecated. The new driver class is com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary.Database exception (E0) . My MySQL version is 8.0.11. According to the Internet, I still report the same error when I put the jar package of 5.1.47 under d2rq / lib,I don't know what i can do now,thanks for you help.

1

There are 1 best solutions below

1
On

That message is a bit puzzling. Part of it is seems to be saying that the application that you are using is explicitly loading the JDBC driver ... which is deprecated1. But it is also saying that you (it) should be using MySQL Connector/J 8.x JDBC drivers rather than the 5.1.47 JAR in the d2rq library directory. (You can get MySQL Connector/J 8.x drivers from the download site.)

Basically, it looks like you are using out-of-date / abandoned software. The github site for dr2q shows no changes on the master branch since 2015. And the repo is now read-only.

If you had sufficient Java programming skill and were willing to put in the effort, you could:

  • Fork the repo
  • Investigate the real cause of the problem2
  • Update the codebase to fix the apparent Class::forName issue and/or upgrade the JDBC driver.

But if you don't have the skills, etcetera ... your best bet would be to look for another tool. (You may be able to find a hacky workaround for this problem on some other forum ... only to be stumped by the next one.)


1 - It should be using DriverManager ... which will discover the JDBC drivers automatically. Using Class::forName to load the driver has not been necessary since Java 5.0.
2 - Don't count on someone else doing that work for you, for free.