spring2.5 + hibernate 3 框架中用c3p0連線sql 2000出現問題。

duanchengzhang發表於2010-07-03
高手們好,我現在要做個系統,搭建個框架出現了點問題,停止不前中,請指點。

問題是這樣的:

我用spring和hibernate做整合,其中hibernate.cfg.xml檔案是檔案是這樣的,主要請看c3p0連線池配置這塊:

//--------------------------------------------------------HIBERNATE配置檔案開始

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-configuration
PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<hibernate-configuration>

<session-factory>
<property name="hibernate.connection.driver_class">com.microsoft.jdbc.sqlserver.SQLServerDriver</property>
<property name="hibernate.connection.url">jdbc:microsoft:sqlserver://127.0.0.1:1433;DatabaseName=pscms_db</property>
<property name="hibernate.connection.username">root</property>
<property name="hibernate.connection.password">123456</property>
<property name="connection.useUnicode">true</property>
<property name="connection.characterEncoding">UTF-8</property>
<property name="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</property>

<!-- C3P0連線池設定 -->
<property name="hibernate.connection.provider_class">org.hibernate.connection.C3P0ConnectionProvider</property>
<property name="hibernate.c3p0.max_size">20</property>
<property name="hibernate.c3p0.min_size">10</property>
<property name="hibernate.c3p0.timeout">120</property>
<property name="hibernate.c3p0.idle_test_period">1800</property>

<property name="hibernate.c3p0.acquireRetryAttempts">30</property>
<property name="hibernate.c3p0.idleConnectionTestPeriod">300</property>

其他配置略。。。。。。。。。。。。



</session-factory>

</hibernate-configuration>



//--------------------------------------------------------HIBERNATE配置檔案結束

我使用的sql 2000資料庫,並且連線資料庫的3個驅動jar包,我都放入lib資料夾中了。

sql 2000的sp4補丁也打上了。 現在啟動一直總是報錯誤如下:一直迴圈報root使用者登入失敗,

我在sql 2000的查詢分析起中輸入使用者名稱:sa 密碼:123456 登入也沒有問題!請高手幫忙。。。。。。。。。????

Managed Threads: 3
Active Threads: 3
Active Tasks:
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@9ff77 (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0)
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@62fc6c (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#2)
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@aa3152 (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#1)
Pending Tasks:
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@18c26d7
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@49f120
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@756d0c
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@14a51f0
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@49a1c5
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@1bcd49
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@1427def
Pool thread stack traces:
Thread[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0,5,main]
java.lang.Thread.sleep(Native Method)
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1805)
com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)
Thread[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#2,5,main]
java.lang.Thread.sleep(Native Method)
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1805)
com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)
Thread[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#1,5,main]
java.lang.Thread.sleep(Native Method)
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1805)
com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)


2010-07-03 21:12:00 WARN com.mchange.v2.resourcepool.BasicResourcePool | com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@9ff77 -- Acquisition Attempt Failed!!! Clearing pending acquires. While trying to acquire a needed new resource, we failed to succeed more than the maximum number of allowed acquisition attempts (30). Last acquisition attempt exception:
java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]使用者 'root' 登入失敗。
at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source)
at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processErrorToken(Unknown Source)
at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processReplyToken(Unknown Source)
at com.microsoft.jdbc.sqlserver.tds.TDSLoginRequest.processReplyToken(Unknown Source)
at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processReply(Unknown Source)
at com.microsoft.jdbc.sqlserver.SQLServerImplConnection.open(Unknown Source)
at com.microsoft.jdbc.base.BaseConnection.getNewImplConnection(Unknown Source)
at com.microsoft.jdbc.base.BaseConnection.open(Unknown Source)
at com.microsoft.jdbc.base.BaseDriver.connect(Unknown Source)
at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:134)
at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:182)
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)
2010-07-03 21:12:00 WARN com.mchange.v2.resourcepool.BasicResourcePool | com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@aa3152 -- Acquisition Attempt Failed!!! Clearing pending acquires. While trying to acquire a needed new resource, we failed to succeed more than the maximum number of allowed acquisition attempts (30). Last acquisition attempt exception:
java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]使用者 'root' 登入失敗。

相關文章