1
이 문제는 여러 번 논의되어 왔지만 Java 응용 프로그램과 MySQL 서버 간의 연결을 설정할 수는 없습니다. 발생Java와 MYSQL 서버 사이의 연결
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
public class JDBCTest{
private Connection conn = null;
public void connect(){
try {
Class.forName("com.mysql.jdbc.Driver").newInstance();
System.out.println("test");
conn = DriverManager.getConnection("jdbc:mysql://mysql.***.***.**:3306/******","*******","top_secret_password");
System.out.println("test2");
} catch (SQLException ex) {
// handle any errors
System.out.println("SQLException: " ex.getMessage());
System.out.println("SQLState: " ex.getSQLState());
System.out.println("VendorError: " ex.getErrorCode());
}catch(Exception e){e.printStackTrace();}
}
}
오류는 다음과 같습니다 :
test
SQLException: 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.
SQLState: 08S01
VendorError: 0
당신이 그것을 해결하는 방법을 어떤 아이디어를 가지고 있나요
나는 코드 형태 자습서를 사용하고 있습니다?
이 http://stackoverflow.com/questions/2121829/java-db-communications-link-failure의 정확한 복제본 것 같은데 '블록
3306
포트 케이 있는지 확인 – Barend