Am 28.07.2011 11:03, schrieb Knut Anders Hatlen:
Spezifikum<[email protected]> 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,
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
Hi Knut,
thanks a lot, it works! As a first quick test i used:
DatabaseMetaData dmd = conn.getMetaData( );
ResultSet cols = dmd.getColumns( null, "MyDB", "MYTABLE",
null );
while( cols.next() ) {
String value = cols.getString( 1 );
System.out.println( value );
...
}
I wouldn't have found the DatabaseMetaData class without some help, so
just thanks again.
Malte