1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
|
Connection con = null;
Statement st = null;
ResultSet rs = null;
try
{
Class.forName("org.postgresql.Driver");
System.out.println ("driver etablie");
}
catch(Exception e)
{
System.out.println ("erreur:Driver int" +
"rouvable");
}
//connexion à la base
try
{
String URL = "jdbc:postgresql://localhost:5432/test";
String USER = "postgres";
String PASSWD = "nnnnnn";
con =DriverManager.getConnection(URL,USER, PASSWD);
System.out.println ("connexion base pfe etablie");
}
catch(Exception e)
{
System.out.println ("erreur: base introuvable");
} |
Partager