java.sql.SQLException: No suitable driver

时间:2022-03-31 16:01:21
java.sql.SQLException: No suitable driver
at java.sql.DriverManager.getDriver(Unknown Source)
at com.mchange.v2.c3p0.DriverManagerDataSource.driver(DriverManagerDataSource.java:144)
at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:68)
at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:87)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1.acquireResource(C3P0PooledConnectionPool.java:83)
at com.mchange.v2.resourcepool.BasicResourcePool.assimilateResource(BasicResourcePool.java:884)
at com.mchange.v2.resourcepool.BasicResourcePool.acquireUntil(BasicResourcePool.java:601)
at com.mchange.v2.resourcepool.BasicResourcePool.access$400(BasicResourcePool.java:31)
at com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1079)
at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:354)

报错这个错,找了半天不知所云,总以为是驱动有问题,后来看到说jdbcUrl格式可能有问题,我的下发如下:
<property name="jdbcUrl">
   <value>
   jdbc:mysql://127.0.0.1:3306/NetCourse
   </value>
</property>
改成:
<property name="jdbcUrl">
   <value>jdbc:mysql://127.0.0.1:3306/NetCourse</value>
</property>
然后就不报这个错误了,这也算问题,我靠。

另附Oracle12c在Hibernate底下的配置:

#application configs
#jdbc c3p0 config
jdbc.driver=oracle.jdbc.driver.OracleDriver
jdbc.url = jdbc:oracle:thin:@//10.8.8.70:1521/shdb
jdbc.username = ecrm
jdbc.password = ecrm #hibernate config
hibernate.dialect = org.hibernate.dialect.OracleDialect
#hibernate.dialect=org.hibernate.dialect.Oracle9Dialect
hibernate.show_sql = true
hibernate.format_sql = false
hibernate.hbm2ddl.auto = update
hibernate.cache.use_second_level_cache = true
hibernate.cache.use_query_cache = true
hibernate.cache.region.factory_class = org.hibernate.cache.ehcache.EhCacheRegionFactory
hibernate.cache.provider_configuration_file_resource_path = ehcache.xml