Thread: help please

help please

From
"abhijeet dharurkar"
Date:
 
session setup failed
all setings are correct but while running the program from command line it gives the error....... 
 
 
program: 
import java.sql.*;
 
class aa
{
 
 public static void main (String[] args) throws Exception
    {
  
  Class.forName("org.postgresql.Driver");
  System.out.println("Drivers found and registered");
 
  Connection con = DriverManager.getConnection("jdbc:postgresql:post","postgres","abhi");
  System.out.println("connected db");
  
  Statement stmt = con.createStatement();
 
  System.out.print("done!!!!");
 

   }
Error:
 
G:\>java aa
Drivers found and registered
Exception in thread "main" org.postgresql.util.PSQLException: Protocol error.  Session setup failed.
        at org.postgresql.core.v3.ConnectionFactoryImpl.doAuthentication(ConnectionFactoryImpl.java:381)
        at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:94)
        at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:66)
        at org.postgresql.jdbc2.AbstractJdbc2Connection.<init>(AbstractJdbc2Connection.java:125)
        at org.postgresql.jdbc3.AbstractJdbc3Connection.<init>(AbstractJdbc3Connection.java:30)
        at org.postgresql.jdbc3.Jdbc3Connection.<init>(Jdbc3Connection.java:24)
        at org.postgresql.Driver.makeConnection(Driver.java:382)
        at org.postgresql.Driver.connect(Driver.java:260)
        at java.sql.DriverManager.getConnection(Unknown Source)
        at java.sql.DriverManager.getConnection(Unknown Source)
        at aa.main(aa.java:12)
 
G:\>

Re: help please

From
Guy Rouillier
Date:
abhijeet dharurkar wrote:
>
> session setup failed
> all setings are correct but while running the program from command line
> it gives the error.......
> DriverManager.getConnection("jdbc:postgresql:post","postgres","abhi");

That URL doesn't look right.  Here is one that works:

jdbc:postgresql://localhost:5432/postgres

Maybe some of the fields default if not provided.  If the URL is not
your issue, then provide the database version and the exact version of
the JDBC driver JAR file you are using.

--
Guy Rouillier

Re: help please

From
Kris Jurka
Date:

On Sat, 3 Jan 2009, abhijeet dharurkar wrote:

> all setings are correct but while running the program from command line it
> gives the error.......
>
> Exception in thread "main" org.postgresql.util.PSQLException: Protocol
> error.  Session setup failed.
>        at
> org.postgresql.core.v3.ConnectionFactoryImpl.doAuthentication(ConnectionFactoryImpl.java:381)
>        at
>

During the authentication step of the connection startup process we expect
only a couple of different message types.  Something about your setup is
giving a message type the driver is not prepared for.  Without knowing
what message it is, it's not clear how to help.  I've added additional
logging to the driver to print out the message type.  Please try this
driver and post the results.

http://ejurka.com/pgsql/jars/startlog/

Kris Jurka