Re: Help + Postgresql 7.22 - Mailing list pgsql-jdbc
From | Dave Cramer |
---|---|
Subject | Re: Help + Postgresql 7.22 |
Date | |
Msg-id | 1041537015.20595.90.camel@inspiron.cramers Whole thread Raw |
In response to | Help + Postgresql 7.22 (Pierre Routens <proutens@yahoo.fr>) |
List | pgsql-jdbc |
Pierre, The problem is the url it should be "jdbc:postgresql://localhost/MUSICS" Dave On Sun, 2002-12-29 at 14:21, Pierre Routens wrote: > Please take my join piece. > > > Pierre. > > ___________________________________________________________ > Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français ! > Yahoo! Mail : http://fr.mail.yahoo.com > > ______________________________________________________________________ > > Hello, I have a problem with my connection jdbc. > > My conf is : > > PC Linux Mandrake 9.0 - 256 Ram - Video GForce 200Mx etc.. > > Installed: j2sdk1.4.1.01,postgresql 7.2.2 and driver jdbc : pg72jdbc2.jar > > ********************************************************************************************** > My error message : The error msg generated at getConnect is No suitable driver > Erreur durant la creation de la table : java.lang.NullPointerException > java.lang.NullPointerException > at Connecting.creerTable(Connecting.java:33) > at Connecting.<init>(Connecting.java:23) > at MP3.main(MP3.java:10) > *********************************************************************************************** > > My compilation : > > javac -classpath /home/xarius/tmp/bd/pg72jdbc2.jar /home/xarius/tmp/bd/*.java > > My Executable : > > java -cp /home/xarius/tmp/bd/pg72jdbc2.jar:/home/xarius/tmp/bd MP3 > > > My code : > > //! Class Connecting > import java.sql.*; > import java.io.*; > import java.io.BufferedInputStream; > > class Connecting > { > protected Connection connectionBD; > public Connection getConnectionBD() > { > return this.connectionBD; > } > > public void setConnectionBD(Connection connection) > { > this.connectionBD = connection; > } > > public Connecting() > { > ConnecterBaseDeDonnees cbdd = new ConnecterBaseDeDonnees(); > setConnectionBD(cbdd.connection()); > > creerTable(); > //insererImage(); > //insererBLOB(); > //readGetBLOB() ; > } > > public void creerTable() > { > try > { > Statement stmnt = getConnectionBD().createStatement(); > stmnt.executeUpdate( "CREATE TABLE test (ident int)" ); > > } > catch(Exception ex) > { > System.out.println("Erreur durant la creation de la table : " + ex); > ex.printStackTrace(System.out); > } > } > } > > /********************************************************************************/ > /********************************************************************************/ > > //! Class ConnecterBaseDeDonnees > > import java.sql.*; > > class ConnecterBaseDeDonnees > { > public ConnecterBaseDeDonnees() > { > } > > public Connection connection() > { > Connection con = null; > try > //! Pour PostgreSQL > Class.forName("org.postgresql.Driver"); > String url = "jdbc:postgresql://localhost:127.0.0.1/MUSICS"; > con = DriverManager.getConnection( url,"","" ); > } > catch ( SQLException ex) > { > System.err.println(" Message genere " + ex.getMessage()); > } > catch ( ClassNotFoundException es) > { > System.err.println("Class non trouvee " + es.getMessage()); > } > return con; > } > } > > /********************************************************************************/ > /********************************************************************************/ > > //! Class MP3 > > import java.sql.*; > import java.io.*; > > class MP3 > { > public static void main(String[] args) throws SQLException > { > try > { > Connecting connect = new Connecting(); > } > catch(Exception ex) > { > System.out.println("Main erreur :"+ex); > } > } > } > > > Even with the documention and the forum , I have always the same problem. Please can you help me. > > Excuse me for my bad english, I am French. > > Thank you for yor help. > > Pierre. > > > > > ______________________________________________________________________ > > ---------------------------(end of broadcast)--------------------------- > TIP 6: Have you searched our list archives? > > http://archives.postgresql.org -- Dave Cramer <davec@fastcrypt.com> Cramer Consulting -- Dave Cramer <Dave@micro-automation.net>
pgsql-jdbc by date: