C3P0运行几天后报错,并挂掉 请高手指点指点

prince_lsx 2008-11-21 05:24:12
C3P0运行几天后报错,并挂掉
报了这样的错误:

WARN [com.mchange.v2.resourcepool.BasicResourcePool] - <com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@e8f8c5 -- 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: Io 异常: Connection reset

请问这是什么原因呢?
...全文
125 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
hwh315818 2008-12-02
  • 打赏
  • 举报
回复
顶,写一个测试类调通后然后再使用,这样方便一点建议用main方法
terryzhou2k 2008-12-02
  • 打赏
  • 举报
回复
换dbcp或proxool试试...
East271536394 2008-11-30
  • 打赏
  • 举报
回复
import java.sql.Connection;

import com.mchange.v2.c3p0.ComboPooledDataSource;

public class C3p0Util {
static String driver_2005="com.microsoft.sqlserver.jdbc.SQLServerDriver";
static String url_2005="jdbc:sqlserver://localhost:1433;databasename=pubs";

static String driver = "com.microsoft.jdbc.sqlserver.SQLServerDriver";
static String url = "jdbc:microsoft:sqlserver://localhost:1433;databasename=pubs";
static String user = "sa";
static String password = null;

static ComboPooledDataSource cpds = null;

static {
try {
cpds = new ComboPooledDataSource();
//driver 2000
//cpds.setDriverClass(driver);
//cpds.setJdbcUrl(url);
//driver2005
cpds.setDriverClass(driver_2005);
cpds.setJdbcUrl(url_2005);
cpds.setUser(user);
cpds.setPassword(password);
} catch (Exception e) {
e.printStackTrace();
}
}

//获取连接
public static Connection getConnection() {
Connection conn = null;
try {
conn = cpds.getConnection();
} catch (Exception e) {
e.printStackTrace();
}
return conn;
}

public static void main(String[] args) {
Connection conn = C3p0Util.getConnection();
System.out.println(conn);
}
}


c3p0.jar要
prince_lsx 2008-11-22
  • 打赏
  • 举报
回复
帮帮忙撒
android2008 2008-11-21
  • 打赏
  • 举报
回复
ding

67,537

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧