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

From: Major Services <services(dot)major(at)gmail(dot)com>
To: dmp <danap(at)ttc-cmc(dot)net>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: org.postgresql.util.PSQLException: Protocol error. Session setup failed
Date: 2010-03-09 17:41:00
Message-ID: 375c2da1003090941l5160381fq3d6790ad389ea51a@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Output is :

//============================================================ // Main
public access point method for instantiating the // PostgreSQL_JDBC
application. Arguments: database, username, // & password. //
============================================================== public static
void main(String[] args) throws SQLException, InstantiationException,
IllegalAccessException, ClassNotFoundException, InterruptedException {
String host, database, username, password; Connection dbConnection; //
Collect connection properties. and setup connection. //host = "cindy"; host
= "localhost"; if (args.length != 0) { database = args[0]; username =
(args.length > 1) ? args[1] : null; password = (args.length > 2) ? args[2] :
null; } else { database = "postgres"; username = "postgres"; password =
"major"; } dbConnection = null;
Class.forName("org.postgresql.Driver").newInstance(); dbConnection =
DriverManager.getConnection("jdbc:postgresql://" + host + "/" + database,
username, password); System.out.println("Connection Created"); new
PostgreSQL_JDBC(dbConnection); // Close. dbConnection.close();
System.out.println("Connection Closed"); }

On Tue, Mar 9, 2010 at 10:26 PM, dmp <danap(at)ttc-cmc(dot)net> wrote:

> Did not look up error, but looks like the Class.forName().
> Attached standard main() to create a connection to PostgreSQL.
>
> danap.
>
>
> //============================================================
> // Main public access point method for instantiating the
> // PostgreSQL_JDBC application. Arguments: database, username,
> // & password.
> // ==============================================================
>
> public static void main(String[] args) throws SQLException,
> InstantiationException,
> IllegalAccessException, ClassNotFoundException,
> InterruptedException
> {
> String host, database, username, password;
> Connection dbConnection;
>
> // Collect connection properties. and setup connection.
>
> //host = "cindy";
> host = "localhost";
>
> if (args.length != 0)
> {
> database = args[0];
> username = (args.length > 1) ? args[1] : null;
> password = (args.length > 2) ? args[2] : null;
> }
> else
> {
> database = "key_tables";
> username = "";
> password = "";
> }
>
> dbConnection = null;
> Class.forName("org.postgresql.Driver").newInstance();
> dbConnection = DriverManager.getConnection("jdbc:postgresql://" + host
> + "/" + database, username,
> password);
> System.out.println("Connection Created");
>
> new PostgreSQL_JDBC(dbConnection);
>
> // Close.
> dbConnection.close();
> System.out.println("Connection Closed");
> }
>

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Mark Kirkwood 2010-03-09 22:32:18 Re: org.postgresql.util.PSQLException: Protocol error. Session setup failed
Previous Message Maciek Sakrejda 2010-03-09 17:22:46 Re: org.postgresql.util.PSQLException: Protocol error. Session setup failed