I’m working on a Java GUI project; in one of its property screen I use 3 comboboxes in order to get: first user chooses DB name, with this value 2.Schema names and with this all table names under that schema. It’s OK when I use ResultSet when getting the values from DB and setting them. But with this way, I could only bring ONE value because you know the way ResultSet works. So is there any other way that I could fetch all the table names with let’s say:
SELECT TABLE_NAME FROM ALL_TABLES; and put them on an array of Strings or sth… Anything possible, I just wanna have their names in a list or anything.
Thank you.
EDIT:
Here’s the simple code tested for the purpose:
ResultSet rs = null;
PreparedStatement ps = null;
String result;
ps = conn.prepareStatement("SELECT TABLE_NAME FROM ALL_TABLES");
rs = ps.executeQuery();
while(rs.next())
{
result = rs.getString(1);
System.out.println(rs.getString(1));
}
Not sure what you mean by ‘you know the way resultset works’?! This will return all the rows from the query: