Help + Postgresql 7.22

Поиск
Список
Период
Сортировка
Искать

Help + Postgresql 7.22

От:
Pierre Routens <proutens@yahoo.fr>
Дата:
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.(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.



Re: Help + Postgresql 7.22

От:
Dave Cramer <Dave@micro-automation.net>
Дата:
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.(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 
Cramer Consulting
-- 
Dave Cramer 

Re: Help + Postgresql 7.22

От:
Dave Cramer <davec@fastcrypt.com>
Дата:

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.(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 
Cramer Consulting

FAQ