Précédent   Forum du club des développeurs et IT Pro > Java > EDI et OUTILS pour Java > NetBeans
NetBeans Forum d'entraide NetBeans. Avant de poster -> Ressources NetBeans - La F.A.Q NetBeans - Tutoriels NetBeans
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse
 
Outils de la discussion
Publicité
'
Vieux 12/12/2012, 11h31   #1
Frantz2501
Invité régulier
 
Homme
Étudiant
Inscription : février 2012
Messages : 29
Détails du profil
Informations personnelles :
Sexe : Homme
Localisation : France

Informations professionnelles :
Activité : Étudiant
Secteur : Service public

Informations forums :
Inscription : février 2012
Messages : 29
Points : 9
Points : 9
Par défaut Perte connexion Postgres

J'ai créé une base sous postgres. Je veux l'interroger via java (sous Netbeans).

J'ai bien ajouté la library postgres. Je suis même allé remettre le classpath à la main.

Mais non, je récupère encore :

Code :
1
2
java.sql.SQLException: No suitable driver found for jdbc.postgresql://localhost:5432/bdd
	at java.sql.DriverManager.getConnection(DriverManager.java:604)
Le code de connexion :

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
25
26
public ResultSet rqt(String query){
        try{
            Class.forName("org.postgresql.Driver");
            System.out.println("Driver OK");
 
            String url="jdbc.postgresql://localhost:5432/bdd";
            String user="postgres";
            String passwd="coincoin";
 
            Connection conn=DriverManager.getConnection(url, user, passwd);
 
 
            Statement state = conn.createStatement();
            ResultSet result = state.executeQuery(query);
            ResultSetMetaData resultMeta = result.getMetaData();
 
 
            state.close();
           return result;
 
        }catch(Exception e){
            e.printStackTrace();
        }
        return null;
 
    }
Versions NB 7.2.1
JDBC Postgres : 9.1

Si l'un d'entre vous à une idée, parce que je sèche totalement.
Frantz2501 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 14/12/2012, 22h26   #2
nathieb
Membre émérite
 
Avatar de nathieb
 
Homme olivier Thiébaut
Chef de projet/Architecte
Inscription : mai 2004
Messages : 704
Détails du profil
Informations personnelles :
Nom : Homme olivier Thiébaut
Âge : 46
Localisation : France

Informations professionnelles :
Activité : Chef de projet/Architecte
Secteur : Service public

Informations forums :
Inscription : mai 2004
Messages : 704
Points : 843
Points : 843
Par défaut driver

BOnjour,

TOut est dans le message, ton driver n'est pas chargé dans le classpath


java.sql.SQLException: No suitable driver found for jdbc.postgresql://localhost:5432/bdd at java.sql.DriverManager.getConnection(DriverManager.java:604)


ant maven ??

Olivier
__________________
Architecte déstructurant,
be cool, be free

J2EE - PHP - Free OS
nathieb est actuellement connecté   Envoyer un message privé Réponse avec citation 00
Vieux 15/12/2012, 14h51   #3
Frantz2501
Invité régulier
 
Homme
Étudiant
Inscription : février 2012
Messages : 29
Détails du profil
Informations personnelles :
Sexe : Homme
Localisation : France

Informations professionnelles :
Activité : Étudiant
Secteur : Service public

Informations forums :
Inscription : février 2012
Messages : 29
Points : 9
Points : 9
Je suis sur un poste pro. Du coup, je n'ai pas trop la main sur ce qui se passe au niveau des jdk & jre.

J'ai repris le projet et ça fonctionne.

Merci!
Frantz2501 est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Cette discussion est résolue.
Outils de la discussion

Navigation rapide


Fuseau horaire GMT +2. Il est actuellement 21h32.


 
 
 
 
Partenaires

Hébergement Web