Revision: 8321
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at September 13, 2008 12:33 by balbuenac
Initial Code
/** * OdbcFlatListTables.java * Copyright (c) 2007 by Dr. Herong Yang. All rights reserved. */ import java.sql.*; public class OdbcFlatListTables { public static void main(String [] args) { Connection con = null; try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); con = DriverManager.getConnection("jdbc:odbc:HY_FLAT"); DatabaseMetaData meta = con.getMetaData(); ResultSet res = meta.getTables(null, null, null, new String[] {"TABLE"}); System.out.println("List of tables: "); while (res.next()) { System.out.println( " "+res.getString("TABLE_CAT") + ", "+res.getString("TABLE_SCHEM") + ", "+res.getString("TABLE_NAME") + ", "+res.getString("TABLE_TYPE") + ", "+res.getString("REMARKS")); } res.close(); con.close(); } catch (Exception e) { System.err.println("Exception: "+e.getMessage()); } } }
Initial URL
http://www.herongyang.com/jdbc/JDBC-ODBC-Flat-File-List-Tables.html
Initial Description
Initial Title
Get Tables Lista using JDBC
Initial Tags
Initial Language
Java