连接MySQL提示异常:Cannot open connection .sql.SQLException: No
点击右边红色标题查看本文完整版:连接MySQL提示异常:Cannot open connection .sql.SQLException: No suitable driver
我在Weblogic配了Mysql的连接池,用的驱动包mysql-connector-java-3.0.15-ga-bin,下面是
hibernate.cfg.xml的配置
com.mysql.jdbc.Driver
jdbc:mysql://liusp:3306;DatabaseName=test
root
xxx
1
true
net.sf.hibernate.dialect.MySQLDialect
但运行提示我No suitable driver,请问是什么原因,我的驱动有问题,可在weblogci配置是成功的啊
把com.mysql.jdbc.Driver改成
org.gjt.mm.mysql.Driver也不行
4:23,257 WARN JDBCExceptionReporter:38 - SQL Error: 0, SQLState: 08001
4:23,257 ERROR JDBCExceptionReporter:46 - No suitable driver
4:23,257 ERROR JDBCExceptionReporter:38 - Cannot open connection
.sql.SQLException: No suitable driver
at java.sql.DriverManager.getConnection(DriverManager.java:532)
at java.sql.DriverManager.getConnection(DriverManager.java:140)
at net.sf.hibernate.connection.DriverManagerConnectionProvider.getConnec
(DriverManagerConnectionProvider.java:95)
at net.sf.hibernate.impl.BatcherImpl.openConnection(BatcherImpl.java:278
at net.sf.hibernate.impl.SessionImpl.connect(SessionImpl.java:3264)
at net.sf.hibernate.impl.SessionImpl.connection(SessionImpl.java:3244)
at net.sf.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.ja
0)
at net.sf.hibernate.transaction.JDBCTransactionFactory.beginTransaction(
TransactionFactory.java:19)
at net.sf.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:2
at com.stone.it.delphi.Facade.getCat(Facade.java:84)
at jsp_servlet.__control._jspService(__control.java:143)
at weblogic.servlet.jsp.JspBase.service(JspBase.java:33)
at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run