Hibernate ProXool关于hibernate.proxool.existing_pool设值问题
来源:互联网 发布:邮箱数据吧 编辑:程序博客网 时间:2024/06/05 20:20
今天在使用hibernate用proxool连接池的时候出了一些问题具体问题是当不通过web对数据库进行操作时,会提示 Unable to open JDBC connection for schema management target例如用junit或者main方法去执行数据库操作时,就会出现以下错误Exception in thread "main" org.hibernate.tool.schema.spi.SchemaManagementException: Unable to open JDBC connection for schema management targetat org.hibernate.tool.schema.internal.TargetDatabaseImpl.prepare(TargetDatabaseImpl.java:42)at org.hibernate.tool.schema.internal.SchemaMigratorImpl.doMigration(SchemaMigratorImpl.java:57)at org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:134)at org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:101)at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:472)at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:444)at org.hibernate.boot.internal.MetadataImpl.buildSessionFactory(MetadataImpl.java:170)at com.express.util.HibernateUtil.getSessionFactory(HibernateUtil.java:31)at com.express.util.HibernateUtil.openSession(HibernateUtil.java:47)at InsertOrder.main(InsertOrder.java:13)
Caused by: java.sql.SQLException: No suitable driver found for proxool.proxool
at java.sql.DriverManager.getConnection(DriverManager.java:689)
at java.sql.DriverManager.getConnection(DriverManager.java:270)
at org.hibernate.proxool.internal.ProxoolConnectionProvider.getConnection(ProxoolConnectionProvider.java:69)
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator$ConnectionProviderJdbcConnectionAccess.obtainConnection(JdbcEnvironmentInitiator.java:180)
at org.hibernate.tool.schema.internal.TargetDatabaseImpl.prepare(TargetDatabaseImpl.java:38)
… 9 more
经过多次修改和测试,最终发现原因是在设置
hibernate.proxool.existing_pool的值出了一些冲突,此值设为 false,当 hibernate 开始被调用时,就会初始化 proxool,进行数据库连接等操作
而设为true时则会使用已有的proxool。当使用junit或者main方法去执行数据库操作时,因为这些操作并没有经过ServletConfigurator的监听,所以并没有初始化proxool,导致没有数据库连接的操作,以致程序出错。
以上为个人理解,如有错误,可以评论交流
2016.10.15
今天将项目部署到linux上,发现数据库连接依旧出现这个错误,当我将hibernate.proxool.existing_pool设置为false时问题得到解决,具体原因还不了解,暂时先这样
ps:windos设置hibernate.proxool.existing_pool为true
linux设置hibernate.proxool.existing_pool为false
- Hibernate ProXool关于hibernate.proxool.existing_pool设值问题
- 关于hibernate.proxool.existing_pool
- Hibernate+proxool
- Hibernate+proxool
- hibernate+proxool
- Hibernate+Proxool配置
- Spring+Hibernate+Proxool配置
- hibernate proxool 连接池
- Hibernate + Proxool(连拉池)配置
- Hibernate + Proxool配置
- Hibernate配置proxool
- hibernate中配置proxool
- hibernate之整合proxool
- hibernate中配置proxool
- Hibernate+proxool 详解
- Proxool+Spring+Hibernate
- Hibernate & Proxool or C3p0
- Spring/Hibernate/Proxool集成
- 【PAT甲级】1013. Battle Over Cities (25)
- 面试题
- impala
- mongodb 分片集群thread_resource_error故障
- LightOJ1035 Intelligent Factorial Factorization(算数基本定理)
- Hibernate ProXool关于hibernate.proxool.existing_pool设值问题
- 20160929 - 再一次的考验
- HDU - 1005 Number Sequence 周期是48?不,是336!
- 找图、模拟鼠标&键盘整合库(VC++ WINAPI,源代码)
- Docker 基本操作命令
- nginx配置文件详解
- Selenium login 模拟登录
- Kafka 简介
- RPC 简介