Problème de connexion entre Java et Postgresql
Bonjour,
J'ai essayé avec ce code Java pour connecter avec une base de données postgresql.
Code:
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();
}
}
} |
Mais j'ai eu cette exception:
Citation:
java.lang.ClassNotFoundException: org.postgresql.Driver
Comment je peux résoudre ce problème SVP?