Getting column names

Hi all,

I need to validate request.getParameterNames() against the actual fields in a particular table but I can't figure out how to query the DB for just the field names...

SHOW columns FROM myTable; returns too much junk...I just need the field(column) names.

There must be an SQL statement which would accomplish this huh?

Any suggestions?

In case it makes any difference, I'm using mysql.

TIA,

Brad

[460 byte] By [brads] at [2007-9-26 7:06:52]
# 1
Use an SQL like "Select * from TableName where 1=0" that will return zero records, and make a ResultSet from it. Then you can get a ResultSetMetaData object from that with the information you need.
DrClap at 2007-7-1 16:47:12 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 2
Bitchen, thanks Doc!Brad
brads at 2007-7-1 16:47:12 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 3
where 1=0 is brilliant, DrClap!
ashutosh at 2007-7-1 16:47:12 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 4
Or DatabaseMetaData.getColumns().
kent_haidl at 2007-7-1 16:47:12 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...