关于C3p0Plugin连接SQL2000

南客 发布于 2013/12/17 08:17
阅读 1K+
收藏 0

@JFinal 你好,想跟你请教个问题:波哥,我用原生态连接SQL2000数据正常的,为啥用C3p0Plugin插件出现一下错误的!

Starting JFinal 1.5
Starting scanner at interval of 5 seconds.
Starting web server on port: 88
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/G:/测试项目/JFinal/jfinal_demo/WebRoot/WEB-INF/lib/slf4j-log4j12-1.6.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/G:/%e6%b5%8b%e8%af%95%e9%a1%b9%e7%9b%ae/JFinal/jfinal_demo/WebRoot/WEB-INF/lib/slf4j-log4j12-1.6.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.

2013-12-17 08:15:51
[WARN]-[Thread: com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#2]-[com.mchange.v2.c3p0.impl.NewPooledConnection.carefulCheckHoldability()]: com.microsoft.jdbc.sqlserver.SQLServerConnection@7be8c2 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 com.microsoft.jdbc.sqlserver.SQLServerConnection that provoke errors of type java.lang.AbstractMethodError when getHoldability() is called.
java.lang.AbstractMethodError: com.microsoft.jdbc.sqlserver.SQLServerConnection.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)
Starting Complete. Welcome To The JFinal World :)

 

 

加载中
0
南客
南客

测试成功的

String DriverName="com.microsoft.jdbc.sqlserver.SQLServerDriver";
  String DbURL="jdbc:microsoft:sqlserver://10.0.16.254:1433;DatabaseName=1";
  String UserName="sa";
  String UserPwd="123456";
  java.sql.Connection DbConn;
  try{
   Class.forName(DriverName);
   DbConn= DriverManager.getConnection(DbURL, UserName, UserPwd);
   System.out.println("connection link successful!");
   DbConn.close();
   System.out.println(DbConn.isClosed());
  }
  catch(Exception e)
  {
   e.printStackTrace();

  }

0
南客
南客
String driver="com.microsoft.jdbc.sqlserver.SQLServerDriver";
  String jdbcUrl="jdbc:microsoft:sqlserver://10.0.16.254:1433;DatabaseName=1";
  String user="sa";
  String password="123456";
  //C3p0Plugin c3p0Plugin = new C3p0Plugin(getProperty("jdbcUrl"), getProperty("user"), getProperty("password").trim(),getProperty("driver").trim());   
  C3p0Plugin c3p0Plugin = new C3p0Plugin(jdbcUrl,user,password,driver);
  me.add(c3p0Plugin);
  
  
  // 配置ActiveRecord插件
  ActiveRecordPlugin arp = new ActiveRecordPlugin(c3p0Plugin);
  //arp.setDialect(new AnsiSqlDialect());
  me.add(arp);
  //arp.addMapping("City", Blog.class); // 映射blog 表到 Blog模型 
0
JFinal
JFinal
根据错误提示看是 c3p0 知道此版本的 jdbc驱动有bug,换个驱动试试
返回顶部
顶部