To recebendo este erro :
import java.sql.Connection;
import java.sql.DriverManager;
public class ConexaoPostgreSQL {
public Connection getConnection() {
try {
Class.forName("org.postgresql.Driver");
String driver = "jdbc:postgresql://localhost:5432/nutec";
Connection con = DriverManager.getConnection(driver, "root", "debian23");
System.out.println("================Conexão realizada com sucesso.===============");
return con;
} catch (Exception e) {
e.printStackTrace();
System.err.print(e.getMessage());
System.out.println("=========================ERRO====================");
}
return null;
}
}
no hibernate eu consigo isso facinho !
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</property>
<property name="hibernate.connection.driver_class">org.postgresql.Driver</property>
<property name="hibernate.connection.url">jdbc:postgresql://localhost:5432/bdcadastro</property>
<property name="hibernate.connection.username">root</property>
<property name="hibernate.connection.password">debian23</property>
<mapping class="br.gov.nutec.modelo.Pessoa"/>
<mapping class="br.gov.nutec.modelo.Mensalidade"/>
</session-factory>
</hibernate-configuration>