0

I searched the internet for a while now and no one seems to using Eclipse so my local Java application can access, use and manipulate the database server? I have already tried EasyPHP using JDBC connection establishment, however, the connection was never successfully established (yet). I do not want any MySQL webspace or Apache/XAMPP software, simply a local MySQL server to work with in Eclipse.

Establishing the connection (just as side information, everything fine here):

public static Connection getConnection() throws Exception{

    try{
        String driver = "com.mysql.jdbc.Driver";
        String url = "jdbc:mysql://localhost:3306/database";
        String username = framework.getUsername();
        String password = framework.getPassword();
        Class.forName(driver);

        Connection conn = DriverManager.getConnection(url, username, password);
        framework.showMessage("The database connection has been successfully established.");
        return conn;

    }catch(Exception e){

        framework.showException(e);
        return null;
    }       
}

Any suggestions?

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
  • I am not sure I understand the issue. All you need is above code, mysql server running at port 3306 in your localhost and the mysql jdbc driver to connect. – yogidilip May 05 '17 at 16:37
  • EasyPHP is running in the background, exact same port, Eclipse still does not recognize its local MySQL server. Exception code: –  May 05 '17 at 17:22
  • 2
    Your question does not seem related to Eclipse, and otherwise you really need to provide more detail what it is you want. Exactly what is the problem? You say your code is working fine, with seems to contradict the fact that you say you can't establish a connection. – Mark Rotteveel May 05 '17 at 17:39

0 Answers0