Skip site navigation (1) Skip section navigation (2)

Re: org.postgresql.util.PSQLException: Protocol error. Session setup failed

From: Mark Kirkwood <mark(dot)kirkwood(at)catalyst(dot)net(dot)nz>
To: Major Services <services(dot)major(at)gmail(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: org.postgresql.util.PSQLException: Protocol error. Session setup failed
Date: 2010-03-10 20:31:28
Message-ID: 4B9801A0.8080607@catalyst.net.nz (view raw or flat)
Thread:
Lists: pgsql-jdbc
Oh dear - probably missing imports or something in your code.

Maybe try running a standalone java program from the command line (see 
below), as thats what I used to check this:

$ export CLASSPAT=path-to-your-postgresql.jar:.
$ java test1

---- test1.java ---

import java.sql.*;
import java.util.*;

public class test1 {
public static void main( String args[] ) throws Exception {

    Class.forName("org.postgresql.Driver");
    String url = 
"jdbc:postgresql://localhost:5432/postgres?user=postgres&password=major";

    Properties props = new Properties();
    props.setProperty("loglevel","2");

    Connection conn = DriverManager.getConnection(url, props);
    System.out.println( "Connected to: " + url  );

    conn.close ();
  }
}



Major Services wrote:
> Hi,
> Following is the error report:
>
> org.apache.jasper.JasperException: Unable to compile class for JSP: 
>
> An error occurred at line: 13 in the jsp file: /jsp/pgtest.jsp
> Properties cannot be resolved to a type
>
> 10: {
> 11: Class.forName("org.postgresql.Driver");
> 12:  String url = "jdbc:postgresql://localhost:5432/postgres?user=postgres&password=major";
> 13:  Properties props = new Properties();
> 14:  props.setProperty("loglevel","2");
>
> 15:  Connection conn = DriverManager.getConnection(url, props);
> 16: }
>   


In response to

Responses

pgsql-jdbc by date

Next:From: Mark KirkwoodDate: 2010-03-10 20:32:36
Subject: Re: org.postgresql.util.PSQLException: Protocol error. Session setup failed
Previous:From: Maciek SakrejdaDate: 2010-03-10 18:41:44
Subject: Re: org.postgresql.util.PSQLException: Protocol error. Session setup failed

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group