pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Major Services <services.major@gmail.com>
To: dmp <danap@ttc-cmc.net>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: org.postgresql.util.PSQLException: Protocol error. Session setup failed
Date: Tue, 9 Mar 2010 23:11:00 +0530
Message-ID: <375c2da1003090941l5160381fq3d6790ad389ea51a@mail.gmail.com> (raw)
In-Reply-To: <4B967DB4.8090104@ttc-cmc.net>
References: <375c2da1003090851h36daef83v2ced94b02051b08b@mail.gmail.com>
	<4B967DB4.8090104@ttc-cmc.net>

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@ttc-cmc.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");
>   }
>

view thread (15+ messages)  latest in thread

Message-ID: <375c2da1003090941l5160381fq3d6790ad389ea51a@mail.gmail.com>
Permalink:  ../375c2da1003090941l5160381fq3d6790ad389ea51a@mail.gmail.com/
Also on:    postgresql.org/message-id/375c2da1003090941l5160381fq3d6790ad389ea51a@mail.gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: services.major@gmail.com, danap@ttc-cmc.net
  Subject: Re: org.postgresql.util.PSQLException: Protocol error. Session setup failed
  In-Reply-To: <375c2da1003090941l5160381fq3d6790ad389ea51a@mail.gmail.com>
  References: <375c2da1003090851h36daef83v2ced94b02051b08b@mail.gmail.com> <4B967DB4.8090104@ttc-cmc.net> <375c2da1003090941l5160381fq3d6790ad389ea51a@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox