Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Oracle Lite JDBC trouble getting column names
I am having trouble retrieving the names of the columns of a table using JDBC. I am using Oracle Lite 3.0.624 and it's provided JDBC driver and executing under VC4Java 2.5a (jdk1.1.5 I think).
I am using almost the same code to fetch the Schema names and Table names without any apparent difficulty. However, when I go to get the column name using rset.getString(4), the application core dumps.
Can you see what the problem is? Is there a better way to code this?
Thanks,
Gerald
Code snippet:
...
Vector vect = new Vector(); String cname = ""; s = schema; t = table;Received on Mon Oct 26 1998 - 00:00:00 CST
...
ResultSet rset = dbMeta.getColumns(null, s, t, null); do { try { cname = new String(rset.getString(4)); // 4=column name } catch (SQLException ex) { System.err.println("Error getting column name\n" + ex); } if (cname.length() > 0) { vect.addElement(cname); System.err.println("Column: " + cname); } } while (rset.next()); rset.close(); return vect;