Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 2C122632A1D for ; Tue, 9 Mar 2010 13:41:14 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 17548-02 for ; Tue, 9 Mar 2010 17:41:03 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-ww0-f46.google.com (mail-ww0-f46.google.com [74.125.82.46]) by mail.postgresql.org (Postfix) with ESMTP id 1AB54635962 for ; Tue, 9 Mar 2010 13:41:02 -0400 (AST) Received: by wwb39 with SMTP id 39so415381wwb.19 for ; Tue, 09 Mar 2010 09:41:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type; bh=LT3DexTLGq9Lw3b9XUXrzazjP8yxBqDR03IRQrc1OKQ=; b=mtLULs4/U26Bw0J7zs8FUEUFx3N3ISA2qs2eF0oPC1hI+aBaqu5yyDFzL8znkEug1P 8TKkfKBGakaPBdiaUb8/Vh33uKQVaVnbgGxJdnmUne+iO4pqvaaOgkaqhi4nyjnsv94A QL+6/EaLWKaC/AuP8YDsJcqzBIS7+/cHzqtik= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=MbN8+khsvzkDLsGHRtnowDrOfAYBqwKpf1mBntBAj5E1E0GwFqU1Giact2nfXEzXMe rA/TwQqCMpaFt9LTY1Tl/ANbEyWE7rL0VG5Cs6FEzWsj5JjeU+meZHsxxHrzax6E9MIs majSiochlxIiTiA8hLViDGZBHp22JbrpeYYvk= MIME-Version: 1.0 Received: by 10.216.89.5 with SMTP id b5mr68801wef.143.1268156461241; Tue, 09 Mar 2010 09:41:01 -0800 (PST) In-Reply-To: <4B967DB4.8090104@ttc-cmc.net> References: <375c2da1003090851h36daef83v2ced94b02051b08b@mail.gmail.com> <4B967DB4.8090104@ttc-cmc.net> Date: Tue, 9 Mar 2010 23:11:00 +0530 Message-ID: <375c2da1003090941l5160381fq3d6790ad389ea51a@mail.gmail.com> Subject: Re: org.postgresql.util.PSQLException: Protocol error. Session setup failed From: Major Services To: dmp Cc: pgsql-jdbc@postgresql.org Content-Type: multipart/alternative; boundary=0016e6d7eea0645d3c048161af9c X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.109 tagged_above=-10 required=5 tests=BAYES_05=-1.11, HTML_MESSAGE=0.001 X-Spam-Level: X-Archive-Number: 201003/25 X-Sequence-Number: 20365 --0016e6d7eea0645d3c048161af9c Content-Type: text/plain; charset=ISO-8859-1 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 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"); > } > --0016e6d7eea0645d3c048161af9c Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Output is :

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

On Tue, Mar 9, 2010 at 10:26 PM, dmp= <danap@ttc-cmc.n= et> wrote:
Did not look up error, but looks like the Class.forName().
Attached standard main() to create a connection to PostgreSQL.

danap.


=A0 //=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
=A0 // Main public access point method for instantiating the
=A0 // PostgreSQL_JDBC application. Arguments: database, username,
=A0 // & password.
=A0 // =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

=A0 public static void main(String[] args) throws SQLException, Instantiat= ionException,
=A0 =A0 =A0 =A0 IllegalAccessException, ClassNotFoundException, Interrupte= dException
=A0 {
=A0 =A0 =A0String host, database, username, password;
=A0 =A0 =A0Connection dbConnection;

=A0 =A0 =A0// Collect connection properties. and setup connection.

=A0 =A0 =A0//host =3D "cindy";
=A0 =A0 =A0host =3D "localhost";

=A0 =A0 =A0if (args.length !=3D 0)
=A0 =A0 =A0{
=A0 =A0 =A0 =A0 database =3D args[0];
=A0 =A0 =A0 =A0 username =3D (args.length > 1) ? args[1] : null;
=A0 =A0 =A0 =A0 password =3D (args.length > 2) ? args[2] : null;
=A0 =A0 =A0}
=A0 =A0 =A0else
=A0 =A0 =A0{
=A0 =A0 =A0 =A0 database =3D "key_tables";
=A0 =A0 =A0 =A0 username =3D "";
=A0 =A0 =A0 =A0 password =3D "";
=A0 =A0 =A0}

=A0 =A0 =A0dbConnection =3D null;
=A0 =A0 =A0Class.forName("org.postgresql.Driver").newInstance();=
=A0 =A0 =A0dbConnection =3D DriverManager.getConnection("jdbc:postgre= sql://" + host + "/" + database, username,
=A0 =A0 =A0 =A0 password);
=A0 =A0 =A0System.out.println("Connection Created");

=A0 =A0 =A0new PostgreSQL_JDBC(dbConnection);

=A0 =A0 =A0// Close.
=A0 =A0 =A0dbConnection.close();
=A0 =A0 =A0System.out.println("Connection Closed");
=A0 }

--0016e6d7eea0645d3c048161af9c--