1. Class.forName(“com.mysql.jdbc.Driver”);
  2. Connection con = DriverManager.getConnection( “jdbc:mysql://localhost/nepatalk”, “root”, “password”);
  3. Statement st = con.createStatement();
  4. ResultSet rs = st.executeQuery(“SELECT …sql query”);
    if (rs.next())
    System.out.println(“ok”);
  5. st.close();
    con.close();
Advertisements