Reputation: 735
http://motionsharing.com/site/download/acefad55f1e81e456d71a7448b278915
Cannot connect to MySQl database from Eclipse DataSource Explorer.
I tune appropriate driver but I cannot to connect. P.S.: I can connect to derby db and I can connect to mysql db but only from code, but I want to connect to mysql db from Data Source Explorer to get posivbilities to create tables and so on.
What is wrong ?
I can connect through code.
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();
}
}
Upvotes: 3
Views: 12195
Reputation: 4024
In Driver Properties make sure to use:
URL: jdbc:mysql://localhost:3306/schema_name
Database: schema_name
So Eclipse will show the tables en the Data Source Explorer.
Upvotes: 2