IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

JDBC Java Discussion :

Problème de connexion avec PostgreSQL


Sujet :

JDBC Java

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre à l'essai
    Homme Profil pro
    Étudiant
    Inscrit en
    Août 2014
    Messages
    4
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Côte d'Ivoire

    Informations professionnelles :
    Activité : Étudiant
    Secteur : Enseignement

    Informations forums :
    Inscription : Août 2014
    Messages : 4
    Par défaut Problème de connexion avec PostgreSQL
    Bonjour,


    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    import java.sql.*;
    import java.io.*;
     
     
    public class Connect {
     
     /**
     
     
    * @param args
     
    */
     public static void main(String[] args) {
      // TODO Auto-generated method stub
      try {
       Class.forName("org.postgresql.Driver");
       System.out.println("Driver chargé");
     
       String url = "jdbc:postgresql://localhost:5432/Ecole";
       String user = "postgres";
       String psswd = "postgres";
     
       Connection conn = DriverManager.getConnection(url, user, psswd);
       System.out.println("Connexion établie");
       } 
      catch (Exception e){
       e.printStackTrace();
      }
     }
     
    }
    Lorsque j'execute le code dans eclipse je reçois le message d'erreur suivant:
    Driver chargé
    org.postgresql.util.PSQLException: FATAL: authentification par mot de passe ?chou?e pour l'utilisateur ? postgres ?
    at org.postgresql.core.v3.ConnectionFactoryImpl.doAuthentication(ConnectionFactoryImpl.java:420)
    at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:195)
    at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:66)
    at org.postgresql.jdbc2.AbstractJdbc2Connection.<init>(AbstractJdbc2Connection.java:127)
    at org.postgresql.jdbc3.AbstractJdbc3Connection.<init>(AbstractJdbc3Connection.java:29)
    at org.postgresql.jdbc3g.AbstractJdbc3gConnection.<init>(AbstractJdbc3gConnection.java:21)
    at org.postgresql.jdbc4.AbstractJdbc4Connection.<init>(AbstractJdbc4Connection.java:41)
    at org.postgresql.jdbc4.Jdbc4Connection.<init>(Jdbc4Connection.java:24)
    at org.postgresql.Driver.makeConnection(Driver.java:414)
    at org.postgresql.Driver.connect(Driver.java:282)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at Connect.main(Connect.java:20)

  2. #2
    Membre Expert Avatar de jeffray03
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Juillet 2008
    Messages
    1 501
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Allemagne

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Juillet 2008
    Messages : 1 501
    Par défaut
    Salut ,
    peux-tu regarder le contenu du document pg_hba.conf
    et donnes nous ce qu´il y'a a la ligne contenant ceci:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    host all all 127.0.0.1/32
    eric

  3. #3
    Membre à l'essai
    Homme Profil pro
    Étudiant
    Inscrit en
    Août 2014
    Messages
    4
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Côte d'Ivoire

    Informations professionnelles :
    Activité : Étudiant
    Secteur : Enseignement

    Informations forums :
    Inscription : Août 2014
    Messages : 4
    Par défaut
    Bonjour, merci pour votre réponse mais je ne sais pas où trouver ce documents pg_hba auquel vous faites référence

  4. #4
    Membre Expert Avatar de jeffray03
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Juillet 2008
    Messages
    1 501
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Allemagne

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Juillet 2008
    Messages : 1 501
    Par défaut
    salut,

    • Chemin sous LINUX: /postgresql/[version]/data/
    • Chemin sous Windows: /postgresql/[version]/data/



    Eric

  5. #5
    Membre à l'essai
    Homme Profil pro
    Étudiant
    Inscrit en
    Août 2014
    Messages
    4
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Côte d'Ivoire

    Informations professionnelles :
    Activité : Étudiant
    Secteur : Enseignement

    Informations forums :
    Inscription : Août 2014
    Messages : 4
    Par défaut
    Bonjour, MR Jeffray03 excusez moi pour cette période d'absence , voici ce que j'ai trouvé dans le fichier pg_hba.conf :
    # IPv4 local connections:
    host all all 127.0.0.1/32 md5
    # IPv6 local connections:
    host all all ::1/128 md5
    # Allow replication connections from localhost, by a user with the
    # replication privilege.
    #host replication postgres 127.0.0.1/32 md5
    #host replication postgres ::1/128 md5

  6. #6
    Membre Expert Avatar de jeffray03
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Juillet 2008
    Messages
    1 501
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Allemagne

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Juillet 2008
    Messages : 1 501
    Par défaut
    salut,
    modifies ce fichier comme ceci:

    commentes les lignes suivante:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
     
    # local all all ident
    # host all all 127.0.0.1/32 md5
    # host all all ::1/128 md5
    et ajoutes ces lignes:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
     
    local all all trust
    host all all 127.0.0.1/32 trust
    eric

Discussions similaires

  1. probléme de connexion avec postgresql
    Par selmagsi dans le forum Général Java
    Réponses: 2
    Dernier message: 09/05/2014, 17h21
  2. Un problème de connexion avec PostgreSQL
    Par edwithenwisdom dans le forum NetBeans
    Réponses: 4
    Dernier message: 13/06/2011, 13h18
  3. [MSDE2000] Problème de connexion avec DbaMgr2k et SQL WDA
    Par Coplan dans le forum MS SQL Server
    Réponses: 2
    Dernier message: 23/06/2005, 15h37
  4. problème de connexion avec une base firebird
    Par vbcasimir dans le forum Bases de données
    Réponses: 1
    Dernier message: 30/05/2005, 11h40
  5. Problème de login avec Postgresql
    Par maddog2032 dans le forum PostgreSQL
    Réponses: 5
    Dernier message: 27/04/2005, 13h19

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo