Help + Postgresql 7.22

Поиск
Список
Период
Сортировка
От Pierre Routens
Тема Help + Postgresql 7.22
Дата
Msg-id 20021229192116.15825.qmail@web11403.mail.yahoo.com
обсуждение исходный текст
Ответы Re: Help + Postgresql 7.22  (Dave Cramer <davec@fastcrypt.com>)
Список pgsql-jdbc
Please take my join piece.


Pierre.

___________________________________________________________
Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français !
Yahoo! Mail : http://fr.mail.yahoo.comHello, 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.




В списке pgsql-jdbc по дате отправления:

Предыдущее
От: Barry Lind
Дата:
Сообщение: Re: Unable to download/compile postgresql.jar for PG 7.3 with
Следующее
От:
Дата:
Сообщение: Exception throws when using Array