0

当我尝试为 Mysql 运行 ConnectionPOOL.java 代码时,出现此错误

java com.mchange.v2.c3p0.codegen.BeangenDataSourceGenerator "infile.xml OutputFile.java"

公共类 MysqlPool {

私有 ComboPooledDataSource cpds;

私有静态易失 MysqlPool 实例;

私人 MysqlPool(){

cpds = new ComboPooledDataSource();

尝试 {

cpds.setDriverClass(MysqlConnect.DRIVER); //加载jdbc驱动

cpds.setJdbcUrl(MysqlConnect.URL + MysqlConnect.DB_NAME);

cpds.setUser(MysqlConnect.USER_NAME);

cpds.setPassword(MysqlConnect.PASSWORD);

cpds.setMinPoolSize(5);

cpds.setAcquireIncrement(5);

cpds.setMaxPoolSize(20);

        } 

捕捉(PropertyVetoException e){

e.printStackTrace();

} }

公共静态 MysqlConnect getConnection() 抛出 SQLException {

MysqlPool localInstance = instance;

if (localInstance == null) {

synchronized (MysqlPool.class) {

localInstance = instance;


 if (localInstance == null) {

  instance = localInstance = new MysqlPool();

                }
            }
        }
 return new MysqlConnect(localInstance.cpds.getConnection());
    }


}
4

0 回答 0