Boa tarde, pessoal estou precisando de fazer conexão com banco de dados postgres, nao sei onde estou errrando.
alguem pode me ajudar.
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package br.com.foxmilenium.model;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLDataException;
import java.sql.SQLException;
/**
*
* @author DELL
*/
public class ConectaBD {
public Connection ConectaAgora(){
String url = "jdbc:postgresql://arapongas2.ath.cx:5432/autosystem";
String usuario = "autosystem";
String senha = "postgres";
try{
Class.forName("org.postgres.Driver").newInstance();
Connection conn = DriverManager.getConnection(url,usuario,senha);
return conn;
}
catch(SQLException ex){
}
catch(Exception e){
}
}
}
