Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package br.unisul.exemplo.core.dao.connection;
- import java.sql.Connection;
- import java.sql.DriverManager;
- import java.sql.SQLException;
- public class ConexaoJDBC {
- public static final String driver = "org.postgresql.Driver";
- public static final String url =
- "jdbc:postgresql://localhost:5432/postgres";
- public static final String usuario = "postgres";
- public static final String senha = "unisul";
- //importar de java.sql.
- public static Connection getConnection() {
- Connection con = null;
- try {
- Class.forName(driver);
- con = DriverManager.getConnection(url, usuario, senha);
- } catch (SQLException e) {
- e.printStackTrace();
- } catch (ClassNotFoundException e) {
- e.printStackTrace();
- }
- return con;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement