You are not logged in.

#1 2022-04-26 23:51:35

Hina
Member
Registered: 2021-12-28
Posts: 8

JDBC and MySQL, linking files does not work

Hello.

I tried to follow this wiki article https://wiki.archlinux.org/title/JDBC_and_MySQL

and linking the mariadb like this does not work:

ln -s /usr/share/java/mariadb-jdbc/mariadb-java-client.jar /usr/lib/jvm/default-runtime/jre/lib/ext

The directory didn't exist so I created it with mkdir.

I also linked the jar file to /usr/lib/jvm/default-runtime/lib/ext

The program fails with java.lang.ClassNotFoundException: org.mariadb.jdbc.Driver

Does anyone know where is the correct place to link it? I understand the best practice is to add it as dependency as described here but I'd like to find out how this way is supposed to work.



To make the DBDemo program work I also needed to do couple things.

add mariadb connector to classpath when running like this

java -classpath ".:/usr/share/java/mariadb-jdbc/mariadb-java-client.jar" DBDemo

In the file DBDemo.java change jdbc:mysql to jdbc:mariadb

and change the database I was trying to open to a database that was not empty.

Last edited by Hina (2022-04-26 23:53:38)

Offline

Board footer

Powered by FluxBB