Guest User

Untitled

a guest
Jan 31st, 2018
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. package jdbcdrive;
  2.  
  3. /**
  4. * @param args
  5. * @throws SQLException
  6. */
  7. public static void main(String[] args) throws SQLException {
  8.  
  9. Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/lpt?autoReconnect=true&useSSL=false","root","2664");
  10.  
  11. Statement st = con.createStatement();
  12.  
  13. ResultSet rs = st.executeQuery("SELECT * FROM sys.lpt");
  14.  
  15. while(rs.next()) {
  16.  
  17. System.out.println(rs.getInt("BatchName")+" "+rs.getString("StudentName")+" "+rs.getString("StudentName")+" "+rs.getString("studentMobileNo")+" "+rs.getString("Address"));
  18. }
  19.  
  20. }
  21.  
  22. Exception in thread "main" com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 3 times. Giving up.
Add Comment
Please, Sign In to add comment