Advertisement
Guest User

Untitled

a guest
Mar 13th, 2019
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. import java.sql.Connection;
  2. import java.sql.DriverManager;
  3. import java.sql.SQLException;
  4.  
  5. Connection conn = null;
  6. ...
  7. try {
  8. conn =
  9. DriverManager.getConnection("jdbc:mysql:)/localhost:3306/db?useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC" + "user=minty&password=greatsqldb");
  10.  
  11. // Do something with the Connection
  12.  
  13. ...
  14. } catch (SQLException ex) {
  15. // handle any errors
  16. System.out.println("SQLException: " + ex.getMessage());
  17. System.out.println("SQLState: " + ex.getSQLState());
  18. System.out.println("VendorError: " + ex.getErrorCode());
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement