2012-02-23 1 views
2

http://motionsharing.com/site/download/acefad55f1e81e456d71a7448b278915이클립스 데이터 소스 탐색기에서 MySQL 데이터베이스에 연결할 수 없습니다 이클립스 데이터 소스 탐색기

에서 MySQL 데이터베이스에 연결할 수 없습니다.

적절한 드라이버를 조정했지만 연결할 수 없습니다. P.S. : derby db에 연결할 수 있으며 코드에서만 mysql db에 연결할 수 있지만 데이터 소스 탐색기에서 mysql db에 연결하여 테이블 생성 등의 작업을 수행 할 수 있습니다.

무엇이 잘못 되었나요?

코드를 통해 연결할 수 있습니다.

public static void main(String args[]) { 
    try { 
     Class.forName("com.mysql.jdbc.Driver"); 
     System.out.println("Driver loading success!"); 
     String url = "jdbc:mysql://localhost:3306/mydb"; 
     String name = "root"; 
     String password = "root"; 
     try { 
      Connection con = DriverManager.getConnection(url, name, password); 
      System.out.println("Connected."); 
      con.close(); 
      System.out.println("Disconnected."); 
     } catch (SQLException e) { 
      e.printStackTrace(); 
     } 

    } catch (ClassNotFoundException e) { 
     e.printStackTrace(); 
    } 
} 

답변

5

download MySQL JDBC 드라이버가 필요하며 설정에 추가해야합니다.

데이터 소스 탐색기에서 새 연결 프로필을 만들려고하면이 화면이 나타납니다. 마지막 단계에서 다운로드 한 JAR 파일을 가리켜 야합니다. 드라이버 속성에서 enter image description here

+0

하지만 com.mysql.jdbc.Driver는 무엇입니까? – ASD

+0

MySQL 데이터베이스에 연결하는 라이브러리입니다. 게시 한 링크에서 다운로드하면 찾으실 수 있습니다. – adarshr

2

enter image description here enter image description here

enter image description here 사용할 수 있는지 확인하십시오 :

URL: jdbc:mysql://localhost:3306/schema_name 

Database: schema_name 

그래서 이클립스는 데이터 소스 탐색기 엔 테이블을 표시합니다.

+0

없이 ** schema_name ** URL 끝에 추가하면 표 노드가 확장되지 않지만 표 노드는 표시 할 수 있지만 확장 할 수는 없습니다. – zionpi

관련 문제