This content has been marked as final. Show 10 replies
Start explaining what rs is.
Something along the lines of rs.get + datatype+ (2) .You could do something like that by using reflection but I would really advice against that. It's a really bad design.
I know that doesnt work but thats what i want to do.
Its kinda of hard to explain.
rs is record selector for getting records from a database. Iam currently getting records from an access database. The getString, getInt just gets the colomun index from the tables in the database. But the (get)datatype has to match with the database datatype.
So... rs is a ResultSet?
sweet that seemed to work.
Does getObject take any data type?
Play around with getObject. For example, you may think it should return Integers
for some column type, but it may actually return BigIntegers. Your mileage may vary.
Does getObject take any data type?Almost. It depends on jdbc version and database. E.g old versions of jdbc and oracle won't be able to handle blob and clob.
Okay sounds good.
Thank for the help.
You need to use ResultSetMetaData.-It is an An object that can be used to get information about the types and properties of the columns in a ResultSet object.
Here is code-
Once you have ResultSet Object i.e -- rs
Now you can use it to get relevant information-for ex-
To get no. of column in result set Object----use
Or To get coulmn's databse specific type name ----use------