Could not load driverClass jdbc:mysql://localhost:3306/spring

今天出现编码出现了No suitable driver found for jdbc,又是找遍了网上的资料,基本上都说是三个问题:
    一是:连接URL格式出现了问题(Connection conn=DriverManager.getConnection("jdbc:mysql://localhost:3306/XX","root","XXXX")
    二是:驱动字符串出错(com.mysql.jdbc.Driver)
    三是Classpath中没有加入合适的mysql_jdbc驱动
    经过我的仔细检查,这三种错误我都没有犯,为什么呢?
    尝试着将mysql-connector-java-3.1.14-bin.jar的jar包加入C:\Program Files\Java\jre1.6.0_02\lib\ext文件夹下,问题解决了!!
    原来是不仅仅要求将驱动加入classpath中,而且需要将该jar包加入到java运行环境的外部jar包中。

嗯  还有 一种可能性  就是配置写错了

像我犯得错误i就是属于比较奇葩的  属性名 和  值  写 反了

时间: 2024-08-09 22:01:33

Could not load driverClass jdbc:mysql://localhost:3306/spring的相关文章

SQLException: No suitable driver found for jdbc:mysql://localhost:3306/xxxx

刚刚学习jsp,对着视频敲代码,报这个错误. SQLException: No suitable driver found for jdbc:mysql://localhost:3306/shop SQLState: 08001 VendorError: 0 问题,因为没有引入Driver类. final String DBDRIVER = "org.gjt.mm.mysql.Driver"; String username = "root"; String pas

No suitable driver found for jdbc:mysql://localhost:3306/hibernate_basic

Struts Problem Report Struts has detected an unhandled exception: Messages: No suitable driver found for jdbc:mysql://localhost:3306/hibernate_basic Cannot open connection Could not open Hibernate Session for transaction; nested exception is org.hibe

No suitable driver found for jdbc:mysql://localhost:3306/****

今天在做SSH框架整合的时候,碰到了这样一个问题,在做service层测试的时候,hibernate是正常的,但是在用Struts的action层测试的时候出现了这个问题,说明这个问题是在网络连接数据库的时候出现的问题.解决方案如下: 修改hibernate.cfg.xml配置文件,在sessionFactory中添加数据库驱动,本文用的数据库是mysql,因此添加如下代码即可: <session-factory> <!-- 数据库驱动 --> <property name=

c3p0数据源配置抛出Could not load driverClass com.mysql.jdbc.Driver的解决方案

回答1: spring 加载数据库连接驱动的时候出现找不到驱动类解决办法. com.mchange.v2.c3p0.DriverManagerDataSourceensureDriverLoaded 1,  首先确定是否有相应的驱动包 2,  查看配置数据库连接文件每行的末尾是否有空格. 回答2: 1.0 配置c3p0数据源,一直提示 无法加载数据库驱动. 但是明明有驱动,非常疑惑..... com.mchange.v2.c3p0.DriverManagerDataSource ---- Cou

关于Could not load driverClass ${jdbc.driverClassName}问题解决方案

在spring与mybatis3整合时一直遇到Could not load driverClass ${jdbc.driverClassName}报错如果将 ${jdbc.driverClassName} 改成具体的值就不会报错! 解决方案一: 将 <property name="sqlSessionFactory" ref="sqlSessionFactory"/> 改成 <property name="sqlSessionFactor

Weka连接数据库出现No suitable driver found for jdbc:mysql://localhost/dbname

今天用weka连接数据库的时候,总是提示No suitable driver found for jdbc:mysql://localhost/dbname.同样改了weka.experiment.DatabaseUtils.props下的文件,之前安装都没有出现过这样的问题.重新安装,配置jdbc驱动路径.都还是报错.找了好久,终于找到了. 解决方法: 打开weka安装目录下的RunWeka.ini文件,最后一行 cp=%CLASSPATH%;C:/Program Files/Weka-3-6

【异常】java.sql.SQLException: No suitable driver found for jdbc://mysql://hadoop001:3306/xxx

IDEA程序代码中需要访问mysql,出现 java.sql.SQLException: No suitable driver found for jdbc://mysql://hadoop001:3306/ruoze_g6 有可能是驱动没加进来,有可能是连接地址url写错了. 需要在pom中加上mysql驱动: <dependency>      <groupId>mysql</groupId>      <artifactId>mysql-connect

搭建jfinal框架时报 Could not load driverClass com.mysql.jdbc.Driver

没有加载MySQL的驱动,你有没有把mysql的驱动包放到你项目的WEB-INF目录下的lib目录中,这是一个原因另外,在Tomcat服务器的根目录下也有一个lib目录,你也要把mysql的驱动包放进去连接池是应用服务器提供的,tomcat不是应用服务器,tomcat的连接池不能在mian方法中运行只能借助于web 容器运行,也就是必须是在tomcat中运行,jboss,weblogic是正真的应用服务器,它们可以在main方法中运行,但 也要设置它的运行环境才行!

create connection error, url: jdbc:mysql://**ip**:3306/*?errorCode 1045, state 28000

运行项目时,在登录页面输入账号密码后,控制台报数据库错误,排查了好久发现数据库的账号密码写错了,改正后就可以了. 之后又报数据库初始化错误: 1 init datasource error 2 The last packet sent successfully to the server was 0 milliseconds ago. 3 The driver has not received any packets from the server. 回来查资料,在项目的配置文件mysql.ur