JDBC连接串配置JDBC日志(DM8:达梦数据库)

DM8:达梦数据库JDBC连接串配置JDBC日志

  • 环境介绍
  • 1 Windows 环境程序配置
  • 2 Linux 环境程序配置

环境介绍

  • 在某些环境,需要开启JDBC日志,用于分析业务系统连接数据库遇到的异常问题
  • 配置JDBC日志后,程序重启生效

1 Windows 环境程序配置

jdbc:dm://192.168.100.50:5236?logLevel=all&logdir=D:\\apps\ApacheJmeter\jdbclog

2 Linux 环境程序配置

jdbc:dm://192.168.100.50:5236?logLevel=all&logdir=/home/dmdba/jdbclog
  • JDBC日志示例
[WARN  - 2023-09-12 16:57:39] tid:296 - [Thread Group 1-1] { conn-1 } setAttributes();  unsupported sessEncode:
[DEBUG - 2023-09-12 16:57:39] tid:296 - [Thread Group 1-1] try connect loop 0
[DEBUG - 2023-09-12 16:57:39] tid:296 - [Thread Group 1-1] { conn-1 } access();  CMD_STARTUP
[DEBUG - 2023-09-12 16:57:39] tid:296 - [Thread Group 1-1] { conn-1 } access();  CMD_LOGIN
[DEBUG - 2023-09-12 16:57:39] tid:296 - [Thread Group 1-1] try connect success [192.168.100.50:5236]
[INFO  - 2023-09-12 16:57:39] tid:296 - [Thread Group 1-1] { DmDriver@44976ceb } connect(DmProperties): conn-1, sessionID-0x7fb8e0011448;  [PARAMS]: {lastloginip=::ffff:192.168.100.177, svrstat=4, language=cn, globalserverseries=3, lastlogintime=2023-09-12 16:47:58, svrmode=0, dsccontrol=true, , backslashescape=false, clientuser=SYSDBA, localtimezone=480, host=192.168.100.50, logdir=D:\\apps\ApacheJmeter\jdbclog, loginwarningid=2, epgroup=192.168.100.50:5236=([192.168.100.50:5236 (NORMAL, OPEN, DSC CONTROL), sessions: 0]), lifetimeremainder=-1, gracetimeremainder=0, failedattempts=0, serverversion=8.1.3.12, clienthostname=192.168.100.50, url=jdbc:dm://192.168.100.50:5236?logLevel=all&logdir=D:\\apps\ApacheJmeter\jdbclog, applicationname=, instancename=DMSERVER, dbname=DAMENG, port=5236, loglevel=all, guid=4E80459C4E80459CA35E953C7841ABD7, user=SYSDBA};
[INFO  - 2023-09-12 16:57:39] tid:296 - [Thread Group 1-1] { conn-1 } isClosed(): false;
[DEBUG - 2023-09-12 16:57:39] tid:296 - [Thread Group 1-1] { conn-1 } access();  CMD_STMT_ALLOCATE
[INFO  - 2023-09-12 16:57:39] tid:296 - [Thread Group 1-1] { conn-1 } createStatement(): stmt-1, handle-0;
[DEBUG - 2023-09-12 16:57:39] tid:296 - [Thread Group 1-1] { conn-1 } access();  CMD_PREPARE
[SQL   - 2023-09-12 16:57:39] tid:296 - [Thread Group 1-1] { conn-1, stmt-1 } execute(String): true;  [PARAMS]: "SELECT 1;"; [USED TIME]: 0.9391ms;
[INFO  - 2023-09-12 16:57:39] tid:296 - [Thread Group 1-1] { conn-1, stmt-1 } close();
[INFO  - 2023-09-12 16:57:39] tid:296 - [Thread Group 1-1] { conn-1 } getAutoCommit(): true;
[INFO  - 2023-09-12 16:57:39] tid:296 - [Thread Group 1-1] { conn-1 } isClosed(): false;
[INFO  - 2023-09-12 16:57:39] tid:296 - [Thread Group 1-1] { conn-1 } isClosed(): false;
[DEBUG - 2023-09-12 16:57:39] tid:296 - [Thread Group 1-1] { conn-1 } access();  CMD_PREPARE
[INFO  - 2023-09-12 16:57:39] tid:296 - [Thread Group 1-1] { conn-1 } isValid(Integer): true;  [PARAMS]: 0;
[INFO  - 2023-09-12 16:57:39] tid:296 - [Thread Group 1-1] { conn-1 } clearWarnings();
[INFO  - 2023-09-12 16:57:39] tid:296 - [Thread Group 1-1] { conn-1 } isClosed(): false;
[INFO  - 2023-09-12 16:57:39] tid:296 - [Thread Group 1-1] { conn-1 } close();
[WARN  - 2023-09-12 16:57:39] tid:296 - [Thread Group 1-1] { conn-2 } setAttributes();  unsupported sessEncode:
[DEBUG - 2023-09-12 16:57:39] tid:296 - [Thread Group 1-1] try connect loop 0
[DEBUG - 2023-09-12 16:57:39] tid:296 - [Thread Group 1-1] { conn-2 } access();  CMD_STARTUP
[DEBUG - 2023-09-12 16:57:39] tid:296 - [Thread Group 1-1] { conn-2 } access();  CMD_LOGIN
[DEBUG - 2023-09-12 16:57:39] tid:296 - [Thread Group 1-1] try connect success [192.168.100.50:5236]
[INFO  - 2023-09-12 16:57:39] tid:296 - [Thread Group 1-1] { DmDriver@44976ceb } connect(DmProperties): conn-2, sessionID-0x7fb8d8011448;  [PARAMS]: {lastloginip=::ffff:192.168.100.177, svrstat=4, language=cn, globalserverseries=3, lastlogintime=2023-09-12 16:57:40, svrmode=0, dsccontrol=true, , backslashescape=false, clientuser=SYSDBA, localtimezone=480, host=192.168.100.50, logdir=D:\\apps\ApacheJmeter\jdbclog, loginwarningid=2, epgroup=192.168.100.50:5236=([192.168.100.50:5236 (NORMAL, OPEN, DSC CONTROL), sessions: 0]), lifetimeremainder=-1, gracetimeremainder=0, failedattempts=0, serverversion=8.1.3.12, clienthostname=192.168.100.50, url=jdbc:dm://192.168.100.50:5236?logLevel=all&logdir=D:\\apps\ApacheJmeter\jdbclog, applicationname=, instancename=DMSERVER, dbname=DAMENG, port=5236, loglevel=all, guid=4E80459C4E80459CA35E953C7841ABD7, user=SYSDBA};
[INFO  - 2023-09-12 16:57:39] tid:296 - [Thread Group 1-1] { conn-2 } isClosed(): false;
[DEBUG - 2023-09-12 16:57:39] tid:296 - [Thread Group 1-1] { conn-2 } access();  CMD_STMT_ALLOCATE
[INFO  - 2023-09-12 16:57:39] tid:296 - [Thread Group 1-1] { conn-2 } createStatement(): stmt-2, handle-0;
[DEBUG - 2023-09-12 16:57:39] tid:296 - [Thread Group 1-1] { conn-2 } access();  CMD_PREPARE
[SQL   - 2023-09-12 16:57:39] tid:296 - [Thread Group 1-1] { conn-2, stmt-2 } execute(String): true;  [PARAMS]: "SELECT 1;"; [USED TIME]: 1.2185ms;
[INFO  - 2023-09-12 16:57:39] tid:296 - [Thread Group 1-1] { conn-2, stmt-2 } close();
[INFO  - 2023-09-12 16:57:39] tid:296 - [Thread Group 1-1] { conn-2 } clearWarnings();
[INFO  - 2023-09-12 16:57:39] tid:296 - [Thread Group 1-1] { conn-2 } getAutoCommit(): true;
[INFO  - 2023-09-12 16:57:39] tid:296 - [Thread Group 1-1] { conn-2 } createStatement(): stmt-3, handle-0;
[INFO  - 2023-09-12 16:57:39] tid:296 - [Thread Group 1-1] { conn-2, stmt-3 } setQueryTimeout(Integer);  [PARAMS]: 0;
[DEBUG - 2023-09-12 16:57:39] tid:296 - [Thread Group 1-1] { conn-2 } access();  CMD_PREPARE
[SQL   - 2023-09-12 16:57:39] tid:296 - [Thread Group 1-1] { conn-2, stmt-3 } executeQuery(String): rs-1;  [PARAMS]: "SELECT * FROM T1 WHERE C1 LIKE '1%';
SELECT * FROM T1 WHERE C1 LIKE '2%';
SELECT * FROM T1 WHERE C1 LIKE '3%';
SELECT * FROM T1 WHERE C1 LIKE '4%';
commit"; [USED TIME]: 1.0863ms;
[INFO  - 2023-09-12 16:57:39] tid:296 - [Thread Group 1-1] { conn-2, stmt-3, rs-1 } getMetaData(): rsmd-1;
[INFO  - 2023-09-12 16:57:39] tid:296 - [Thread Group 1-1] { rsmd-1 } getColumnCount(): 1;
[INFO  - 2023-09-12 16:57:39] tid:296 - [Thread Group 1-1] { rsmd-1 } getColumnLabel(Integer): "C1";  [PARAMS]: 1;
[INFO  - 2023-09-12 16:57:39] tid:296 - [Thread Group 1-1] { conn-2, stmt-3, rs-1 } next(): true;
[INFO  - 2023-09-12 16:57:39] tid:296 - [Thread Group 1-1] { conn-2, stmt-3, rs-1 } getObject(Integer): 1;  [PARAMS]: 1;
[INFO  - 2023-09-12 16:57:39] tid:296 - [Thread Group 1-1] { conn-2, stmt-3, rs-1 } next(): false;
[INFO  - 2023-09-12 16:57:39] tid:296 - [Thread Group 1-1] { conn-2, stmt-3, rs-1 } close();
[INFO  - 2023-09-12 16:57:39] tid:296 - [Thread Group 1-1] { conn-2, stmt-3 } close();
[INFO  - 2023-09-12 16:57:39] tid:296 - [Thread Group 1-1] { conn-2 } isClosed(): false;
[INFO  - 2023-09-12 16:57:39] tid:296 - [Thread Group 1-1] { conn-2 } isClosed(): false;
[INFO  - 2023-09-12 16:57:39] tid:296 - [Thread Group 1-1] { conn-2 } clearWarnings();
[INFO  - 2023-09-12 16:57:39] tid:296 - [Thread Group 1-1] { conn-2 } createStatement(): stmt-4, handle-0;
[INFO  - 2023-09-12 16:57:39] tid:296 - [Thread Group 1-1] { conn-2, stmt-4 } setQueryTimeout(Integer);  [PARAMS]: 0;
[DEBUG - 2023-09-12 16:57:39] tid:296 - [Thread Group 1-1] { conn-2 } access();  CMD_PREPARE
[SQL   - 2023-09-12 16:57:39] tid:296 - [Thread Group 1-1] { conn-2, stmt-4 } executeQuery(String): rs-2;  [PARAMS]: "SELECT * FROM T1 WHERE C1 LIKE '1%';
SELECT * FROM T1 WHERE C1 LIKE '2%';
SELECT * FROM T1 WHERE C1 LIKE '3%';
SELECT * FROM T1 WHERE C1 LIKE '4%';
commit"; [USED TIME]: 0.8516ms;
[INFO  - 2023-09-12 16:57:39] tid:296 - [Thread Group 1-1] { conn-2, stmt-4, rs-2 } getMetaData(): rsmd-2;
[INFO  - 2023-09-12 16:57:39] tid:296 - [Thread Group 1-1] { rsmd-2 } getColumnCount(): 1;
[INFO  - 2023-09-12 16:57:39] tid:296 - [Thread Group 1-1] { rsmd-2 } getColumnLabel(Integer): "C1";  [PARAMS]: 1;
[INFO  - 2023-09-12 16:57:39] tid:296 - [Thread Group 1-1] { conn-2, stmt-4, rs-2 } next(): true;
[INFO  - 2023-09-12 16:57:39] tid:296 - [Thread Group 1-1] { conn-2, stmt-4, rs-2 } getObject(Integer): 1;  [PARAMS]: 1;
[INFO  - 2023-09-12 16:57:39] tid:296 - [Thread Group 1-1] { conn-2, stmt-4, rs-2 } next(): false;
[INFO  - 2023-09-12 16:57:39] tid:296 - [Thread Group 1-1] { conn-2, stmt-4, rs-2 } close();
[INFO  - 2023-09-12 16:57:39] tid:296 - [Thread Group 1-1] { conn-2, stmt-4 } close();
[INFO  - 2023-09-12 16:57:39] tid:296 - [Thread Group 1-1] { conn-2 } isClosed(): false;
[INFO  - 2023-09-12 16:57:39] tid:296 - [Thread Group 1-1] { conn-2 } isClosed(): false;
[INFO  - 2023-09-12 16:57:39] tid:296 - [Thread Group 1-1] { conn-2 } clearWarnings();
[INFO  - 2023-09-12 16:57:39] tid:296 - [Thread Group 1-1] { conn-2 } createStatement(): stmt-5, handle-0;
[INFO  - 2023-09-12 16:57:39] tid:296 - [Thread Group 1-1] { conn-2, stmt-5 } setQueryTimeout(Integer);  [PARAMS]: 0;
[DEBUG - 2023-09-12 16:57:39] tid:296 - [Thread Group 1-1] { conn-2 } access();  CMD_PREPARE
[SQL   - 2023-09-12 16:57:39] tid:296 - [Thread Group 1-1] { conn-2, stmt-5 } executeQuery(String): rs-3;  [PARAMS]: 

你可能感兴趣的:(数据库,oracle,sql,运维)