File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes STORING Resultset in String variable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "STORING Resultset in String variable" Watch "STORING Resultset in String variable" New topic

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

Connection con;
String myDB ="jdbcdbcriver={Microsoft Access Driver(*.mdb)};DBQ=C:/UNIVERSITY_MOBILE_GUIDE_NAVIGATION_SYSTEM/Mobile_Guide.MDB;

Statement statement = con.createStatement();

DatabaseMetaData dbm = con.getMetaData();
ResultSet rs = dbm.getTables(null,null,null,null);

while (
Muhammad Saifuddin
Ranch Hand

Joined: Dec 06, 2005
Posts: 1323

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.

[Blog][Linkedin] How To Ask Questions On JavaRanch My OpenSource
I agree. Here's the link:
subject: STORING Resultset in String variable
It's not a secret anymore!