Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: JDBC and ResultSetMetaData

Re: JDBC and ResultSetMetaData

From: Avi Abrami <aabrami_at_intersystemsww.com>
Date: Wed, 18 Sep 2002 15:29:44 +0200
Message-ID: <3D887FC8.B99456C5@intersystemsww.com>


Jost Richstein wrote:
>
> "Avi Abrami" <aabrami_at_intersystemsww.com> schrieb im Newsbeitrag
> news:3D8702D5.19AA996E_at_intersystemsww.com...
> > Jost Richstein wrote:
> > >
> > > Hello,
> > >
> > > every now and then I get no result (a 'null'), when I try to read
> > > a column name from a ResultSetMetaData (metadata.getColumnName(i))
> > > using Oracle 8.1.7 Server and the thin JDBC-Driver with
> > > JDK1.3.1_04 (on Windows2000).
> > >
> > > Prior to that I read metaData.getColumnCount() and got the
> > > correct result for the given ResultSet, so that the index into
> > > getColumnName() is correct.
> > >
> > > What we can observe is:
> > >
> > > - that happens not alway
> > > - it happens not on special columns or column datatypes
> > > - it happens not on special queries
> > >
> > > Anybody any ideas?
> > >
> > > Jost
> >
> > Hi Jost,
> > I think (for me, anyway), it would help if you showed an
> > example query that demonstrates the problem, and the details
> > (version, etc.) of the JDBC driver you are using.
> >
> > Thanks,
> > Avi.
>
> Hi Avi,
>
> the part of our project where the problem occurs operates on an
> arbitrary resultset. Thats means, in our case, the underlying
> select-statement
> was executed with success.
>
> The part of the source code where it happens is (ResultSet is a correctly
> produced ResultSet, fields_ is an 'int', hashNames_ a 'Hashtable' ).
> The problem is: metaData.getColumnName(i) returns a Java 'null'
>
> - metaData.getColumnCount() returns the correct value
> - it happens every 50 or so times a (even the same) query is executed (and
> this method is called)
>
> private ResultCursor(ResultSet result) throws SQLException
> {
> ResultSetMetaData metaData = result.getMetaData();
> fields_ = metaData.getColumnCount();
> int types[] = new int[fields_];
> for(int i = 1; i <= fields_;i++)
> {
> hashNames_.put(metaData.getColumnName(i).toLowerCase(), new
> Integer(i));
> types[i-1] = metaData.getColumnType(i);
> }
> ...
> }
>
> We have tried all thin JDBC-Drivers we could get from Oracle for 8.1.7

Jost,
We seem to have a communication problem. I suppose you misunderstood my request. I did not ask to see your java code, I asked to see an example SQL query that demonstrates this problem.

Personally, I have never encountered a null return from method "ResultSetMetaData.getColumnName(int)".

Sorry I can't offer anything else.

Good Luck,
Avi. Received on Wed Sep 18 2002 - 08:29:44 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US