List of usage examples for java.sql DatabaseMetaData getConnection
Connection getConnection() throws SQLException;
From source file:org.xenei.bloomgraph.bloom.sql.MySQLCommands.java
/** * Create the page stats table./* w w w . j a v a2 s.c om*/ * * @param metadata * the metadata for the database. * @throws SQLException * on error */ private void createPageStatsTable(final DatabaseMetaData metadata) throws SQLException { ResultSet rs = null; Statement stmt = null; final Connection connection = metadata.getConnection(); try { rs = metadata.getTables(connection.getCatalog(), connection.getSchema(), getPageStatsTableName(), new String[] { "TABLE" }); if (!rs.next()) { stmt = connection.createStatement(); stmt.execute( "CREATE TABLE PageStats ( idx INT PRIMARY KEY, records INT, deletes INT, bytes INT ) ENGINE MyISAM"); } } finally { DbUtils.closeQuietly(rs); DbUtils.closeQuietly(stmt); } }