hibernate链接Oracle11g报错问题

willing·Lin Java开发工程师  2015-11-02 01:41:08
新人学习hibernate链接oracle11g时出现的错误。网上有人说是驱动包的问题,我使用了ojdbc6.jar和ojdbc14.jar都不可以,求高手指教啊啊。。。然后我觉得可能是C3P0那里出错,贴身代码

<!-- 导入资源文件 -->
<context:property-placeholder location="classpath:db.properties" />

<!-- 配置C3P0数据源 -->

<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">

<property name="user" value="${jdbc.user}"></property>

<property name="password" value="${jdbc.password}"></property>

<property name="driverClass" value="${jdbc.driverClass}"></property>

<property name="jdbcUrl" value="${jdbc.jdbcUrl}"></property>


<property name="initialPoolSize" value="${jdbc.initialPoolSize}"></property>

<property name="maxPoolSize" value="${jdbc.maxPoolSize}"></property>

</bean>


<!-- 配置sessionFactory -->

<bean id="sessionFactory"

class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">

<property name="dataSource" ref="dataSource"></property>

<property name="configLocation" value="classpath:hibernate.cfg.xml"></property>

<property name="mappingLocations" value="classpath:com/atguigu/ssh/entities/*.hbm.xml"></property>

</bean>


【web.xml文件】这里用 * 号对吗,有两个配置文件
<context-param>

<param-name>contextConfigLocation</param-name>

<param-value>classpath:applicationContext*.xml</param-value>

</context-param>


【db.properties文件】
jdbc.user = scott
jdbc.password = 123456
jdbc.driverClass = oracle.jdbc.driver.OracleDriver
jdbc.jdbcUrl = jdbc:oracle:thin:@localhost:1521:LWL

jdbc.initialPoolSize = 5
jdbc.maxPoolSize = 10



警告: oracle.jdbc.driver.OracleConnection@7ed5a2 threw an Error when we tried to check its default holdability. This is probably due to a bug in your JDBC driver that c3p0 can harmlessly work around (reported for some DB2 drivers). Please verify that the error stack trace is consistentwith the getHoldability() method not being properly implemented, and is not due to some deeper problem. This message will not be repeated for Connections of type oracle.jdbc.driver.OracleConnection that provoke errors of type java.lang.AbstractMethodError when getHoldability() is called.
java.lang.AbstractMethodError: oracle.jdbc.driver.OracleConnection.getHoldability()I

at com.mchange.v2.c3p0.impl.NewPooledConnection.carefulCheckHoldability(NewPooledConnection.java:117)

at com.mchange.v2.c3p0.impl.NewPooledConnection.<init>(NewPooledConnection.java:109)

at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:198)

at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:171)

at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:137)

at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1014)

at com.mchange.v2.resourcepool.BasicResourcePool.access$800(BasicResourcePool.java:32)

at com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1810)

at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)
...全文
30 点赞 收藏 回复
写回复
回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
相关推荐
发帖
Web 开发
创建于2007-09-28

8.0w+

社区成员

Java Web 开发
申请成为版主
帖子事件
创建了帖子
2015-11-02 01:41
社区公告
暂无公告