数据库查询返回结果集及其元数据信息 ResultSet 和 ResultSetMetaData

数据库连接的元数据信息:DatabaseMetaData databaseMetaData = connection.getMetaData (); 

数据库查询结果元数据信息:ResultSetMetaData resultSetMetaData = resultSet.getResultSetMetaData ();    


ResultSetMetaData 的详细方法介绍:

 

// 获取返回结果集的列数
int getColumnCount()



//如果catalog可用,返回指定列所属表对应的catalog的名称;如果catalog不可用,则返回空字符串。
//获取CatalogName名称(感觉像数据库名称)
String getCatalogName(int column)

//获取SchemaName名称(不知道是什么,为空)
String getSchemaName(int column)

//获取TableName名称(获取表名)
String getTableName(int column)



//获取ColumnName名称(获取列名)
String getColumnName(int column)

//获取ColumnLabel名称(获取列名别名)
String getColumnLabel(int column)

//获取ColumnClassName名称(获取列类型的java全限定名)
//例如(java.lang.Integer或java.lang.String或java.sql.Timestamp等)
String getColumnClassName(int column)

//获取ColumnTypeName名称(获取列类型的SQL类型名称)
//例如(INT或VARCHAR或DATETIME等)
String getColumnTypeName(int column)

//获取ColumnType名称(获取列类型的SQL类型名称对应ID【int】类型)
//例如(int对应4,varchar对应12,DATETIME对应93)
int getColumnType(int column)



//获取指定列的小数位数
int getPrecision(int column)

//获取指定列的小数点右边的位数
int getScale(int column)

//获取指定列的最大标准宽度,以字符为单位
int getColumnDisplaySize(int column)



//判断指定列是否自动进行编号
bool isAutoIncrement(int column)

//判断列的大小写是否有关系
bool isCaseSensitive(int column)

//判断指定列是否是一个哈希代码值
bool isCurrency(int column)

//判断在指定的列上进行写操作是否明确可以获得成功
bool isDefinitelyWritable(int column)

//判断指定列中的值是否可以为 null
bool isNullable(int column)

//判断指定的列是否明确不可写入【只读】
bool isReadOnly(int column)

//判断指定列是否可以在 where 子句中使用
bool isSearchable(int column)

//判断指定列中的值是否带正负号
bool isSigned(int column)

//判断在指定列上进行写操作是否可以获得成功
bool isWritable(int column)


例:JdbcTest 查看上述方法的返回值

JdbcTest.java

package com.imddysc.study.sqlmonitor.test;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.sql.Statement;

import javax.sql.DataSource;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.mysql.cj.jdbc.MysqlDataSource;

public class JdbcTest {

	private static Logger logger = LoggerFactory.getLogger(JdbcTest.class);
	
	public static DataSource createDataSource() {
		MysqlDataSource ds = new MysqlDataSource();
		ds.setURL("jdbc:mysql://192.168.10.132:3306/sqlmonitor?useUnicode=true&useSSL=false&characterEncoding=UTF-8&serverTimezone=UTC");
		ds.setUser("user");
		ds.setPassword("123456");
		return ds;
	}
	
	public static void main(String[] args) throws Exception {
		logger.info(" Main() ... ");
		JdbcTest.test1();
		JdbcTest.test2();
	}
	
	public static void test1() throws Exception {
		DataSource dataSource = JdbcTest.createDataSource();
		String sqlString = "select * from databaseinfo";
		String sql1String = "select id,jdbc_nickname,jdbc_driver_class_name,jdbc_url,jdbc_username,jdbc_password,create_time,update_time from databaseinfo";
		String sql2String = "select id as 'ID',jdbc_nickname as '数据库连接名称', jdbc_driver_class_name as '驱动名称', jdbc_url as 'JDBCURL', jdbc_username as '用户名', jdbc_password as '密码', create_time as '创建时间',update_time as '更新时间' from databaseinfo";
		ResultSet resultSet = dataSource.getConnection().createStatement().executeQuery(sql2String);
		ResultSetMetaData metadata = resultSet.getMetaData();
		logger.info("metadata.getColumnCount(): " + metadata.getColumnCount());
		
		int columnCount = 0;
		columnCount = metadata.getColumnCount();
		
		for(int i=1; i<= columnCount; i++ ) {
			logger.info("metadata.getCatalogName(" +i+ "): " + metadata.getCatalogName(i));
			logger.info("metadata.getSchemaName(" +i+ "): " + metadata.getSchemaName(i));
			logger.info("metadata.getTableName(" +i+ "): " + metadata.getTableName(i));
			
			logger.info("metadata.getColumnName(" +i+ "): " + metadata.getColumnName(i));
			logger.info("metadata.getColumnLabel(" +i+ "): " + metadata.getColumnLabel(i));
			logger.info("metadata.getColumnClassName(" +i+ "): " + metadata.getColumnClassName(i));
			logger.info("metadata.getColumnTypeName(" +i+ "): " + metadata.getColumnTypeName(i));
			logger.info("metadata.getColumnType(" +i+ "): " + metadata.getColumnType(i));
			
			logger.info("metadata.getPrecision(" +i+ "): " + metadata.getPrecision(i));
			logger.info("metadata.getScale(" +i+ "): " + metadata.getScale(i));
			logger.info("metadata.getColumnDisplaySize(" +i+ "): " + metadata.getColumnDisplaySize(i));
			
			logger.info("metadata.isAutoIncrement(" +i+ "): " + metadata.isAutoIncrement(i));
			logger.info("metadata.isCaseSensitive(" +i+ "): " + metadata.isCaseSensitive(i));
			logger.info("metadata.isCurrency(" +i+ "): " + metadata.isCurrency(i));
			logger.info("metadata.isDefinitelyWritable(" +i+ "): " + metadata.isDefinitelyWritable(i));
			logger.info("metadata.isNullable(" +i+ "): " + metadata.isNullable(i));
			logger.info("metadata.isReadOnly(" +i+ "): " + metadata.isReadOnly(i));
			logger.info("metadata.isSearchable(" +i+ "): " + metadata.isSearchable(i));
			logger.info("metadata.isSigned(" +i+ "): " + metadata.isSigned(i));
			logger.info("metadata.isWritable(" +i+ "): " + metadata.isWritable(i));
			logger.info("-------------------------------------------------------------\n");
		}
	}
	
	public static void test2() throws Exception {
		logger.info("test2() ... ");
		try {
			Class.forName("com.mysql.cj.jdbc.Driver");
		} catch (ClassNotFoundException e) {
			logger.info("加载驱动失败 ... ");
			e.printStackTrace();
		}
		Connection connection = null;
		try {
			connection = DriverManager.getConnection("jdbc:mysql://192.168.10.132:3306/sqlmonitor?useUnicode=true&useSSL=false&characterEncoding=UTF-8&serverTimezone=UTC","user","123456");
		} catch (SQLException e) {
			logger.info("创建连接失败 ... ");
			e.printStackTrace();
		}
		
		Statement st = connection.createStatement();
		ResultSet rs = st.executeQuery("select * from databaseinfo");
		while (rs.next()) {
			for (int i = 1; i <= 8; i++) {
				logger.info(rs.getString(i) + "\t");
			}
			logger.info("\n");
		}

	}
	
}

输出:

22:19:51.856 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest -  Main() ... 
22:19:52.582 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.getColumnCount(): 8
22:19:52.582 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.getCatalogName(1): sqlmonitor
22:19:52.582 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.getSchemaName(1): 
22:19:52.582 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.getTableName(1): databaseinfo
22:19:52.582 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.getColumnName(1): id
22:19:52.582 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.getColumnLabel(1): ID
22:19:52.583 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.getColumnClassName(1): java.lang.Integer
22:19:52.583 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.getColumnTypeName(1): INT
22:19:52.583 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.getColumnType(1): 4
22:19:52.583 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.getPrecision(1): 10
22:19:52.583 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.getScale(1): 0
22:19:52.583 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.getColumnDisplaySize(1): 10
22:19:52.583 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.isAutoIncrement(1): true
22:19:52.583 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.isCaseSensitive(1): false
22:19:52.583 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.isCurrency(1): false
22:19:52.583 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.isDefinitelyWritable(1): true
22:19:52.583 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.isNullable(1): 0
22:19:52.583 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.isReadOnly(1): false
22:19:52.583 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.isSearchable(1): true
22:19:52.583 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.isSigned(1): true
22:19:52.584 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.isWritable(1): true
22:19:52.584 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - -------------------------------------------------------------

22:19:52.584 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.getCatalogName(2): sqlmonitor
22:19:52.584 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.getSchemaName(2): 
22:19:52.584 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.getTableName(2): databaseinfo
22:19:52.584 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.getColumnName(2): jdbc_nickname
22:19:52.584 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.getColumnLabel(2): 数据库连接名称
22:19:52.584 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.getColumnClassName(2): java.lang.String
22:19:52.584 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.getColumnTypeName(2): VARCHAR
22:19:52.584 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.getColumnType(2): 12
22:19:52.584 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.getPrecision(2): 255
22:19:52.584 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.getScale(2): 0
22:19:52.584 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.getColumnDisplaySize(2): 255
22:19:52.584 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.isAutoIncrement(2): false
22:19:52.584 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.isCaseSensitive(2): false
22:19:52.584 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.isCurrency(2): false
22:19:52.584 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.isDefinitelyWritable(2): true
22:19:52.584 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.isNullable(2): 1
22:19:52.584 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.isReadOnly(2): false
22:19:52.584 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.isSearchable(2): true
22:19:52.584 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.isSigned(2): false
22:19:52.584 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.isWritable(2): true
22:19:52.584 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - -------------------------------------------------------------

22:19:52.584 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.getCatalogName(3): sqlmonitor
22:19:52.584 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.getSchemaName(3): 
22:19:52.584 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.getTableName(3): databaseinfo
22:19:52.584 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.getColumnName(3): jdbc_driver_class_name
22:19:52.584 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.getColumnLabel(3): 驱动名称
22:19:52.584 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.getColumnClassName(3): java.lang.String
22:19:52.584 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.getColumnTypeName(3): VARCHAR
22:19:52.584 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.getColumnType(3): 12
22:19:52.584 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.getPrecision(3): 255
22:19:52.584 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.getScale(3): 0
22:19:52.585 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.getColumnDisplaySize(3): 255
22:19:52.585 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.isAutoIncrement(3): false
22:19:52.585 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.isCaseSensitive(3): false
22:19:52.585 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.isCurrency(3): false
22:19:52.585 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.isDefinitelyWritable(3): true
22:19:52.585 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.isNullable(3): 1
22:19:52.585 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.isReadOnly(3): false
22:19:52.585 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.isSearchable(3): true
22:19:52.585 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.isSigned(3): false
22:19:52.585 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.isWritable(3): true
22:19:52.585 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - -------------------------------------------------------------

22:19:52.585 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.getCatalogName(4): sqlmonitor
22:19:52.585 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.getSchemaName(4): 
22:19:52.585 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.getTableName(4): databaseinfo
22:19:52.585 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.getColumnName(4): jdbc_url
22:19:52.585 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.getColumnLabel(4): JDBCURL
22:19:52.585 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.getColumnClassName(4): java.lang.String
22:19:52.585 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.getColumnTypeName(4): VARCHAR
22:19:52.585 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.getColumnType(4): 12
22:19:52.585 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.getPrecision(4): 255
22:19:52.585 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.getScale(4): 0
22:19:52.585 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.getColumnDisplaySize(4): 255
22:19:52.585 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.isAutoIncrement(4): false
22:19:52.585 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.isCaseSensitive(4): false
22:19:52.585 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.isCurrency(4): false
22:19:52.585 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.isDefinitelyWritable(4): true
22:19:52.585 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.isNullable(4): 1
22:19:52.585 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.isReadOnly(4): false
22:19:52.585 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.isSearchable(4): true
22:19:52.585 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.isSigned(4): false
22:19:52.585 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.isWritable(4): true
22:19:52.585 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - -------------------------------------------------------------

22:19:52.585 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.getCatalogName(5): sqlmonitor
22:19:52.585 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.getSchemaName(5): 
22:19:52.585 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.getTableName(5): databaseinfo
22:19:52.585 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.getColumnName(5): jdbc_username
22:19:52.585 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.getColumnLabel(5): 用户名
22:19:52.585 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.getColumnClassName(5): java.lang.String
22:19:52.585 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.getColumnTypeName(5): VARCHAR
22:19:52.585 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.getColumnType(5): 12
22:19:52.586 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.getPrecision(5): 255
22:19:52.586 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.getScale(5): 0
22:19:52.586 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.getColumnDisplaySize(5): 255
22:19:52.586 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.isAutoIncrement(5): false
22:19:52.586 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.isCaseSensitive(5): false
22:19:52.586 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.isCurrency(5): false
22:19:52.586 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.isDefinitelyWritable(5): true
22:19:52.586 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.isNullable(5): 1
22:19:52.586 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.isReadOnly(5): false
22:19:52.586 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.isSearchable(5): true
22:19:52.586 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.isSigned(5): false
22:19:52.586 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.isWritable(5): true
22:19:52.586 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - -------------------------------------------------------------

22:19:52.586 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.getCatalogName(6): sqlmonitor
22:19:52.586 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.getSchemaName(6): 
22:19:52.586 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.getTableName(6): databaseinfo
22:19:52.586 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.getColumnName(6): jdbc_password
22:19:52.586 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.getColumnLabel(6): 密码
22:19:52.586 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.getColumnClassName(6): java.lang.String
22:19:52.586 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.getColumnTypeName(6): VARCHAR
22:19:52.586 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.getColumnType(6): 12
22:19:52.586 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.getPrecision(6): 255
22:19:52.586 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.getScale(6): 0
22:19:52.586 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.getColumnDisplaySize(6): 255
22:19:52.586 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.isAutoIncrement(6): false
22:19:52.586 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.isCaseSensitive(6): false
22:19:52.586 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.isCurrency(6): false
22:19:52.586 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.isDefinitelyWritable(6): true
22:19:52.586 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.isNullable(6): 1
22:19:52.586 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.isReadOnly(6): false
22:19:52.586 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.isSearchable(6): true
22:19:52.586 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.isSigned(6): false
22:19:52.586 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.isWritable(6): true
22:19:52.586 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - -------------------------------------------------------------

22:19:52.587 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.getCatalogName(7): sqlmonitor
22:19:52.587 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.getSchemaName(7): 
22:19:52.587 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.getTableName(7): databaseinfo
22:19:52.587 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.getColumnName(7): create_time
22:19:52.587 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.getColumnLabel(7): 创建时间
22:19:52.587 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.getColumnClassName(7): java.sql.Timestamp
22:19:52.587 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.getColumnTypeName(7): DATETIME
22:19:52.587 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.getColumnType(7): 93
22:19:52.587 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.getPrecision(7): 19
22:19:52.587 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.getScale(7): 0
22:19:52.587 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.getColumnDisplaySize(7): 19
22:19:52.587 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.isAutoIncrement(7): false
22:19:52.587 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.isCaseSensitive(7): false
22:19:52.587 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.isCurrency(7): false
22:19:52.587 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.isDefinitelyWritable(7): true
22:19:52.587 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.isNullable(7): 1
22:19:52.587 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.isReadOnly(7): false
22:19:52.587 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.isSearchable(7): true
22:19:52.587 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.isSigned(7): false
22:19:52.587 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.isWritable(7): true
22:19:52.587 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - -------------------------------------------------------------

22:19:52.587 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.getCatalogName(8): sqlmonitor
22:19:52.587 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.getSchemaName(8): 
22:19:52.587 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.getTableName(8): databaseinfo
22:19:52.587 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.getColumnName(8): update_time
22:19:52.587 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.getColumnLabel(8): 更新时间
22:19:52.587 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.getColumnClassName(8): java.sql.Timestamp
22:19:52.587 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.getColumnTypeName(8): DATETIME
22:19:52.587 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.getColumnType(8): 93
22:19:52.587 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.getPrecision(8): 19
22:19:52.587 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.getScale(8): 0
22:19:52.587 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.getColumnDisplaySize(8): 19
22:19:52.587 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.isAutoIncrement(8): false
22:19:52.587 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.isCaseSensitive(8): false
22:19:52.587 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.isCurrency(8): false
22:19:52.587 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.isDefinitelyWritable(8): true
22:19:52.587 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.isNullable(8): 1
22:19:52.587 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.isReadOnly(8): false
22:19:52.587 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.isSearchable(8): true
22:19:52.587 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.isSigned(8): false
22:19:52.587 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - metadata.isWritable(8): true
22:19:52.587 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - -------------------------------------------------------------

22:19:52.587 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - test2() ... 
22:19:52.911 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - 1	
22:19:52.911 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - mainJdbc连接	
22:19:52.911 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - com.mysql.cj.jdbc.Driver	
22:19:52.911 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - jdbc:mysql://192.168.10.132:3306/sqlmonitor?useUnicode=true&useSSL=false&characterEncoding=UTF-8&serverTimezone=UTC	
22:19:52.911 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - user	
22:19:52.911 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - 123456	
22:19:52.913 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - 2021-01-11 16:40:24	
22:19:52.913 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - 2021-01-11 16:40:32	
22:19:52.913 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - 

22:19:52.914 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - 2	
22:19:52.914 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - mainJdbc连接2	
22:19:52.914 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - com.mysql.cj.jdbc.Driver	
22:19:52.914 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - jdbc:mysql://192.168.10.132:3306/sqlmonitor?useUnicode=true&useSSL=false&characterEncoding=UTF-8&serverTimezone=UTC	
22:19:52.914 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - user	
22:19:52.914 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - 123456	
22:19:52.914 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - 2021-01-11 16:41:05	
22:19:52.914 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest - 2021-01-11 16:41:09	
22:19:52.914 [main] INFO com.imddysc.study.sqlmonitor.test.JdbcTest -