| Author |
dynamic column names and it's values
|
Edward Durai
Ranch Hand
Joined: Oct 09, 2004
Posts: 223
|
|
Consider I have a table Name, It's dynamic table. Column Names or it's data type is changable. It contains lot of column names with different data type. How can I fetch all the rows in the Database. if first column field type is date, then I have to use rs.getDate(1); // if it is String rs.getString(1); But in my situation, It's dynamic table. Column Names or it's data type is changable. Then How can I fetch all the rows? Please explain.
|
Thank You<br />Edward
|
 |
Jeanne Boyarsky
internet detective
Marshal
Joined: May 26, 2003
Posts: 26499
|
|
Edward, You can always fetch all columns as Strings is you don't need them formatted in a certain way. The alternative is to use the result set meta data API to determine the specific data types.
|
[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
|
 |
steve souza
Ranch Hand
Joined: Jun 26, 2002
Posts: 852
|
|
The getObject method returns the data and doesn't convert it to a String. This is useful should you ever need to manipulate the data in its original form via casting. http://java.sun.com/j2se/1.4.2/docs/api/java/sql/ResultSet.html#getObject(int)
|
http://www.jamonapi.com/ - a fast, free open source performance tuning api.
JavaRanch Performance FAQ
|
 |
 |
|
|
subject: dynamic column names and it's values
|
|
|