| Author |
STORING Resultset in String variable
|
Zaafir Barahim
Ranch Hand
Joined: Dec 12, 2006
Posts: 36
|
|
I have ben able to get the name of the tables i have in my database. this is the code but i cant store the name of the table in a String variable so as i can use the variable later. PLEASE HELP ME OUT!!! THANKS IN ADVANCE. This is the code for getting all the tables Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection con; String myDB ="jdbc dbc river={Microsoft Access Driver(*.mdb)};DBQ=C:/UNIVERSITY_MOBILE_GUIDE_NAVIGATION_SYSTEM/Mobile_Guide.MDB; con=DriverManager.getConnection(myDB,"",""); Statement statement = con.createStatement(); DatabaseMetaData dbm = con.getMetaData(); ResultSet rs = dbm.getTables(null,null,null,null); while (rs.next()) { System.out.println(rs.getString("TABLE_NAME")); }
|
 |
Muhammad Saifuddin
Ranch Hand
Joined: Dec 06, 2005
Posts: 1318
|
|
consider this example to know where the things going wrong in your code.. GetTable Example and also look at Java Doc for the signature of getTable method.
|
Saifuddin..
[Linkedin] How To Ask Questions On JavaRanch My OpenSource
|
 |
 |
|
|
subject: STORING Resultset in String variable
|
|
|