DataBaseUtils class

1, the static value used

PropertiesExtractor class

(obtain the value of application. Propreties) Reference: juejin.cn/post/699286…

2. Obtain the database link

DriverManager.getConnection

Used to establish a database connection

3. Close the database link

4, obtain all table names under the database

DatabaseMetaData class

The metadata of the database, everything

The ResultSet class

A table representing a database result set, iterated objects, used with while

resultSet.getString

Obtain the table name: fixed parameter 3

resultSet.getString(3)
Copy the code

5. Obtain the metadata of a table

PreparedStatement class

By connection. PrepareStatement for sending parameterized SQL statements to the database

The ResultSetMetaData class

By the preparedStatement for getMetaData gain, can be used to obtain the relevant columns in a ResultSet object types and attributes information of objects (metadata) to obtain a list of a

Select * from table where all fields are listed

Select * from table where all field types are located

8, get all field comments in table

9, unified access to database table information (combined with the above method)

TableInfo class, ColumnInfo class

Custom class used to store table information

Testing: