db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Barnet Wagman <b.wag...@comcast.net>
Subject Re: Equivlent to MySQL DESCRIBE statement?
Date Fri, 11 Feb 2005 08:50:25 GMT
The jdbc has facilities for determining structures of tables; see 
java.sql.MetaData
E.g. to get field types

                        DatabaseMetaData meta = con.getMetaData();
            ResultSet rc = meta.getColumns(null, null, tableName, "%");
            ArrayList names = new ArrayList();
            while ( rc.next() ) {
                names.add(rc.getString(5)); // 5 = DATA_TYPE
            }

MySQL's DESCRIBE is easier, of course, but I've managed to get 
everything I need from MetaData


bw


Mime
View raw message