Driver.class in MarkLogic driver is only recognised by legacy connector

Hi Knimers,

I’m using Knime 4.1.4 and I’m trying to set up a connection with a MarkLogic server. On the MarkLogic github I found their Latest driver (mljdbc-42.1.4.jar).

I can add this driver in the “Preferences > Knime > Databases (legacy)” and use it in a Database Connector (Legacy) node with a database URL like

jdbc:marklogic//myserver:myport/

When I try to add the same driver to “Preferences > Knime > Databases” the only Driver class found is org.postgresql.Driver.
This means I cannot use the above database URL, but instead I have to use in a DB Connector node the following

jdbc:postgresql//myserver:myport/

Why is this other Driver class (com.marklogic) only recognised by the legacy nodes? Is this something in Knime or something in this driver?

Hi,
KNIME uses the Java service lookup to find all drivers. So it looks into the services file of the jar where only the postgres driver is listed: https://github.com/marklogic-community/ml-jdbc-driver/blob/master/src/main/resources/META-INF/services/java.sql.Driver
What you can do is unzip the jar file and add the following entry to the METAINF/services/java.sql.Driver file:
com.marklogic.Driver and the zip all files again with .jar as file extension.
Bye
Tobias

5 Likes

Thanks @tobias.koetter. That was the trick it needed!

1 Like

No problem, you are welcome.