db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Knut Anders Hatlen <knut.hat...@oracle.com>
Subject Re: Getting the table structure programmatically
Date Thu, 28 Jul 2011 09:03:20 GMT
Spezifikum <info@spezifikum.com> writes:

> Hi
> i have to read the structure of some tables i created and display that
> in my HTML pages. So i tried to do something like
> execute( "describe myTable" ) and get an SQL exception (invalid syntax).
> Should i instead query some system tables?

Hi Malte,

The DESCRIBE syntax is only understood by the ij tool, and not available
via SQL or JDBC. It is however implemented on top of
DatabaseMetaData.getColumns(). Essentially, it just calls
conn.getMetaData().getColumns(null, schema, table, null) and displays
the following columns from the returned ResultSet: TABLE_SCHEM,
TABLE_NAME, COLUMN_NAME, TYPE_NAME, DECIMAL_DIGITS, NUM_PREC_RADIX,
COLUMN_SIZE, COLUMN_DEF, CHAR_OCTET_LENGTH, IS_NULLABLE

-- 
Knut Anders

Mime
View raw message