Connect to mysql db in linux mint using vscode
by Thales90 from LinuxQuestions.org on (#6EZ06)
I am writing a java app using vscode on linux mint 21. Trying to connect to a local mysql database i get the error "java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/mydb".I installed the mysql-connector-j_8.1.0-1debian11_all.deb package i found at https://dev.mysql.com/downloads/connector/j/ (choosing debian linux as os) and than linked both
mysql-connector-j-8.1.0.jar
mysql-connector-java-8.1.0.jar
to the reference library of my project in vscode.
Also tried the "platform indipendent" jar.
The url should be correct, so is there anything else i should do?
Edit:
i used the command
export CLASSPATH=/usr/share/java/mysql-connector-j-8.1.0.jar:$CLASSPATH
but still get the error
Re-Edit:
it's fine if i include the -classpath command line.
At this point the question would be:
How do i avoid to manually add the -classpath command?
mysql-connector-j-8.1.0.jar
mysql-connector-java-8.1.0.jar
to the reference library of my project in vscode.
Also tried the "platform indipendent" jar.
The url should be correct, so is there anything else i should do?
Edit:
i used the command
export CLASSPATH=/usr/share/java/mysql-connector-j-8.1.0.jar:$CLASSPATH
but still get the error
Re-Edit:
it's fine if i include the -classpath command line.
At this point the question would be:
How do i avoid to manually add the -classpath command?