简体   繁体   English

SQLException:找不到适用于jdbc:mysql:// localhost:3306 / dbname的驱动程序

[英]SQLException: No suitable driver found for jdbc:mysql://localhost:3306/dbname

I've inherited a project (and I have absolutly no experience of Java) and I'm rather stuck. 我继承了一个项目(而且我绝对没有Java的经验),但我很困惑。

We have a server running redhat, which I needed to update one of the jar files. 我们有一台运行redhat的服务器,我需要更新其中的jar文件。 So I simply copied up the updated file and restarted the service for that file. 因此,我只是复制了更新的文件并重新启动了该文件的服务。 However this process has worked on our other server I did that too but on this one it comes up with the below in the log file. 但是,此过程在我们的另一台服务器上也起作用,但我也这样做了,但在此服务器上,它在日志文件中包含以下内容。

Exception: com.mysql.jdbc.Driver
SQLException: No suitable driver found for jdbc:mysql://localhost:3306/dbanme

The jar files are uploaded to a folder in the root of the website and within that jar folder is a lib folder where mysql-connector-java-5.1.6-bin.jar is located. jar文件被上载到网站根目录中的一个文件夹中,并且该jar文件夹中有一个lib文件夹,该文件夹位于mysql-connector-java-5.1.6-bin.jar。

Does anyone know what I could be missing as I'm a newbie to linux aswell. 有谁知道我可能是Linux新手,所以我可能会错过什么。

Thanks in advance 提前致谢

java.sql.SQLException: No suitable driver found java.sql.SQLException:找不到合适的驱动程序

This exception can have 2 causes: 此异常可能有2个原因:

  1. The JDBC driver is not loaded at all. 完全不加载JDBC驱动程序。
  2. URL does not match any of the loaded JDBC drivers. URL与任何已加载的JDBC驱动程序都不匹配。

Since the driver seems to be loaded , it look like that the URL is not valid on that machine: 由于驱动程序似乎已加载,因此该URL在该计算机上无效:

jdbc:mysql://localhost:3306/dbname JDBC:MySQL的://本地主机:3306 / DBNAME

Do you have mysql running and listening on port 3306 on that machine. 您是否在该计算机上的端口3306上运行并监听mysql。 Also make sure you hte schema dbname there. 还要确保在那里有模式dbname。

You need only set that: 您只需要设置:

[jdbc:mysql://localhost/dbanme] 

instead of 代替

[jdbc:mysql://localhost:3306/dbanme]

Because java compiler default understand a port 3306, so no need to fill "3306" after "localhost:" 由于Java编译器默认了解端口3306,因此无需在“ localhost:”后填写“ 3306”

暂无
暂无

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

相关问题 java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/mydatabase Android Studio Java MySQL - java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/mydatabase Android Studio Java MySQL java.sql.SQLException: 找不到适合 jdbc:mysql://localhost:3306/sushi 的驱动程序 - java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/sushi java.sql.SQLException:找不到适用于jdbc:mysql:// localhost:3306 / tun_recrut的驱动程序 - java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/tun_recrut 连接错误:java.sql.SQLException:没有找到适用于 jdbc:Z81C3B080DAD534BF52EZE://030364BF52E10的驱动程序 - Error de conexion: java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306 JAVA 10-java.sql.SQLException:找不到适用于jdbc:mysql:// localhost:3306 /错误的驱动程序 - JAVA 10 - java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/ error 引起:java.sql.SQLException:没有为jdbc找到合适的驱动程序:mysql:// localhost:3306 / domain - Caused by: java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/domain 数据库连接上的 SQLException:找不到适合 jdbc:mysql://localhost:3306/smtbiz 的驱动程序 - SQLException on database connection: No suitable driver found for jdbc:mysql://localhost:3306/smtbiz java.sql.SQLException:找不到适用于jdbc:mysql:// localhost:3306的驱动程序 - java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306 java.sql.SQLException: 找不到适合 jdbc:mysql://localhost:3306/database 的驱动程序 - java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/database 当运行可执行 jar 文件时,我有和 SQLException:没有找到适合 jdbc:mysql://localhost:3306/DENTAL 的驱动程序 - When run executable jar file i have and SQLException: No suitable driver found for jdbc:mysql://localhost:3306/DENTAL
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM