简体   繁体   中英

MySql - No suitable driver found

I am trying to make a database connection but when i try to get the connection from my database it gives me the error:

java.sql.SQLException: No suitable driver found for jdbc:mysql://play.zsinfo.nl:3306/daansander
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at me.daansander.login.database.MySql.getConnection(MySql.java:28)
at me.daansander.login.database.Sql.connect(Sql.java:13)
at me.daansander.login.Login.main(Login.java:11)

i looked into the code and i found the line where the problem is:

connection = DriverManager.getConnection("jdbc:mysql://" + host + ":" + port + "/" + db, user, pass);

but i could not find the problem i tried this on other plugins and it works just fine

It clearly says that your class can not find the correct mysql connector library file. you can make sure it by writing a simple JDBC client class and run it on command line by specifying the path to your library.

you can find more from this POST and it will show you how to check the configuration properly. hope it will guide you!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM