Advertisement
Guest User

Untitled

a guest
Mar 24th, 2016
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. try {
  2. Class.forName("org.postgresql.Driver");
  3. } catch (ClassNotFoundException e) {
  4. System.out.println("Where is your MySQL JDBC Driver?");
  5. e.printStackTrace();
  6. return;
  7. }
  8. System.out.println("MySQL JDBC Driver Registered!");
  9. try {
  10. this.connection = DriverManager.getConnection("jdbc:postgresql://" +DNS+"/"+myDBname, MYSQLUSER, MYSQLPW);
  11. } catch (SQLException e) {
  12. System.out.println("Connection Failed! Check output console");
  13. e.printStackTrace();
  14. }
  15.  
  16. if (connection != null) {
  17. System.out.println("You made it, take control your database now!");
  18. } else {
  19. System.out.println("Failed to make connection!");
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement