Domanjit, I believe you mean the "getMetaData()" method in the Connection interface -- which returns a DatabaseMetaData object. Then you can use the "getTables()" method.
Good Luck, Avi.
Damanjit Kaur
Ranch Hand
Joined: Oct 18, 2004
Posts: 346
posted
0
No,
I meant the ResultSetMetaData whose method getTableName(int column) can be used. With DatabaseMetaData-getTables() method, one needs to have prior information about its various parameters.
omar bili
Ranch Hand
Joined: Aug 13, 2004
Posts: 177
posted
0
Hi guys and thanks for your time you have been very helpful my application is working now the code:
the Vector tables contains the names of the tables in my DB, this example worked on mysql on access an exception was thrown. againg thanks for the Help Best Regards, Omar
Damanjit, The "getTable()" method is not supported by some JDBC drivers -- since it is not always easy to figure out what table a column in a "ResultSet" belongs to. However, "DatabaseMetaData" works with the data-dictionary, and nearly all databases have a data-dictionary. So "DatabaseMetaData" is nearly always guaranteed to provide a list of database tables.
I believe Omar said that he required a list of all the database tables. In order to get a "ResultSetMetaData" object, you first require a "ResultSet" object. And in order to get a "ResultSet", you need to perform a query. Please tell me what query needs to be performed, in order to obtain the list of all database tables -- using "ResultSetMetaData"? (Or am I missing something?)