This topic describes how to view and configure the session variables supported by OceanBase Database and OceanBase Connector/J.
Configuration method
When you use OBLOADER & OBDUMPER to connect to a database, you can modify the connection settings by configuring variables in the session.config.json file stored in the {ob-loader-dumper}/conf/ directory. session.config.json is a JSON configuration file readable to programs. It contains three types of configurations: SQL statements for connection initialization, URL options of OceanBase Connector/J, and high availability (HA) mode of OceanBase Connector/J. The following table describes the fixed tags in this JSON file.
| Tag | Value type | Description | Parent tag |
|---|---|---|---|
| init_sql | map | The SQL statements pre-executed to set session variables and system parameters after a database connection is established. | - |
| oracle | list | A fixed sub-tag of init_sql. It applies only to Oracle compatible mode of OceanBase Database. |
init_sql |
| mysql | list | A fixed sub-tag of init_sql. It applies only to MySQL compatible mode of OceanBase Database. |
init_sql |
| jdbc_url_options | map | URL options of OceanBase Connector/J. | - |
| jdbc_hamode | string | The HA mode of OceanBase Connector/J. For more information, see OceanBase Connector/J. | - |
You can view the session.config.json file in the {ob-loader-dumper}/conf directory. Here is a sample session.config.json file:
$cd /home/admin/obloaderobdumper/ob-loader-dumper-4.x.x-RELEASE/conf
$cat session.config.json
{
"init_sql": {
"oracle": [
"set names utf8",
"set autocommit=1",
"set session ob_query_timeout=300000000",
"set session ob_trx_timeout=180000000",
"set session net_read_timeout=86400",
"set session net_write_timeout=86400",
"set session sql_select_limit=9223372036854775807",
"alter session set nls_date_format='YYYY-MM-DD HH24:MI:SS'",
"alter session set nls_timestamp_format='YYYY-MM-DD HH24:MI:SS:FF9'",
"alter session set nls_timestamp_tz_format='YYYY-MM-DD HH24:MI:SS.FF TZR TZD'"
],
"mysql": [
"set names utf8",
"set autocommit=1",
"set session ob_query_timeout=300000000",
"set session ob_trx_timeout=180000000",
"set session net_read_timeout=86400",
"set session net_write_timeout=86400",
"set session sql_select_limit=9223372036854775807",
"set session sql_mode='STRICT_ALL_TABLES,NO_ZERO_IN_DATE'"
]
},
"jdbc_url_options": {
"characterEncoding": "utf8",
"socketTimeout": 1800000,
"connectTimeout": 1800000,
"zeroDateTimeBehavior": "convertToNull",
"useServerPrepStmts": true,
"noDatetimeStringSync": true,
"useCompression": true,
"log": false,
"allowMultiQueries": true,
"useLocalSessionState": true,
"cachePrepStmts": true,
"useSqlStringCache": true
},
"jdbc_hamode": null
}