Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

How do I check what table-like database objects (table, view, temporary table, alias) are present in a particular database?

0
Posted

How do I check what table-like database objects (table, view, temporary table, alias) are present in a particular database?

0

Location: http://www.jguru.com/faq/view.jsp?EID=1181 Created: Nov 21, 1999 Author: Lennart Jorelid (http://www.jguru.com/guru/viewbio.jsp?EID=15) Use java.sql.DatabaseMetaData to probe the database for metadata. Use the getTables method to retrieve information about all database objects (i.e. tables, views, system tables, temporary global or local tables or aliases). The exact usage is described in the code below. NOTE! Certain JDBC drivers throw IllegalCursorStateExceptions when you try to access fields in the ResultSet in the wrong order (i.e. not consecutively). Thus, you should not change the order in which you retrieve the metadata from the ResultSet. public static void main(String[] args) throws Exception { // Load the database driver – in this case, we // use the Jdbc/Odbc bridge driver. Class.forName(“sun.jdbc.odbc.JdbcOdbcDriver”); // Open a connection to the database Connection conn = DriverManager.getConnection(“[jdbcURL]”, “[login]”, “[passwd]”); // Get DatabaseMetaData Dat

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123