Please send your Questions & Answers or Feedback to ""

How do I check what table types exist in a database?

Use the getTableTypes method of interface java.sql.DatabaseMetaData to probe the database for table

types. The exact usage is described in the code below.

public static void main(String[] args) throws Exception

{ // Load the database driver -

in this case, we

// use the Jdbc/Odbc bridge driver.


// Open a connection to the database

Connection conn = DriverManager.getConnection("[jdbcURL]",

"[login]", "[passwd]");

// Get DatabaseMetaData

DatabaseMetaData dbmd = conn.getMetaData();

// Get all table types.

ResultSet rs = dbmd.getTableTypes();

// Printout table data


{ // Printout

System.out.println("Type: " + rs.getString(1));


// Close database resources




Related Posts Plugin for WordPress, Blogger...
Flag Counter