RE: ResultSetMetaData problems (getColumnType() and -TypeName) - Mailing list pgsql-interfaces

From Peter Mount
Subject RE: ResultSetMetaData problems (getColumnType() and -TypeName)
Date
Msg-id 1B3D5E532D18D311861A00600865478CF1B10D@exchange1.nt.maidstone.gov.uk
Whole thread Raw
Responses RE: ResultSetMetaData problems (getColumnType() and -TypeName)
List pgsql-interfaces
Hmmm, I'll have to check the spec. This does sound like a special case senario - should a ResultSetMetaData object be returned on an empty ResultSet? Should an SQLException be thrown instead?
 
I'll look into it.
 
Peter

--
Peter Mount
Enterprise Support
Maidstone Borough Council
Any views stated are my own, and not those of Maidstone Borough Council

-----Original Message-----
From: Þórhallur Hálfdánarson [mailto:tolli@margmidlun.is]
Sent: Wednesday, July 19, 2000 3:05 PM
To: 'Peter Mount'
Cc: 'pgsql-interfaces@postgresql.org'
Subject: RE: [INTERFACES] ResultSetMetaData problems (getColumnType() and -TypeName)

Me stupid. :-)

There were no rows returned. I didn't even think about that, I took it for granted that this would be possible.

Is there any change that this will not be needed in future releases ?

Regards,
Tolli

> -----Original Message-----
> From: Peter Mount [mailto:petermount@it.maidstone.gov.uk]
> Sent: 19. júlí 2000 06:36
> To: 'Þórhallur Hálfdánarson'; 'pgsql-interfaces@postgresql.org'
> Subject: RE: [INTERFACES] ResultSetMetaData problems (getColumnType()
> and -TypeName)
>
>
> Can you run this with debugging enabled on the connection please?
>
> ie: After connecting issue the line:
>         DriverManager.setLogStream(System.err);
>
> Ignore the compiler warning.
>
> The problem you have is that Field issues a small query to fetch the
> Column's name from pg_type and this query is failing. The
> output of the log
> may help see why this query is failing.
>
> Thanks, Peter
> --
> Peter Mount
> Enterprise Support
> Maidstone Borough Council
> Any views stated are my own, and not those of Maidstone
> Borough Council
> -----Original Message-----
> From: Þórhallur Hálfdánarson [mailto:tolli@margmidlun.is]
> Sent: Tuesday, July 18, 2000 5:21 PM
> To: 'pgsql-interfaces@postgresql.org'
> Subject: [INTERFACES] ResultSetMetaData problems (getColumnType() and
> -TypeName)
>
>
> Hi
> I've seen some postings on this subject since ages ago. The
> code and the
> output pretty much says what there has to be said (there was
> as example
> similar to this code somewhere). Sorry for the Icelandic, though. :-)
> <code>
> int iFjoldi = rsmd.getColumnCount();
> System.out.println("Fjöldi dálka í töflunni sjálfri: "+ iFjoldi);
> for (int i=1; i <= iFjoldi; i++)
> {
>         System.out.println("Dálkur "+ i);
>         try
>         {
>                 rsmd = rs.getMetaData();
>                 System.out.println("Dálkur "+ i +": "+
> rsmd.getColumnType(i));
>                 System.out.println("Dálkur "+ i +": "+
> rsmd.getColumnTypeName(i));
>                 System.out.println("Ég er gimp");
>         }
>         catch (SQLException e)
>         {
>                 System.out.println("Fönky SQL Exception: "+
> e.toString());
>         }
>         catch (Exception e)
>         {
>                 System.out.println("Fönky Exception: "+
> e.toString());
>                 e.printStackTrace();
>         }
> }
> </code>
> <output>
> Fjöldi dálka í töflunni sjálfri: 4
> Dálkur 1
> Fönky Exception: java.lang.NullPointerException:
> java.lang.NullPointerException:
>         at org.postgresql.Connection.ExecSQL(Connection.java:312)
>         at org.postgresql.Field.getSQLType(Field.java:79)
>         at
> org.postgresql.jdbc2.ResultSetMetaData.getColumnType(ResultSet
> MetaData.java:
> 363)
>         at
> com.margmidlun.LIN.Upplysingakerfi.Importer.go(Importer.java:132)
>
>         at Gagnagaur.main(Gagnagaur.java:13)
> Dálkur 2
> Fönky Exception: java.lang.NullPointerException:
> java.lang.NullPointerException:
>         at org.postgresql.Connection.ExecSQL(Connection.java:312)
>         at org.postgresql.Field.getSQLType(Field.java:79)
>         at
> org.postgresql.jdbc2.ResultSetMetaData.getColumnType(ResultSet
> MetaData.java:
> 363)
>         at
> com.margmidlun.LIN.Upplysingakerfi.Importer.go(Importer.java:132)
>
>         at Gagnagaur.main(Gagnagaur.java:13)
> Dálkur 3
> Fönky Exception: java.lang.NullPointerException:
> java.lang.NullPointerException:
>         at org.postgresql.Connection.ExecSQL(Connection.java:312)
>         at org.postgresql.Field.getSQLType(Field.java:79)
>         at
> org.postgresql.jdbc2.ResultSetMetaData.getColumnType(ResultSet
> MetaData.java:
> 363)
>         at
> com.margmidlun.LIN.Upplysingakerfi.Importer.go(Importer.java:132)
>
>         at Gagnagaur.main(Gagnagaur.java:13)
> Dálkur 4
> Fönky Exception: java.lang.NullPointerException:
> java.lang.NullPointerException:
>         at org.postgresql.Connection.ExecSQL(Connection.java:312)
>         at org.postgresql.Field.getSQLType(Field.java:79)
>         at
> org.postgresql.jdbc2.ResultSetMetaData.getColumnType(ResultSet
> MetaData.java:
> 363)
>         at
> com.margmidlun.LIN.Upplysingakerfi.Importer.go(Importer.java:132)
>
>         at Gagnagaur.main(Gagnagaur.java:13)
> </output>
>
>
> The same has shown up on setups:
> Setup A)
>   Machine S)
>     RedHat Linux 6.0
>     PostgreSQL 6.5.1 (with JDBC, other stuff working fine)
>   Machine J)
>     RedHat Linux 6.1
>      Sun JDK:
>       java version "1.2.2"
>       Classic VM (build 1.2.2-L, green threads, nojit)
>     jdbc6.5-1.2.jar
> Setup B)
>   Machine T)
>     RedHat Linux 6.2
>     PostgreSQL 7.0.2
>       $ rpm -qa |grep postgres
>       postgresql-jdbc-7.0.2-2
>       postgresql-odbc-7.0.2-2
>       postgresql-7.0.2-2
>       postgresql-server-7.0.2-2
>       postgresql-devel-7.0.2-2
>     Sun JDK
>
>
>
> Now.... do you have any tips ?
>
>
> Regards,
> Tolli
> tolli@margmidlun.is
>

pgsql-interfaces by date:

Previous
From: Þórhallur Hálfdánarson
Date:
Subject: RE: ResultSetMetaData problems (getColumnType() and -TypeName)
Next
From: Bob Kline
Date:
Subject: RE: ResultSetMetaData problems (getColumnType() and -TypeName)