Advertisement
Guest User

Untitled

a guest
Nov 4th, 2017
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. public class Lab4 {
  2. public static void main(String[] args) {
  3. Connection conn = null;
  4. try {
  5. // db parameters
  6. String url = "jdbc:mysql://mysql.cs.wwu.edu:3306/<fuented2>?useSSL=false";
  7. String user = "fuented2";
  8. String password = "'}410aD*KB4";
  9. // create a connection to the database
  10. conn = DriverManager.getConnection(url, user, password);
  11. // more processing here
  12. // ...
  13. } catch(SQLException e) {
  14. System.out.println(e.getMessage());
  15. }
  16. finally {
  17. try{
  18. if(conn != null)
  19. {
  20. conn.close();
  21. }
  22. }
  23. catch(SQLException ex){
  24. System.out.println(ex.getMessage());
  25. }
  26. }
  27. }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement