From: | Carlos Correia <carlos(at)m16e(dot)com> |
---|---|
To: | 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 14:56:07 |
Message-ID: | 3E008C87.90506@m16e.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
Dave Cramer wrote:
>Carlos,
>
>Is this a new message today, or one from yesterday?
>
>
Dave,
It is the same messge, but as I think that everyone is misunderstooding
the problem, I'll try to resume it:
1. I don't know why the driver reports version 6.5.2, as I don't have
such a version.
2. The only installation I have is of version 7.2.2 (at least that's
what the output of 'select version()' says).
3. The problem: when I run the program on another machine of the same
network, it has this strange behaviour (reporting version 6.5.2 and
crashing when I invoke 'getColumns()' on DatabaseMetaData object).
Carlos Correia
>>>>>==================================
>>>>>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
>>>>>
>>>>>
>>>>>
>>>>>
From | Date | Subject | |
---|---|---|---|
Next Message | Fernando Nasser | 2002-12-18 15:13:39 | Re: Strange behaviour of JDBC driver for PostgreSQL |
Previous Message | Carlos Correia | 2002-12-18 13:23:15 | Re: Strange behaviour of JDBC driver for PostgreSQL |