Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.sql.*;
- public class Conexao {
- public static Connection abrirConexao() {
- String driver = "org.postgresql.Driver";
- String user = "postgres";
- String senha = "ifb";
- String url = "jdbc:postgresql://127.0.0.1:5432/loja";
- Connection con = null;
- try {
- Class.forName(driver);
- con = (Connection) DriverManager.getConnection(url, user, senha);
- } catch (ClassNotFoundException ex) {
- System.err.print(ex.getMessage());
- } catch (SQLException e) {
- System.err.print(e.getMessage());
- }
- return con;
- }
- public static void fecharConexao(Connection con){
- try{
- con.close();
- }catch(SQLException e){
- }
- }
- }
- mexer no que ?
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement