Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/315.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java c3p0连接池不支持20个用户_Java_Mysql_Tomcat_C3p0 - Fatal编程技术网

Java c3p0连接池不支持20个用户

Java c3p0连接池不支持20个用户,java,mysql,tomcat,c3p0,Java,Mysql,Tomcat,C3p0,我们在我们的web应用程序(基于QTI的在线考试系统)中使用c3p0连接池,问题是我们无法支持超过18个同时使用的用户,因为第19个用户服务器需要花费大量时间才能给出响应 我们已经尝试使用DBCP和TomcatJDBC池,但仍然得到了相同的结果 我们使用的是JDK 7、MYSQL v5.5.8和apache tomcat 7.0.42 我正在单例类中创建数据源 下面是代码片段 public class Helper { private static ComboPooledDataSource

我们在我们的web应用程序(基于QTI的在线考试系统)中使用c3p0连接池,问题是我们无法支持超过18个同时使用的用户,因为第19个用户服务器需要花费大量时间才能给出响应

我们已经尝试使用DBCP和TomcatJDBC池,但仍然得到了相同的结果

我们使用的是JDK 7、MYSQL v5.5.8和apache tomcat 7.0.42

我正在单例类中创建数据源

下面是代码片段

public class Helper {
  private static ComboPooledDataSource dataSource; 
  private static ResourceBundle bundle;

static { 
    try { 

        String bundleName2 = "Conf/db"; 
        bundle = ResourceBundle.getBundle(bundleName2);
        String db_name = bundle.getString("DB_NAME");
        String db_user = bundle.getString("DB_USER");
        String db_pass = bundle.getString("DB_PASS");     

        dataSource = new ComboPooledDataSource();            
        dataSource.setDriverClass( "com.mysql.jdbc.Driver" );
        dataSource.setJdbcUrl( "jdbc:mysql://localhost:3306/"+db_name );
        dataSource.setMaxPoolSize(150);
        dataSource.setInitialPoolSize(30);
        dataSource.setMinPoolSize(30);
        dataSource.setMaxStatements(180);
        dataSource.setUser(db_user);                    
        dataSource.setPassword(db_pass);
        System.out.println("-------------data scource created------------");


    } catch (PropertyVetoException ex) {
        Logger.getLogger(Helper.class.getName()).log(Level.SEVERE, null, ex);
    }
}
public static Connection getConnection() throws SQLException {
    System.out.println("=================================================");
    System.out.println("Num Connections"+dataSource.getNumConnections());
    System.out.println("Num Buzy Connections"+dataSource.getNumBusyConnections());
    System.out.println("max pool size"+dataSource.getMaxPoolSize());
    System.out.println("idle connection"+dataSource.getNumIdleConnections());
    System.out.println("================================================");

    return dataSource.getConnection();
}
我正在调用“Helper.getConnection();”方法来获取连接对象


有人能告诉我们原因吗。

试试BoneCP而不是c3po。据我所知,c3po已被弃用