RE: ResultSetMetaData problems (getColumnType() and -TypeName)

From: Þórhallur Hálfdánarson <tolli(at)margmidlun(dot)is>
To: "'Peter Mount'" <petermount(at)it(dot)maidstone(dot)gov(dot)uk>
Cc: "'pgsql-interfaces(at)postgresql(dot)org'" <pgsql-interfaces(at)postgresql(dot)org>
Subject: RE: ResultSetMetaData problems (getColumnType() and -TypeName)
Date: 2000-07-19 14:04:32
Message-ID: B0D96BEDD558D411ACB200105AD7EAE90A8809@GEMINI
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

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(at)it(dot)maidstone(dot)gov(dot)uk]
> Sent: 19. júlí 2000 06:36
> To: 'Þórhallur Hálfdánarson'; 'pgsql-interfaces(at)postgresql(dot)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(at)margmidlun(dot)is]
> Sent: Tuesday, July 18, 2000 5:21 PM
> To: 'pgsql-interfaces(at)postgresql(dot)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(at)margmidlun(dot)is
>

Browse pgsql-interfaces by date

  From Date Subject
Next Message Peter Mount 2000-07-19 14:10:39 RE: ResultSetMetaData problems (getColumnType() and -TypeName)
Previous Message brucecphsu 2000-07-19 08:24:33 JDBC rs.getString() encoding problem