Re: Strange behaviour of JDBC driver for PostgreSQL

Поиск
Список
Период
Сортировка
От Carlos Correia
Тема Re: Strange behaviour of JDBC driver for PostgreSQL
Дата
Msg-id 3E0076C3.7000500@m16e.com
обсуждение исходный текст
Ответ на Strange behaviour of JDBC driver for PostgreSQL  (Carlos Correia <carlos@m16e.com>)
Список pgsql-jdbc
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).

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
>




В списке pgsql-jdbc по дате отправления:

Предыдущее
От: "Remigius Stalder"
Дата:
Сообщение: Re: What is "objsubid"?
Следующее
От: Fernando Nasser
Дата:
Сообщение: Re: Strange behaviour of JDBC driver for PostgreSQL