java.sql.SQLException: No suitable driver【问题解决】

项目报错:

java.sql.SQLException: No suitable driver
	at java.sql.DriverManager.getDriver(Unknown Source)
	at com.mchange.v2.c3p0.DriverManagerDataSource.driver(DriverManagerDataSource.java:285)
	at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:161)
	at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:161)
	at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:147)
	at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:202)
	at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1138)
	at com.mchange.v2.resourcepool.BasicResourcePool.doAcquireAndDecrementPendingAcquiresWithinLockOnSuccess(BasicResourcePool.java:1125)
	at com.mchange.v2.resourcepool.BasicResourcePool.access$700(BasicResourcePool.java:44)
	at com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask.run(BasicResourcePool.java:1870)
	at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:696)

解决:

回头看项目目录时,发现c3p0-config.xml文件报错,可是找了半天没发现哪里写的不对。一番探究后原来是这句配置出问题了:

<property name="jdbcUrl">jdbc:mysql://localhost:3306/english?useSSL=false&serverTimezone=Asia/Shanghaiproperty>

XML文件里&表示url中的"&"

改正:

<property name="jdbcUrl">jdbc:mysql://localhost:3306/english?useSSL=false&serverTimezone=Asia/Shanghaiproperty>

问题解决!

你可能感兴趣的:(java,web)