1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| import java.sql.Connection;
import java.sql.DriverManager;
public class Main {
public static void main(String[] args) {
try
{
Class.forName("org.postgresql.Driver");
System.out.println("Driver O.K.");
String url = "jdbc:postgresql://localhost:8080/Ecole";
String user = "postgres";
String passwd = "postgres";
Connection conn = DriverManager.getConnection(url,user,passwd);
System.out.println("Connexion effective !");
}
catch (Exception e)
{
e.printStackTrace();
}
}
} |
Partager