mysqlexist-db

eXist-db installing MySQL connector


Does anyone know the steps to correctly install the MySQL JDBC driver into eXist-db for MacOS? I’m following http://www.exist-db.org/exist/apps/wiki/HowTo/SQLDatabases/QueryingSQLDatabases, but am stuck at 1.2. Everything I try results in the error

exerr:ERROR sql:get-connection() Cannot find database driver class: com.mysql.jdbc.Driver [at line 4, column 20]

I’ve installed mysql-connector-java-8.0.22.jar into

/Applications/eXist-db.app/Contents/Java/
/Applications/eXist-db.app/Contents/lib/user/
/Applications/eXist-db.app/Contents/Resources/lib/user/
/Applications/eXist-db.app/Contents/Resources/etc/webapp/WEB-INF/lib/

And none of these locations resolved the error. I must be missing a step.


Solution

  • Are you working with eXist-db 5?

    It is important to register the JDBC driver jar file in eXist-db. The jar file is placed in the $EXIST_HOME$/lib directory and the dependency on the jar file must be registered in eXist-db by adding an entry similar to the following in etc/startup.xml where the relativePath is the relative path to the jar file from the lib directory.

    <dependency>
      <groupId>mysql</groupId>
      <artifactId>mysql-connector-java</artifactId>
      <version>8.0.18</version>
      <relativePath>jdbc/mysql-connector-java-8.0.18.jar</relativePath>
    </dependency>