• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

STORING Resultset in String variable

 
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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:odbc:Driver={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"));
}
 
Ranch Hand
Posts: 1325
Android Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
I RELEASE YOU! (for now .... ) Feel free to peruse this tiny ad:
New web page for Paul's Rocket Mass Heaters movies
https://coderanch.com/t/785239/web-page-Paul-Rocket-Mass
reply
    Bookmark Topic Watch Topic
  • New Topic