com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientC

2020-03-12 11:38发布

Hi I have created jdbc program and database is MySQL 5.1 Also all my friends using same database for connection. Total number of connection became 150 from all of us. So when i want to connect more then i got the following error

com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 3 times. Giving up.

How to resolve this error.

Thanks Sunil Kumar Sahoo

标签: mysql jdbc
4条回答
仙女界的扛把子
2楼-- · 2020-03-12 12:01

I solved the problem by increasing number of connection

set @@global.max_connections = 1250;

Have a look on the below link http://www.netadmintools.com/art573.html

查看更多
Luminary・发光体
3楼-- · 2020-03-12 12:02

One possibility is that you've forgot to setup the environment variable for MySQL in your OS.

查看更多
Deceive 欺骗
4楼-- · 2020-03-12 12:08

Maybe you haven't create the databases or tables in the databases. Please check the reason behind "Could not create connection to database server."

I have met this error, because I didn't create the database.

查看更多
贪生不怕死
5楼-- · 2020-03-12 12:23

when you make a connection from higher versions of android version 9 to a mysql server you must always allow connections through:

if (Constants.VERSION_SDK > 9) {
      StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
      StrictMode.setThreadPolicy(policy);
}
查看更多
登录 后发表回答