Dynamic getXXX and setXXX methods
843854Dec 13 2002 — edited Dec 16 2002Has anyone ever dynamically created and called a statement like this?:
int first = rset.getInt(1);
- or -
insertStmt.setString(2, second);
I am working on a Java program that has to dynamically build a select statement based on the number of columns in the table (which is passed in). However, the problem is I can't hardcode the individual getXXX and setXXX calls because I will not know the column types beforehand(I have their names stored in an array that is generated). I was wondering if anyone has done something like this. Any help would be appreciated!
Thanks,
Jon