大家好,
目前我想要連線至SSH然後再連到Mysql得到database資料,
可是到
conn = DriverManager.getConnection (url, dbuserName, dbpassword);
這行就會發生exception
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException:
Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago.
The driver has not received any packets from the server.
Caused by: java.net.ConnectException: failed to connect to localhost/127.0.0.1 (port 3306): connect failed: ECONNREFUSED (Connection refused)
試了很多方法結果都還是一樣,
目前是在Android Studio上用Java撰寫Android的App
請問有人發生過類似的情形嗎?
下面我簡化之後的code
http://codepad.org/kwwZv05Z
謝謝大家。