java - Can't connect to MySQL server at 127.0.0.1 using c3p0 -
trying connect mysql server using following code in java c3p0:
combopooleddatasource = new combopooleddatasource(); combopooleddatasource.setjdbcurl("jdbc:mysql://127.0.0.1:3306/" + dbname); combopooleddatasource.setuser(username); combopooleddatasource.setpassword(password); combopooleddatasource.setinitialpoolsize(15); combopooleddatasource.setmaxpoolsize(20); combopooleddatasource.setminpoolsize(10); connection = combopooleddatasource.getconnection();
although have checked db , running , can connect using python keeps throwing me following error:
info: initializing c3p0 pool...com.mchange.v2.c3p0.combopooleddatasource@b4c966a[ acquireincrement -> 3, acquireretryattempts -> 30, acquireretrydelay -> 1000, autocommitonclose -> false, automatictesttable -> null, breakafteracquirefailure -> false, checkouttimeout -> 0, connectiontesterclassname -> com.mchange.v2.c3p0.impl.defaultconnectiontester, description -> null, driverclass -> null, factoryclasslocation -> null, forceignoreunresolvedtransactions -> false, identitytoken -> b4c966a, idleconnectiontestperiod -> -1, initialpoolsize -> 30, jdbcurl -> jdbc:jtds:mysql://127.0.0.1:3306/sip_base, logintimeout -> 0, maxidletime -> 0, maxpoolsize -> 20, maxstatements -> 0, maxstatementsperconnection -> 0, minpoolsize -> 10, numhelperthreads -> 3, preferredtestquery -> null, properties -> {user=******, password=******}, propertycycle -> 300, testconnectiononcheckin -> false, testconnectiononcheckout -> false, usestraditionalreflectiveproxies -> false ] Μαϊ 12, 2015 10:41:12 ΠΜ com.mchange.v2.resourcepool.basicresourcepool$acquiretask run warning: com.mchange.v2.resourcepool.basicresourcepool$acquiretask@7e2889c7 -- acquisition attempt failed!!! clearing pending acquires. while trying acquire needed new resource, failed succeed more maximum number of allowed acquisition attempts (30). Μαϊ 12, 2015 10:41:12 ΠΜ com.mchange.v2.resourcepool.basicresourcepool$acquiretask run warning: com.mchange.v2.resourcepool.basicresourcepool$acquiretask@372567de -- acquisition attempt failed!!! clearing pending acquires. while trying acquire needed new resource, failed succeed more maximum number of allowed acquisition attempts (30). exception in thread "main" java.sql.sqlexception: connections not acquired underlying database! @ com.mchange.v2.sql.sqlutils.tosqlexception(sqlutils.java:104) @ com.mchange.v2.c3p0.impl.c3p0pooledconnectionpool.checkoutpooledconnection(c3p0pooledconnectionpool.java:264) @ com.mchange.v2.c3p0.poolbackeddatasource.getconnection(poolbackeddatasource.java:94) @ com.mchange.v2.c3p0.combopooleddatasource.getconnection(combopooleddatasource.java:521) @ gov.nist.sip.proxy.extended.dbserver.<init>(dbserver.java:52) @ gov.nist.sip.proxy.extended.dbserver.getinstance(dbserver.java:64) @ gov.nist.sip.proxy.extended.dbserver.main(dbserver.java:161) caused by: com.mchange.v2.resourcepool.cannotacquireresourceexception: resourcepool not acquire resource primary factory or source. @ com.mchange.v2.resourcepool.basicresourcepool.awaitacquire(basicresourcepool.java:972) @ com.mchange.v2.resourcepool.basicresourcepool.checkoutresource(basicresourcepool.java:208) @ com.mchange.v2.c3p0.impl.c3p0pooledconnectionpool.checkoutpooledconnection(c3p0pooledconnectionpool.java:260) ... 5 more
you seem trying set initial pool size more max pool size - unlikely work.
combopooleddatasource.setinitialpoolsize(30); // <<-- reduce combopooleddatasource.setmaxpoolsize(20); // <<-- less this.
Comments
Post a Comment