Re: obtain column names in oracle via jdbc

From: Yong <yhuang_at_indigopool.com>
Date: Mon, 14 Aug 2000 15:41:24 -0500
Message-ID: <8n9ln4$sq2$1_at_news.sinet.slb.com>


Why not select column_name from user_tab_columns where table_name = 'MYTABE'? You need to be granted SELECT_CATALOG_ROLE or select any table privilege/role to do so.

Yong Huang

<a7244270_at_my-deja.com> wrote in message news:8mnc45$oto$1_at_nnrp1.deja.com...
> Hi,
>
> I am trying to find out what the columns in a given table are.
>
> For some reason, the Oracle jdbc driver keeps telling me
>
> > Exception java.sql.SQLException: ORA-00900: invalid SQL statement
>
> which is obviously not true.
>
> Does anyone out there have any clue how can I do this ?
>
> Alfonso.
>
>
>
>
>
> java.sql.Connection connection = pool.get();
> ResultSet rs = null;
> connection = pool.get();
>
> Statement stmt = connection.createStatement();
>
>
> String command = "describe xyz";
> rs = stmt.executeQuery( command );
> if ( rs.next() )
> {
> System.out.println("Col #1: " + rs.getString(1));
> }
> pool.release(connection);
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
Received on Mon Aug 14 2000 - 22:41:24 CEST

Original text of this message