简体   繁体   English

MySql-找不到合适的驱动程序

[英]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. 它清楚地表明您的类找不到正确的mysql连接器库文件。 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. 您可以通过编写一个简单的JDBC客户端类来确保它,并通过指定库的路径在命令行上运行它。

you can find more from this POST and it will show you how to check the configuration properly. 您可以从该POST中找到更多信息,它将向您展示如何正确检查配置。 hope it will guide you! 希望它能指导您!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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