From: | Fernando Nasser <fnasser(at)redhat(dot)com> |
---|---|
To: | Carlos Correia <carlos(at)m16e(dot)com> |
Cc: | Dave Cramer <Dave(at)micro-automation(dot)net>, "pgsql-jdbc(at)postgresql(dot)org" <pgsql-jdbc(at)postgresql(dot)org> |
Subject: | Re: Strange behaviour of JDBC driver for PostgreSQL |
Date: | 2002-12-18 15:13:39 |
Message-ID: | 3E0090A3.1060401@redhat.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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(at)postgresql(dot)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(at)postgresql(dot)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(at)redhat(dot)com
2323 Yonge Street, Suite #300
Toronto, Ontario M4P 2C9
From | Date | Subject | |
---|---|---|---|
Next Message | Fernando Nasser | 2002-12-18 16:28:51 | Re: Strange behaviour of JDBC driver for PostgreSQL |
Previous Message | Carlos Correia | 2002-12-18 14:56:07 | Re: Strange behaviour of JDBC driver for PostgreSQL |