Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package jdbcdrive;
- /**
- * @param args
- * @throws SQLException
- */
- public static void main(String[] args) throws SQLException {
- Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/lpt?autoReconnect=true&useSSL=false","root","2664");
- Statement st = con.createStatement();
- ResultSet rs = st.executeQuery("SELECT * FROM sys.lpt");
- while(rs.next()) {
- System.out.println(rs.getInt("BatchName")+" "+rs.getString("StudentName")+" "+rs.getString("StudentName")+" "+rs.getString("studentMobileNo")+" "+rs.getString("Address"));
- }
- }
- 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