0
這是我的JDBC屬性(使用com.mchange.v2.c3p0.ComboPooledDataSource
):春天失敗的JDBC連接遠程MySQL,而本地主機是確定
jdbc.driver=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://myserveraddress:3306/mydatabasename?useUnicode=true&characterEncoding=utf8&autoReconnect=true&useSSL=false
jdbc.username=myusername
jdbc.password=mypassword
當myserveraddress
是localhost
或my local ip address
,一切都很好:)
然而,當myserveraddress
是my server ip address
(LAN外部),異常來:(
Caused by: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is java.sql.SQLException: An attempt by a client to checkout a Connection has timed out.
Caused by: java.sql.SQLException: An attempt by a client to checkout a Connection has timed out.
Caused by: com.mchange.v2.resourcepool.TimeoutException: A client timed out while waiting to acquire a resource from [email protected] -- timeout at awaitAvailable()
其實,我已經測試通過CMD服務器地址,HeidiSQL,IntelliJ IDEA的,並且一切正常......
cmd ping and cmd mysql connection is ok
HeidiSQL connection and IntelliJ IDEA mysql connection test is ok
迷惑,感激你的幫忙
謝謝您的回答,但我不認爲它是服務器端的問題,因爲我可以通過CMD連接到服務器數據庫(MySQL的-u -h -p),並且IDEA也成功測試了mysql連接。 –