MiluDB Viewer (GUI DB client using JavaFX) I forgot what I made when I made it, so make a note of it.
This time, it is about SQL to get the schema list.
Oracle - 12c Release2
select distinct owner from all_objects order by owner
MySQL - 8.0.11
select schema_name from information_schema.schemata order by schema_name
PostgreSQL - 10.4
select schema_name from information_schema.schemata order by schema_name
SQLServer - 2017
select name from sys.schemas order by name
Cassandra - 3.9.0
select keyspace_name, durable_writes from system_schema.keyspaces
As I learned later, if JDBC implements it, In the getSchemas () method of java.sql.DatabaseMeataData, Since java.sql.ResultSet is returned, You can get it with resultset.getString ("TABLE_SCHEM").
Reference URL http://www.java2s.com/Tutorial/Java/0340__Database/GettableinformationfromDatabaseMetaData.htm
Recommended Posts