Hi, This is a classpath issue : Example with a small java file : import java.sql.Connection; import java.sql.DriverManager; public class Test { public static void main(String[] args) { System.out.println("init"); try { try (Connection con = DriverManager.getConnection("jdbc:mariadb://localhost:3306/testj?user=diego2&password=diego")){ System.out.println("connected"); } } catch (Exception e){ e.printStackTrace(); } } } On windows ( on unix just replace the ";" with ":" on classpath) c:\temp>"C:\Program Files\Java\jdk1.8.0_60\bin\java.exe" -cp "." Test init java.sql.SQLException: No suitable driver found for jdbc:mariadb://localhost:3306/testj?user=diego2&password=diego at java.sql.DriverManager.getConnection(DriverManager.java:689) at java.sql.DriverManager.getConnection(DriverManager.java:270) at Test.main(Test.java:8) c:\temp>"C:\Program Files\Java\jdk1.8.0_60\bin\java.exe" -cp "./mariadb-java-client-1.4.4.jar;." Test init connected On Mon, May 2, 2016 at 2:55 PM, AskMonty KB <noreply@askmonty.org> wrote:
Hello,
A new question has been asked in "MariaDB Community" by Intrinsic. Please answer it at http://mariadb.com/kb/en/jdbc-driver-configuration-error/ as the person asking the question may not be subscribed to the mailing list.
-------------------------------- I am attempting to connect to MariaDB from a command line Java program. I am getting the "no suitable driver found" error. I am using the mariaDB Type 4 JDBC driver, the JDK 1.8, Windows 10. I have added the maria driver to the lib directory of the JRE, and added this directory to the PATH and CLASSPATH environment variables.
I can connect to the mariaDB database using DBVisualizer, when I manually point the configuration of DBVisualizer to the maria driver, so I know that the driver works fine.
Here is the Java code:
Connection con = DriverManager.getConnection("jdbc:mariadb://localhost:3306/DB?user=root&password=myPassword");
and the error
C:\Users\Documents\VTK\Dev>java -cp . VTK3 java.sql.SQLException: No suitable driver found for jdbc:mariadb://localhost:3306/DB?user=root&password=myPassword at java.sql.DriverManager.getConnection(Unknown Source) at java.sql.DriverManager.getConnection(Unknown Source) at VTK3.main(VTK3.java:38)
Thanks --------------------------------
To view or answer this question please visit: http://mariadb.com/kb/en/jdbc-driver-configuration-error/
_______________________________________________ Mailing list: https://launchpad.net/~maria-discuss Post to : maria-discuss@lists.launchpad.net Unsubscribe : https://launchpad.net/~maria-discuss More help : https://help.launchpad.net/ListHelp