JDBC 6.5.1-2 Bug?

From: Bill Chatfield <bill(dot)chatfield(at)netcommunity(dot)com>
To: bugs(at)postgreSQL(dot)org
Subject: JDBC 6.5.1-2 Bug?
Date: 1999-10-17 05:24:33
Message-ID: 38095D90.153D9F92@netcommunity.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

============================================================================

POSTGRESQL BUG REPORT TEMPLATE
============================================================================

Your name : Bill Chatfield
Your email address : bill(dot)chatfield(at)netcommunity(dot)com

System Configuration
---------------------
Architecture (example: Intel Pentium) : Intel Pentium

Operating System (example: Linux 2.0.26 ELF) : Red Hat 6.0

PostgreSQL version (example: PostgreSQL-6.4.2) : PostgreSQL-6.4.2

Compiler used (example: gcc 2.8.0) : Standard Red Hat PostgreSQL was
used
gcc version egcs-2.91.66 19990314/Linux
(egcs-1.1.2 release)

Please enter a FULL description of your problem:
------------------------------------------------

JDBC driver 6.5.1-2.rpm causes exception on connect failure:

java.lang.ArrayIndexOutOfBoundsException
at java.text.MessageFormat.format(MessageFormat.java:238)
at java.text.MessageFormat.format(MessageFormat.java:230)
at postgresql.util.PSQLException.translate(PSQLException.java:83)
at postgresql.util.PSQLException.<init>(PSQLException.java:45)
at postgresql.Driver.connect(Driver.java:106)
at java.sql.DriverManager.getConnection(DriverManager.java:61)

This doesn't happen with the 6.3 JDBC driver. 6.3 says:
Conect: The user property is missing. It is mandatory.

Additional question: why is the user property mandatory if I'm
connecting
locally? When I run psql it just uses my Linux login name. Why can't
the jdbc do that?

Please describe a way to repeat the problem. Please try to provide a
concise reproducible example, if at all possible:
----------------------------------------------------------------------

Use Red Hat 6.0. Install postgres-jdbc-6.5.1-2.rpm. Use /usr/bin/java
or
/opt/jdk117_v3 (generates different error but same idea). Use the
following code.

import java.io.*;
import java.sql.*;

class Pj

public static void main(String argv[])
{
Connection db = null;

try
{
Class.forName("postgresql.Driver");
db = DriverManager.getConnection("jdbc:postgresql:dbname");
try
{
Statement st = db.createStatement();
try
{
ResultSet rs = st.executeQuery("select * from users");
while (rs.next())
{
System.out.print("Column 1 returned ");
System.out.println(rs.getString(1));
}
rs.close();
}
catch (SQLException e)
{
System.err.println("Exec: " + e.getLocalizedMessage());
}
st.close();
}
catch (SQLException e)
{
System.err.println("Statement: " + e.getLocalizedMessage());
}
}
catch (ClassNotFoundException e) // Class.forName error
{
System.err.println("No driver: " + e.getLocalizedMessage());
}
catch (SQLException e) // getConnection error
{
}

try
{
if (db != null)
db.close();
}
catch (SQLException e)
{
System.err.println("Close: " + e.getLocalizedMessage());
}

}

If you know how this problem might be fixed, list the solution below:
---------------------------------------------------------------------

No clue.

Browse pgsql-bugs by date

  From Date Subject
Next Message Damien Silveira 1999-10-17 14:01:27 postgresbug.txt
Previous Message Peter Schaefer 1999-10-14 10:52:29 default operator (int8le?)