Problem:
Connect database times wrong:
Log4j:warn No Appenders could is found for logger (com.mchange.v2.log.MLog).
Log4j:warn Initialize the log4j system properly.
Log4j:warn See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Java.lang.RuntimeException: Unable to get connection from data source
At com.eteda.DbConnectionPool.EtedaDbPool.getConnection (etedadbpool.java:106)
At Com.zdc.MyServer.ZhangWork.UserLogin (zhangwork.java:3567)
At com.zdc.MyServer.ZhangWork.process (zhangwork.java:96)
At com.lyw.MyServer.catalina.connector.http.HttpProcessor.process (httpprocessor.java:50)
At Com.lyw.MyServer.catalina.connector.http.Hander.run (hander.java:14)
At Java.util.concurrent.ThreadPoolExecutor.runWorker (threadpoolexecutor.java:1145)
At Java.util.concurrent.threadpoolexecutor$worker.run (threadpoolexecutor.java:615)
At Java.lang.Thread.run (thread.java:745)
caused by:java.sql.SQLException:Connections could not being acquired from the underlying database!
At com.mchange.v2.sql.SqlUtils.toSQLException (sqlutils.java:118)
At com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection (C3p0pooledconnectionpool.java : 692)
At com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.getConnection (Abstractpoolbackeddatasource.java : +)
At com.eteda.DbConnectionPool.EtedaDbPool.getConnection (etedadbpool.java:104)
... 7 More
caused By:com.mchange.v2.resourcepool.cannotacquireresourceexception:a Resourcepool could not acquire A resource From its primary factory or source.
At com.mchange.v2.resourcepool.BasicResourcePool.awaitAvailable (basicresourcepool.java:1469)
At Com.mchange.v2.resourcepool.BasicResourcePool.prelimCheckoutResource (basicresourcepool.java:644)
At Com.mchange.v2.resourcepool.BasicResourcePool.checkoutResource (basicresourcepool.java:554)
At Com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutAndMarkConnectionInUse ( c3p0pooledconnectionpool.java:758)
At com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection (C3p0pooledconnectionpool.java : 685)
... 9 More
Analysis:
The cause of the problem is in the configuration file or the problem of connecting to the database when creating JDBC:
先是执行这句:grant all on lx.* to "zhangdc"@‘%‘;
然后配置上面的文件,就可以了。
Here is a test program written by yourself, also can pass:
Summary: From the MySQL database, replaced by MARIADB, first the MySQL jar package into Mariadb-java-client-1.6.4.jar (the last problem solved, come back to test, and this does not matter). Then go to database execution:
grant all on lx.* to "zhangdc"@‘%‘;后,用zhangdc用户登陆,问题就解决了。
有用提示:
grant all on db_name.* to ‘vincent’@‘%‘;
OrGRANT ALL PRIVILEGES ON db_base.* TO db_user @‘%‘ IDENTIFIED BY ‘db_passwd‘;
Java Connection MARIADB Unable to get data source problems when deploying on Ubuntu (original)