yuezhiyin2000
月夜之影
采纳率0%
2012-04-01 11:26 阅读 233
已采纳

spring2.5,c3p0,hibernate3.2环境下 更新驱动后数据库连接报错

环境运行一直没有问题,不过以前用的驱动不支持JDK1.6所以 下载了最新的驱动程序sqljdbc_4.0 用了其中的 sqljdbc4.jar

因为数据库是windows验证所以WEB-INF\lib  下面也放了sqljdbc_auth.dll  文件

 

applicationContext.mxl配置文件如下

   <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
        <property name="driverClass" value="com.microsoft.sqlserver.jdbc.SQLServerDriver"></property>
        <property name="jdbcUrl" value="jdbc:sqlserver://192.168.100.56:1433;DatabaseName=RESEARCH;integratedSecurity=true;"></property>
        <property name="user" value=""></property>
        <property name="password" value=""></property>

        <property name="acquireRetryAttempts" value="1"></property> 
        <property name="idleConnectionTestPeriod" value="100"></property> <!-- seconds --> 
        <property name="maxPoolSize" value="15"></property> 
        <property name="minPoolSize" value="5"></property> 
        <!--JDBC的标准参数,用以控制数据源内加载的PreparedStatements数量。但由于预缓存的statements 
属于单个connection而不是整个连接池。所以设置这个参数需要考虑到多方面的因素。 
如果maxStatements与maxStatementsPerConnection均为0,则缓存被关闭。Default: 0--> 
        <property name="maxStatements" value="5"></property>
        <!--maxStatementsPerConnection定义了连接池内单个连接所拥有的最大缓存statements数。Default: 0> 
        <property name="maxStatementsPerConnection"></property--> 

    
    </bean>

 启动tomcat时候报如下错误信息

 

信息: Initializing Spring root WebApplicationContext
Exception in thread "com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#1" java.lang.UnsatisfiedLinkError: com.microsoft.sqlserver.jdbc.AuthenticationJNI.SNISecGenClientContext([B[I[BI[B[I[ZLjava/lang/String;ILjava/lang/String;Ljava/lang/String;Ljava/util/logging/Logger;)I
    at com.microsoft.sqlserver.jdbc.AuthenticationJNI.SNISecGenClientContext(Native Method)
    at com.microsoft.sqlserver.jdbc.AuthenticationJNI.GenerateClientContext(AuthenticationJNI.java:80)
    at com.microsoft.sqlserver.jdbc.SQLServerConnection.sendLogon(SQLServerConnection.java:2691)
    at com.microsoft.sqlserver.jdbc.SQLServerConnection.logon(SQLServerConnection.java:2234)
    at com.microsoft.sqlserver.jdbc.SQLServerConnection.access$000(SQLServerConnection.java:41)
    at com.microsoft.sqlserver.jdbc.SQLServerConnection$LogonCommand.doExecute(SQLServerConnection.java:2220)
    at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:5696)
    at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:1715)
    at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:1326)
    at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:991)
    at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:827)
    at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:1012)
    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)

实在从日志中看不到什么有价值信息,所以还劳烦各位帮忙看看。

 

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

1条回答 默认 最新

相关推荐