世界震撼.dev

いつか世界を驚かせるためのメモ

JDBCでテーブル一覧を取得

try(Connection conn = DriverManager.getConnection(url, user, password);
    ResultSet rs = conn.getMetaData().getTables(null, null, "%", null);
    ){
        final StringBuilder sb = new StringBuilder(  );
        while( rs.next( ) ){
            sb.append( rs.getString( 3 ) +"<br>" );
        }
        System.out.println( sb.toString( ) );
}