Re: Strange behaviour of JDBC driver for PostgreSQL - Mailing list pgsql-jdbc

From Fernando Nasser
Subject Re: Strange behaviour of JDBC driver for PostgreSQL
Date
Msg-id 3E0090A3.1060401@redhat.com
Whole thread Raw
In response to Strange behaviour of JDBC driver for PostgreSQL  (Carlos Correia <carlos@m16e.com>)
List pgsql-jdbc
Carlos Correia wrote:
> The information that is correct is the one from the localhost (version
> 7.2.2)
> I've never used such a version (6.x.x).
>

This lead us to believe you are using a server which is version 6.x.x...

 >>>> REMOTE MACHINE IN THE SAME NETWORK:
 >>>> Database: PostgreSQL
 >>>> Version: 6.5.2

Regards,
Fernando


> I've downloaded the 7.3 driver (pg73jdbc3.jar) and... It happened the
> same (even with the same line numbers in the SQLException's stack
> trace). I'm sure I made no mistake!
> Note: I'm also sure there are no more Postgres installations in the
> network.
>
> Carlos Correia
>
>> Dave Cramer wrote:
>>
>>> Carlos,
>>>
>>> Sorry, I didn't read your email carefully enough. The driver won't work
>>> with a 6.5.2 database, my apologies. You will need to upgrade the remote
>>> server
>>>
>>> Dave
>>>
>>> On Tue, 2002-12-17 at 12:54, Carlos Correia wrote:
>>>
>>>
>>>> I have problems with PostgreSQL when connecting from another machine in
>>>> the same network, after upgrading to 7.2.2 (Mandrake 9.0).
>>>>
>>>> When invoking 'getColumns()' on a DatabaseMetaData object I get (very)
>>>> different results when I invoke it in the local machine (in which works
>>>> good) then when I invoke it in another machine in the network as you
>>>> can
>>>> see below:
>>>>
>>>> I've made a small Java class to reproduce its bizarre behaviour (I'm
>>>> using the same driver in both machines -
>>>> /usr/share/pgsql/jdbc7.2dev-1.2.jar from Mandrake 9.0), here is its
>>>> output:
>>>>
>>>>
>>>> ==================================
>>>> LOCAL MACHINE:
>>>> Database: PostgreSQL
>>>> Version: 7.2.2
>>>>
>>>>
>>>> schemas:
>>>>
>>>>
>>>> catalogs:
>>>> template1
>>>> template0
>>>> sedb
>>>>
>>>> Fields for table: 'test'
>>>> ID TYPE TYPNAME NAME LEN NULLABLE
>>>> 1 4 int4 4 NO
>>>> 2 1 bpchar 20 YES
>>>>
>>>> ===================================
>>>> REMOTE MACHINE IN THE SAME NETWORK:
>>>> Database: PostgreSQL
>>>> Version: 6.5.2
>>>>
>>>>
>>>> schemas:
>>>>
>>>>
>>>>
>>>> catalogs:
>>>>
>>>>
>>>> Fields for table: 'test'
>>>> ID TYPE TYPNAME NAME LEN NULLABLE
>>>> ERROR: No such attribute or function 'oid'
>>>>
>>>>
>>>> java.sql.SQLException: ERROR: No such attribute or function 'oid'
>>>>
>>>> org.postgresql.Connection.ExecSQL(Connection.java at :393)
>>>> org.postgresql.jdbc2.DatabaseMetaData.getColumns( at
>>>> DatabaseMetaData.jav
>>>> a:1880)
>>>> at DbTester.(DbTester.java:41)
>>>> at DbTester.main(DbTester.java:115)
>>>>
>>>> ================================
>>>> LAST LINES OF '/var/lib/pgsql/data/pg_hba.conf':
>>>> local all ident sameuser
>>>> host all 192.168.1.2 255.255.255.0 trust
>>>>
>>>> 191.168.1.2 is the client machine, running the same version of JDK
>>>> (1.4.0).
>>>>
>>>> Here is the test program that illustrates this behaviour:
>>>>
>>>> import java.util.*;
>>>> import java.text.*;
>>>> import java.io.*;
>>>>
>>>> import java.sql.*;
>>>>
>>>> ///////////////////////////////////////////////// ///////////
>>>> public class DbTester
>>>> {
>>>> Connection connection = null;
>>>> DatabaseMetaData dbmd = null;
>>>>
>>>> //////////////////////////////////////////////// ////////////
>>>> public DbTester()
>>>> throws SQLException, ClassNotFoundException,
>>>> FileNotFoundException, IOException
>>>> {
>>>> Class.forName( "org.postgresql.Driver" );
>>>> Connection connection =
>>>> DriverManager.getConnection(
>>>> "jdbc:postgresql://devo/sedb", "carlos", "" );
>>>> dbmd = connection.getMetaData();
>>>> String databaseProductName = dbmd.getDatabaseProductName();
>>>> String databaseProductVersion = dbmd.getDatabaseProductVersion();
>>>>
>>>> System.out.println(
>>>> "Database: " databaseProductName
>>>> "nVersion: " databaseProductVersion );
>>>>
>>>> printSchemas();
>>>> printCatalogs();
>>>> System.out.println(
>>>> "nFields for table: 'test'"
>>>> "nIDtTYPEtTYPNAMEtNAMEtLENtNULLABLE" );
>>>> ResultSet rs = dbmd.getColumns( "%", "%", "test", "%" );
>>>> while( rs.next() )
>>>> printField( rs );
>>>> rs.close();
>>>> }
>>>>
>>>>
>>>> //////////////////////////////////////////////// ////////////
>>>> public void printField( ResultSet rs )
>>>> throws SQLException
>>>> {
>>>> System.out.println(
>>>> rs.getInt( 17 ) "t" rs.getInt( 5 ) "t"
>>>> rs.getString( 6 ) "t" rs.getInt( 7 ) "t"
>>>> rs.getString( 18 ) );
>>>> }
>>>>
>>>> //////////////////////////////////////////////// ////////////
>>>> public void printSchemas()
>>>> throws SQLException
>>>> {
>>>> System.out.println( "nn schemas:" );
>>>> ResultSet rs = dbmd.getSchemas();
>>>> while ( rs.next() )
>>>> System.out.println( rs.getString( 1 ) );
>>>> rs.close();
>>>> }
>>>>
>>>> //////////////////////////////////////////////// ////////////
>>>> public void printCatalogs()
>>>> throws SQLException
>>>> {
>>>> System.out.println( "nn catalogs:" );
>>>> ResultSet rs = dbmd.getCatalogs();
>>>> while ( rs.next() )
>>>> System.out.println( rs.getString( 1 ) );
>>>> rs.close();
>>>> }
>>>>
>>>> //////////////////////////////////////////////// ////////////
>>>> public static void main( String[] args )
>>>> {
>>>> try
>>>> {
>>>> new DbTester();
>>>> }
>>>> catch( Exception e )
>>>> {
>>>> System.out.println( e.getMessage() );
>>>> e.printStackTrace();
>>>> }
>>>> }
>>>>
>>>> }
>>>>
>>>> best Regards,
>>>>
>>>> Carlos Correia
>>>>
>>>>
>>>>
>>>> ---------------------------(end of
>>>> broadcast)---------------------------
>>>> TIP 3: if posting/reading through Usenet, please send an appropriate
>>>> subscribe-nomail command to majordomo@postgresql.org so that your
>>>> message can get through to the mailing list cleanly
>>>>
>>>
>>>
>>
>>
>>
>>
>> ---------------------------(end of broadcast)---------------------------
>> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
>>
>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/users-lounge/docs/faq.html
>


--
Fernando Nasser
Red Hat Canada Ltd.                     E-Mail:  fnasser@redhat.com
2323 Yonge Street, Suite #300
Toronto, Ontario   M4P 2C9


pgsql-jdbc by date:

Previous
From: Carlos Correia
Date:
Subject: Re: Strange behaviour of JDBC driver for PostgreSQL
Next
From: Carlos Correia
Date:
Subject: Re: Strange behaviour of JDBC driver for PostgreSQL