Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot connect to MySQl database from Eclipse DataSource Explorer

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();
    }
}
like image 956
ASD Avatar asked Aug 26 '26 05:08

ASD


1 Answers

You need to download MySQL JDBC driver and add it to the settings.

You will see these screens when you try to create a new connection profile in Datasource Explorer. In the last step, you'll have to point to the right downloaded JAR file.

enter image description here enter image description here enter image description here enter image description here

like image 102
adarshr Avatar answered Aug 27 '26 20:08

adarshr