Re: Help + Postgresql 7.22

From: Dave Cramer <Dave(at)micro-automation(dot)net>
To: Pierre Routens <proutens(at)yahoo(dot)fr>
Cc: "pgsql-jdbc(at)postgresql(dot)org" <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: Help + Postgresql 7.22
Date: 2003-01-02 19:50:15
Message-ID: 1041537015.20595.90.camel@inspiron.cramers
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)fastcrypt(dot)com>
Cramer Consulting
--
Dave Cramer <Dave(at)micro-automation(dot)net>

Browse pgsql-jdbc by date

  From Date Subject
Next Message Tom Lane 2003-01-02 20:24:20 Re: join over 12 tables takes 3 secs to plan
Previous Message Dave Cramer 2003-01-02 19:49:39 Re: Help + Postgresql 7.22