Java - Database connectivity My SQL

public Connection getConnection() {
       Connection con=null;
       try {
              Class.forName("com.mysql.jdbc.Driver");
              con = DriverManager.getConnection(
              "jdbc:mysql://127.0.0.1/databaseName","userName","password");
       } catch(Exception e) {
              System.out.println(e);
       }
       return con;
}

Post a Comment

0 Comments