When DBCP connects to the MySQL IP address 127.0.0.1, the connection can be changed to a local real IP address.
Org. Apache. tomcat. DBCP. DBCP. sqlnestedexception: cannot create poolableconnectionfactory
It is said that the connection may be closed and you need to reconnect.
ADD? Autoreconnect = true
Incorrect result
Nested exception is org. Apache. commons. DBCP. sqlnestedexception: cannot
Create poolableconnectionfactory (cocould not create connection to database server. Attempted reconnect 3 times. Giving up .)
Still unable to connect
Depressed
Then the mysql-uroot-p-h real IP address is used to connect to MySQL and an error is reported.
MySQL error number 2003
Can't connect to MySQL Server XXX. XXX (10061)
Oh, I finally got it. The remote port MySQL does not recognize it. It's really TMD.
Originally in Ubuntu
MySQL is installed by default in 9.04, which can only be accessed locally by default.
Solution:
Authorize remote machines to access specified users
Grant
All privileges on *. * to root @ identified by "root ";
Restart MySQL
/Etc/init. d/MySQL
Restart
Log on again
MySQL
-Uroot-p-h IP Address
Still not good
Modify the MySQL configuration file
VI/etc/MySQL/My. CNF
Bind-address = 127.0.0.1 comment out
Restart MySQL
Successful