Guest User

Untitled

a guest
Nov 6th, 2018
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. protected void connectionTest() {
  2. java.sql.Connection conn = null;
  3. try {
  4. final String mysqlConnUrl = "jdbc:postgresql://***.***.***.***:5432/databaseName";
  5. try {
  6.  
  7. Class.forName("org.postgresql.Driver");
  8. Properties props = new Properties();
  9. props.setProperty("user", "root");
  10. props.setProperty("password", "root");
  11. props.setProperty("ssl", "true");
  12. conn = DriverManager.getConnection(mysqlConnUrl, props);
  13.  
  14. } catch (NoClassDefFoundError i) {
  15. i.printStackTrace();
  16. }
  17. conn.close();
  18. } catch (Exception ex) {
  19. ex.printStackTrace();
  20. }
  21. }
Add Comment
Please, Sign In to add comment