Erreur n 5 du postgreSQL

aminagu Messages postés 47 Date d'inscription mercredi 11 avril 2012 Statut Membre Dernière intervention 26 août 2013 - 31 juil. 2011 à 03:50
aminagu Messages postés 47 Date d'inscription mercredi 11 avril 2012 Statut Membre Dernière intervention 26 août 2013 - 31 juil. 2011 à 14:00
Bonjours ,

j essey de lancer une classe en java pour faire une connection base de donnés Ecole mais j arrive pas :(, quand j essey de "start" pgADMIN le systeme me dIT qu il a rencontrer l erreur 5 et quand j execute il me donne l erreur suivante :
[b]DRIVER OK !
org.postgresql.util.PSQLException: FATAL: database "Ecole" does not exist
at org.postgresql.core.v3.ConnectionFactoryImpl.readStartupMessages(ConnectionFactoryImpl.java:469)
at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:112)
at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:66)
at org.postgresql.jdbc2.AbstractJdbc2Connection.(AbstractJdbc2Connection.java:125)
at org.postgresql.jdbc3.AbstractJdbc3Connection.(AbstractJdbc3Connection.java:30)
at org.postgresql.jdbc3g.AbstractJdbc3gConnection.(AbstractJdbc3gConnection.java:22)
at org.postgresql.jdbc4.AbstractJdbc4Connection.(AbstractJdbc4Connection.java:30)
at org.postgresql.jdbc4.Jdbc4Connection.(Jdbc4Connection.java:24)
at org.postgresql.Driver.makeConnection(Driver.java:393)
at org.postgresql.Driver.connect(Driver.java:267)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at Connect.main(Connect.java:18)

/b
merci d avance ,

2 réponses

cs_Julien39 Messages postés 6414 Date d'inscription mardi 8 mars 2005 Statut Modérateur Dernière intervention 29 juillet 2020 371
31 juil. 2011 à 07:52
Bonjour,

L'erreur database "Ecole" does not exist signifie qu'il n'a pas trouvé ta base "Ecole" mais ca, tu l'avais comprise je pense.

Je ne peux pas t'en dire plus, peux tu nous poster le code qui te permet d'accéder à la base de données ? Et vérifier l’existence de cette base ?
0
aminagu Messages postés 47 Date d'inscription mercredi 11 avril 2012 Statut Membre Dernière intervention 26 août 2013
31 juil. 2011 à 14:00
merci ouii c ça , ce que j ai pas compris c est l erreur 5 de syteme ; bon voici mon code:

import java.sql.Connection;
import java.sql.DriverManager;
import java.util.Enumeration;
import java.util.Properties;

public class Connect {

public static void main(String[] args) {

try {
Class.forName("org.postgresql.Driver");
System.out.println("DRIVER OK ! ");

String url = "jdbc:postgresql://localhost:5432/Ecole";
String user = "postgres";
String passwd = "postgres";

Connection conn = DriverManager.getConnection(url, user, passwd);
System.out.println("Connection effective !");			

} catch (Exception e) {
e.printStackTrace();
}		
}
}
0
Rejoignez-nous