File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
JDBC and Relational Databases
How to get the table column names
Mathews P Srampikal
Joined: Nov 26, 2002
Oct 13, 2003 00:50:00
How to get table column name using ResultsetMetadata if there is no record present in the table.Thanks
Joined: Jan 23, 2002
Oct 13, 2003 06:35:00
I don't think having an empty resultset prevents you from accessing the ResultSetMetaData object. Have you tried it?
Effective Unit Testing
Joined: Aug 18, 2003
Oct 13, 2003 08:07:00
You can get the column names from ResultSetMetaData even if your resultset is empty. For example if your quey is
select * from table_a where 1 = 2
Still you will be able to get column names from the corresponding ResultSetMetaData.
I agree. Here's the link:
subject: How to get the table column names
problem simply stated
Autoresizing table column
Retrieve MySQL table column names
Getting column names from the table name
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015