Java DatabaseMetaData

JDBC provides the DatabaseMetaData interface, which can be used to obtain database-wide information, and also mentions the ResultsetMetaData interface. It is used to obtain specific ResultSet information, such as the number of columns and column names.
The Connection interface is used to establish a connection with the database. The execution of SQL statements and the return of results are performed in a connected environment. The connection also provides access to database metadata information, which describes the performance of the database. Supported SQL syntax, stored processes, etc. To get a DatabaseMetaData instance of the database, you can use the getMetaData method of the connection object as follows:

DatabaseMetaData dbMetaData = connection. GetMetaDataO;
DatabaseMetaData can get the url, user name, database name, version and other information of the connected database

Where
public java.sql.ResultSet getTables (java.lang.String catalog,
java.lang.String schema,
java.lang.String table,
java.lang.String [] types)
catalog contains the String of the catalog name. Provide a Null value for this parameter to indicate that no directory name is required.

schema contains the String value of the schema name schema. Providing a Null value for this parameter indicates that no schema name is required.

tableName String containing the table name pattern.

types contains a string array of table types to be included. Null indicates that all table types should be included.

Return result set

TABLE_CAT String The name of the database where the specified table is located.

TABLE_SCHEM String The name of the table schema.

TABLE_NAME String The name of the table.

TABLE_TYPE String Table type.

REMARKS String Table description. Note: SQL Server does not return a value for this column.
TYPE_CAT String The JDBC driver does not support this type.
TYPE_SCHEM String The JDBC driver does not support this type.
TYPE_NAME String The JDBC driver does not support this type.
SELF_REFERENCING_COL_NAME StringJDBC driver does not support this type.
REF_GENERATION String The JDBC driver does not support this type.
Reference to

Published 167 original articles · Like 16 · Visits 30,000+

Guess you like

Origin blog.csdn.net/feiqipengcheng/article/details/105443793