Advertisement
Guest User

Untitled

a guest
May 11th, 2016
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. public Connection conexaoPostgres(){
  2. Connection con = null;
  3. try {
  4. Class.forName("org.postgresql.Driver");
  5. con = DriverManager.getConnection("jdbc:postgresql://[IP]:[PORTA]/[BASE_DE_DADOS]","[LOG]","[PASS]");
  6. }
  7. catch (ClassNotFoundException | SQLException e) {
  8. System.out.println("Projeto PrjX, classe Dao, método conexaoPostgres, erro: "+e.getMessage());
  9. }
  10. return con;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement