各种数据库产品的细节比较

Jdbc Url

mysql

spring:
  datasource:
    type: com.zaxxer.hikari.HikariDataSource
    driver-class-name: com.mysql.cj.jdbc.Driver
    username: xxx
    password: xxx
    url: jdbc:mysql://192.168.1.54:3306/tmp?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&allowMultiQueries=true

▶ 支持的属性:

▶ 参考:

https://dev.mysql.com/doc/connector-j/en/connector-j-reference-configuration-properties.html

pgsql

spring:
  datasource:
    type: com.zaxxer.hikari.HikariDataSource
    driver-class-name: org.postgresql.Driver
    username: xxx
    password: xxx
    url: jdbc:postgresql://192.168.1.18:15432/oio?currentSchema=oio_master&reWriteBatchedInserts=true&stringtype=unspecified

▶ 支持的属性:

currentSchema:指定schema。

Property Type Default Description
user String null The database user on whose behalf the connection is being made.
password String null The database user’s password.
options String null Specify ‘options’ connection initialization parameter.
service String null Specify ‘service’ name described in pg_service.conf file. References: The Connection Service File and The Password File. ‘service’ file can provide all properties including ‘hostname=’, ‘port=’ and ‘dbname=’.
ssl Boolean false Control use of SSL (true value causes SSL to be required)
sslfactory String org.postgresql.ssl.LibPQFactory Provide a SSLSocketFactory class when using SSL.
sslfactoryarg (deprecated) String null Argument forwarded to constructor of SSLSocketFactory class.
sslmode String prefer Controls the preference for opening using an SSL encrypted connection.
sslcert String null The location of the client’s SSL certificate
sslkey String null The location of the client’s PKCS#8 or PKCS#12 SSL key, for PKCS the extension must be .p12 or .pfx and the alias must be user
sslrootcert String null The location of the root certificate for authenticating the server.
sslhostnameverifier String null The name of a class (for use in Class.forName(String)) that implements javax.net.ssl.HostnameVerifier and can verify the server hostname.
sslpasswordcallback String null The name of a class (for use in Class.forName(String)) that implements javax.security.auth.callback.CallbackHandler and can handle PasswordCallback for the ssl password.
sslpassword String null The password for the client’s ssl key (ignored if sslpasswordcallback is set)
sslnegotiation String postgres Determines if ALPN ssl negotiation will be used or not. Set to direct to choose ALPN.
sendBufferSize Integer -1 Socket write buffer size
maxSendBufferSize Integer 65536 Maximum amount of bytes buffered before sending to the backend. pgjdbc uses least(maxSendBufferSize, greatest(8192, SO_SNDBUF)) to determine the buffer size.
receiveBufferSize Integer -1 Socket read buffer size
logServerErrorDetail Boolean true Allows server error detail (such as sql statements and values) to be logged and passed on in exceptions. Setting to false will mask these errors so they won’t be exposed to users, or logs.
allowEncodingChanges Boolean false Allow for changes in client_encoding
logUnclosedConnections Boolean false When connections that are not explicitly closed are garbage collected, log the stacktrace from the opening of the connection to trace the leak source
binaryTransfer Boolean true Enable binary transfer for supported built-in types if possible. Setting this to false disables any binary transfer unless it’s individually activated for each type with binaryTransferEnable. Whether it is possible to use binary transfer at all depends on server side prepared statements (see prepareThreshold ).
binaryTransferEnable String “” Comma separated list of types to enable binary transfer. Either OID numbers or names.
binaryTransferDisable String “” Comma separated list of types to disable binary transfer. Either OID numbers or names. Overrides values in the driver default set and values set with binaryTransferEnable.
prepareThreshold Integer 5 Determine the number of PreparedStatement executions required before switching over to use server side prepared statements. The default is five, meaning start using server side prepared statements on the fifth execution of the same PreparedStatement object. A value of -1 activates server side prepared statements and forces binary transfer for enabled types (see binaryTransfer ).
preparedStatementCacheQueries Integer 256 Specifies the maximum number of entries in per-connection cache of prepared statements. A value of 0 disables the cache.
preparedStatementCacheSizeMiB Integer 5 Specifies the maximum size (in megabytes) of a per-connection prepared statement cache. A value of 0 disables the cache.
defaultRowFetchSize Integer 0 Positive number of rows that should be fetched from the database when more rows are needed for ResultSet by each fetch iteration
loginTimeout Integer 0 Specify how long in seconds max(2147484) to wait for establishment of a database connection.
connectTimeout Integer 10 The timeout value in seconds max(2147484) used for socket connect operations.
socketTimeout Integer 0 The timeout value in seconds max(2147484) used for socket read operations.
cancelSignalTimeout Integer 10 The timeout that is used for sending cancel command.
sslResponseTimeout Integer 5000 Socket timeout in milliseconds waiting for a response from a request for SSL upgrade from the server.
tcpKeepAlive Boolean false Enable or disable TCP keep-alive.
tcpNoDelay Boolean true Enable or disable TCP no delay.
ApplicationName String PostgreSQL JDBC Driver The application name (require server version >= 9.0). If assumeMinServerVersion is set to >= 9.0 this will be sent in the startup packets, otherwise after the connection is made
readOnly Boolean false Puts this connection in read-only mode
readOnlyMode String transaction Specifies the behavior when a connection is set to be read only, possible values: ignore, transaction, always
disableColumnSanitiser Boolean false Enable optimization that disables column name sanitiser
assumeMinServerVersion String null Assume the server is at least that version
currentSchema String null Specify the schema (or several schema separated by commas) to be set in the search-path
targetServerType String any Specifies what kind of server to connect, possible values: any, master, slave (deprecated), secondary, preferSlave (deprecated), preferSecondary, preferPrimary
hostRecheckSeconds Integer 10 Specifies period (seconds) after which the host status is checked again in case it has changed
loadBalanceHosts Boolean false If disabled hosts are connected in the given order. If enabled hosts are chosen randomly from the set of suitable candidates
socketFactory String null Specify a socket factory for socket creation
socketFactoryArg (deprecated) String null Argument forwarded to constructor of SocketFactory class.
autosave String never Specifies what the driver should do if a query fails, possible values: always, never, conservative
cleanupSavepoints Boolean false In Autosave mode the driver sets a SAVEPOINT for every query. It is possible to exhaust the server shared buffers. Setting this to true will release each SAVEPOINT at the cost of an additional round trip.
preferQueryMode String extended Specifies which mode is used to execute queries to database, possible values: extended, extendedForPrepared, extendedCacheEverything, simple
reWriteBatchedInserts Boolean false Enable optimization to rewrite and collapse compatible INSERT statements that are batched.
escapeSyntaxCallMode String select Specifies how JDBC escape call syntax is transformed into underlying SQL (CALL/SELECT), for invoking procedures or functions (requires server version >= 11), possible values: select, callIfNoReturn, call
maxResultBuffer String null Specifies size of result buffer in bytes, which can’t be exceeded during reading result set. Can be specified as particular size (i.e. “100”, “200M” “2G”) or as percent of max heap memory (i.e. “10p”, “20pct”, “50percent”)
gssLib String auto Permissible values are auto (default, see below), sspi (force SSPI) or gssapi (force GSSAPI-JSSE).
gssResponseTimeout Integer 5000 Socket timeout in milliseconds waiting for a response from a request for GSS encrypted connection from the server.
gssEncMode String allow Controls the preference for using GSSAPI encryption for the connection, values are disable, allow, prefer, and require
useSpnego String false Use SPNEGO in SSPI authentication requests
adaptiveFetch Boolean false Specifies if number of rows fetched in ResultSet by each fetch iteration should be dynamic. Number of rows will be calculated by dividing maxResultBuffer size into max row size observed so far. Requires declaring maxResultBuffer and defaultRowFetchSize for first iteration.
adaptiveFetchMinimum Integer 0 Specifies minimum number of rows, which can be calculated by adaptiveFetch. Number of rows used by adaptiveFetch cannot go below this value.
adaptiveFetchMaximum Integer -1 Specifies maximum number of rows, which can be calculated by adaptiveFetch. Number of rows used by adaptiveFetch cannot go above this value. Any negative number set as adaptiveFetchMaximum is used by adaptiveFetch as infinity number of rows.
localSocketAddress String null Hostname or IP address given to explicitly configure the interface that the driver will bind the client side of the TCP/IP connection to when connecting.
quoteReturningIdentifiers Boolean true By default we double quote returning identifiers. Some ORM’s already quote them. Switch allows them to turn this off
authenticationPluginClassName String null Fully qualified class name of the class implementing the AuthenticationPlugin interface. If this is null, the password value in the connection properties will be used.
unknownLength Integer Integer.MAX_LENGTH Specifies the length to return for types of unknown length
stringtype String null Specify the type to use when binding PreparedStatement parameters set via setString()
channelBinding String prefer This option controls the client’s use of channel binding. require means that the connection must employ channel binding, prefer means that the client will choose channel binding if available, and disable prevents the use of channel binding.
System Properties
Property Type Default Description
pgjdbc.config.cleanup.thread.ttl long 30000 The driver has an internal cleanup thread which monitors and cleans up unclosed connections. This property sets the duration (in milliseconds) the cleanup thread will keep running if there is nothing to clean up.

▶ 参考:

https://github.com/pgjdbc/pgjdbc

达梦数据库

jdbc:dm://[host][:port][?propName1=propValue1][&propName2=propValue2][&…]…
dm.jdbc.driver.DmDriver

▶ 支持的属性:

属性名称 说明 是否必须设置
host 主库地址,包括 IP 地址、localhost 或者配置文件中主库地址列表对应的变量名
port 端口号,服务器登录端口号
unixSocketFile LINUX 系统中,当服务器与客户端之间使用 UNIXSOCETUNIX-IPC 方式通信时,用于指定客户端连接的 UNIXSOCKET 路径文件名。使用 unixSocketFile 时,不需要指定 host 和 port。 例如:jdbc:dm://?user=SYSDBA&password=SYSDBA&unixSocketFile=/home/te/foo.sock
user 登录用户。若指定 OsAuthType 参数使用操作系统用户登录,则无需指定 user,其他情况下需要指定 user
password 登录密码。若指定 OsAuthType 参数使用操作系统用户登录,则无需指定 password,其他情况下需要指定 password
appName 客户端应用程序名称
osName 操作系统名称
socketTimeout 网络通信链路超时时间;单位 ms,取值范围 0~2147483647,0 表示无限制;缺省为 0
sessionTimeout 会话超时时间;单位 s,取值范围 0~2147483647,0 表示无限制;缺省为 0
connectTimeout 连连接数据库超时时间;单位 ms,取值范围 0~2147483647,0 表示无限制;缺省为 5000
StmtPoolSize 语句句柄池大小;取值范围 0~2147483647,0 表示关闭;缺省为 15
PStmtPoolSize prepare 语句句柄池大小;取值范围 0~2147483647,0 表示关闭;缺省为 0
pstmtPoolValidTime prepare 语句缓存的有效时间;单位 ms,取值范围 0~2147483647,0 表示无限制;缺省为 0
escapeProcess 是否进行语法转义处理;取值 1/0 或 true/false;缺省为 true;1/true:是,0/false:否
autoCommit 是否自动提交;取值 1/0 或 true/false;缺省为 true;1/true:是,0/false:否
alwayseAllowCommit 在自动提交开关打开时,调用 rollback()接口是否不报错;取值 1/0 或 true/false;缺省为 true;1/true:是,0/false:否
localTimezone 指定客户端本地时区,对于本地时区相关时间类型会自动完成服务器时区与本地时区的转换;单位分钟,取值范围-720~720;缺省为当前系统时区
maxRows 结果集行数限制,超过上限结果集截断;取值范围 0~2147483647,0 表示无限制;缺省为 0
bufPrefetch 结果集 fetch 预取消息 buffer 大小;单位 KB,取值范围 32~65535。缺省为 0,表示按服务器配置,若结果集上指定了 fetchSize 会自动预估大小
LobMode 大字段数据获取模式;1 表示 get 数据时从服务器段获取,2 表示结果集生成时将大字段数据完整缓存到本地;缺省为 1
ignoreCase 结果集列名是否忽略大小写;取值 1/0 或 true/false;缺省为 true;1/true:是,0/false:否
continueBatchOnError 或 batchContinueOnError 批量执行出错时是否继续执行;缺省为 false;取值(true/True,false/False);true/True:是,false/False:否
batchType 批处理模式;1 表示批量绑定执行,2 表示一行一行执行;缺省为 1
resultSetType 指定默认创建结果集类型,与 java 标准中结果集类型相对应;取值 1003/1004/1005,缺省为 1003; 1003:对应 ResultSet.TYPE_FORWARD_ONLY; 1004:对应 ResultSet.TYPE_SCROLL_INSENSITIVE; 1005:对应 ResultSet.TYPE_SCROLL_SENSITIVE
dbmdChkPrv 编目函数是否进行权限检测;取值 1/0 或 true/false;缺省为 true;1/true:是,0/false:否
isBdtaRS 是否使用列模式结果集,需同步服务器开启该功能;取值 1/0 或 true/false;缺省为 false;1/true:是,0/false:否
clobAsString clob 类型列调用 resultSetMetaData 的 getColumnType()映射为 Types.VARCHAR 类型;取值 1/0 或 true/false;缺省为 false;1/true:是,0/false:否
columnNameCase 结果集列名大小写转换。取值 upper/lower/空值,缺省为空值。upper 表示转为大写;lower 表示转为小写;空值表示保持不变
compatible_mode 或 compatibleMode 兼容其他数据库。取值为数据库名称:oracle 表示兼容 Oracle,oracle11 表示兼容 Oracle 11c,oracle19 表示兼容 Oracle 19c,mysql 表示兼容 Mysql。本参数和 DM.INI 中的 COMPATIBLE_MODE 同名,但用途不同
schema 指定用户登录后的当前模式,默认为用户的默认模式
loginMode 指定优先登录的服务器模式。取值范围 0~4;0:优先连接 PRIMARY 模式或者 NORMAL 模式的库,最后选择 STANDBY 模式;1:只连接主库;2:只连接备库;3:优先连接 STANDBY 模式的库,PRIMARY 模式次之,最后选择 NORMAL 模式;4:优先连接 PRIMARY 模式的库,NORMAL 模式次之,最后选择 STANDBY 模式。缺省为 4。 当启用读写分离时(即 rwSeparate 不为 0),loginMode 不生效
loginStatus 服务名方式连接数据库时只选择状态匹配的库; 取值范围 0、3~5;0 表示不限制;3 表示 mount 状态;4 表示 open 状态;5 表示 suspend 状态;缺省为 0
loginDscCtrl 服务名连接数据库时只选择 dsc control 节点的库;取值 1/0 或 true/false;缺省为 false;1/true:是,0/false:否
epSelector 服务名连接数据库时采用何种模型建立连接。取值范围 0~n。 0: 依次选取列表中的不同节点建立连接,使得所有连接均匀地分布在各个节点上;取值 >0:选择列表中第 n 个节点建立连接,只有当前节点无法建立连接时才会选择下一个节点进行连接。缺省为 0
epSelectorDynamic 表示是否根据节点存活状态动态调整 epSelector 的值;取值 true/false,true:开启,false:关闭;缺省为 false。若开启,一但本来要连的节点故障,连接移到下个节点,即使前面的节点恢复了,后续也连接不回前面的节点上,还是在下个节点上
autoReconnect 或 reconnect 连接发生异常或一些特殊场景下连接处理策略。取值范围 0~7;0:关闭连接;1:当连接发生异常时自动切换到其他库,无论切换成功还是失败都会抛一个 SQLException,用于通知上层应用进行事务执行失败时的相关处理;2:配合 epSelector=1 使用,如果服务名列表前面的节点恢复了,将当前连接切换到前面的节点上;4:保持各节点会话动态均衡,通过后台线程检测节点及会话数变化,并切换连接使之保持均衡。 也可以将 autoReconnect 置为上述几个值的组合值,表示同时进行多项配置,如置为 3 表示同时配置 1 和 2;缺省为 0
switchTimes 服务名连接数据库时,若未找到符合条件的库成功建立连接,将尝试遍历服务名中库列表的次数;取值范围 1~2147483647;缺省为 1
switchInterval 服务名连接数据库时,若遍历了服务名中所有库列表都未找到符合条件的库成功建立连接,等待一定时间再继续下一次遍历;单位 ms,取值范围 0~2147483647;缺省为 1000
cluster 用于标识的集群类型。 DW:主备; RW:读写分离; MPP:大规模并行处理集群; DPC:分布计算集群; DSC:数据共享集群。cluster=DSC 须配合 autoReconnect=2、epSelector=1 使用,用于检测 DSC 集群节点故障恢复是否成功; NORMAL:表示为单机库; 缺省 NORMAL
dbAliveCheckFreq 检测数据库是否存活的频率。单位 ms,取值范围 0~2147483647,0 表示不检测;缺省为 0
compress 是否压缩消息。取值范围 0~2。0 表示不压缩;1 表示完全压缩;2 表示优化的压缩;缺省为 0
compressID 消息压缩算法标识,最终与服务器支持情况协商决定。0 表示 zip;1 表示 snappy; 缺省为 0
sslFilesPath 数据库端开启 ssl 通信加密,该参数指定 ssl 加密文件的路径
sslKeystorePass 数据库端开启 ssl 通信加密,该参数指定 ssl 加密文件的指令
kerberosLoginConfPath 用户名加前缀”///”标识开启 kerberos 认证,该参数指定 kerberos 认证登录配置文件路径
uKeyName Ukey 文件的绝对路径(例如 E:\thirdparty\ukey\x64\Debug\dmukey_v1.dll)
uKeyPin Ukey 的口令
cipherPath 第三方加密算法引擎所在路径
OsAuthType 指定操作系统认证用户类型,开启操作系统认证时,用户名使用系统用户名。取值范围 0~4;0 表示关闭;1 表示 DBA;2 表示 SSO; 3 表示 AUDITOR;4 表示自适应。缺省为 0
loginCertificate 指定登录加密用户名密码公钥所在的路径,一旦配置即认为开启了客户端的证书加密用户名密码模式
mppLocal 是否 MPP 本地连接;取值 1/0 或 true/false;缺省为 false;1/true:是,0/false:否
rwSeparate 是否使用读写分离系统。0 表示不启用;1 表示启用;2 表示启用,备库由客户端进行选择,且只会选择服务名中配置的节点;3 表示启用,备库由服务器通过消息告知;4 表示启用,备库由客户端进行选择,只连接事务一致性备库;5 表示启用,为 gateway 准备,连接 epList 列表内第一个可用的备库。缺省为 0 当启用读写分离时,loginMode 失效
rwPercent 分发到主库的事务占主备库总事务的百分比;单位 %,取值范围 0~100;缺省为 25
rwAutoDistribute 读写分离系统事务分发是否由 JDBC 自动管理;取值 1/0 或 true/false;缺省为 true;1/true:是,false:事务分发由用户管理,用户可通过设置连接上的 readOnly 属性标记事务为只读事务
rwHA 是否开启读写分离系统高可用;取值 1/0 或 true/false;缺省为 false;1/true:是,0/false:否
rwStandbyRecoverTime 读写分离系统备库故障恢复检测间隔,单位 ms,取值范围 0~2147483647,0 表示不检测;缺省为 60000
enRsCache 是否开启结果集缓存;取值 1/0 或 true/false;缺省为 false;1/true:是,0/false:否
rsCacheSize 设置结果集缓冲区大小,单位 MB。取值范围 1~65535,如果设置太大,可能导致空间分配失败,进而使缓存失效
rsRefreshFreq 结果集缓存检查更新的频率,单位 S,取值范围 0~10000,缺省为 10。如果设置为 0,则不需检查更新
keyWords 标识用户关键字,所有在列表中的字符串,如果以单词的形式出现在 sql 语句中,则这个单词会被加上双引号;默认为空串
logDir 日志等其他一些 JDBC 过程文件生成目录,默认为 jvm 当前工作目录
logLevel 生成日志的级别,日志按从低到高依次如下(off:不记录;assert:断言日志信息;error:只记录错误日志;warn:记录警告信息;sql:记录 sql 执行信息;info:记录全部执行信息;DEBUG:记录 debug 信息;all:记录全部),高级别同时记录低级别的信息;缺省为 off
logFlushFreq 日志刷盘频率;单位 s,有效值范围 0~2147483647;缺省为 30
statEnable 是否启用状态监控;取值 1/0 或 true/false;缺省为 false;1/true:是,0/false:否
statDir 状态监控信息以文本文件形式输出的目录,默认为 jvm 当前工作目录
statFlushFreq 状态监控统计信息写文件刷盘频率;单位 s,取值范围 0~2147483647;0 表示不写文件;缺省为 30
statSlowSqlCount 统计慢 sql top 行数;取值范围 0~1000;缺省为 100
statHighFreqSqlCount 统计高频 sql top 行数;取值范围 0~1000;缺省为 100
statSqlMaxCount 状态监控可以统计不同 sql 的个数;取值范围 0~100000;缺省为 1000
statSqlRemoveMode 执行的不同 sql 个数超过 statSqlMaxCount 时使用的淘汰方式;取值 latest/eldest;latest 表示淘汰最近执行的 sql,eldest 表示淘汰最老的 sql;缺省为 latest
dmsvcconf 指定 url 属性配置文件所在路径
dbAliveCheckTimeout 检测数据库是否存活的连接超时时间。单位 ms,范围 0~2147483647,0 表示无超时。缺省为 10000
checkFreq 服务名连接数据库时,循环检测连接是否需要重置的时间间隔。即每间隔设定时间检测连接对象是否发生改变,若连接对象发生改变,JDBC 连接会自动重置到新对象。单位 ms,取值范围 0~2147483647。缺省值为 300000
prepareOptimize 是否对预编译 SQL 做优化;取值 1/0 或 true/false;缺省为 false;1/true:是,0/false:否
allowRange 允许动态负载均衡误差范围的百分比,百分比越大表示允许的误差范围越大,取值范围 0~50。缺省为 5
localEncrypt 是否启用用户名密码本地加密;取值 1/0 或 true/false;缺省为 false;1/true:是,0/false:否
localEncryptEngine 本地加密引擎名,不指定时使用系统内置的加密引擎,用户可指定自定义的加密引擎。缺省为空
genKeyNameCase 调用 preparedStatement(String sql, String[] columnName)接口 prepare sql 时可同时指定列名,用于在表数据增删改后返回指定的列值。该参数用于指定这里的列名的大小写。取值 0/1/2 或 none/upper/lower;缺省为 upper。取值 0 或 none:保持用户输入不变;1 或 upper: 将用户输入转为大写;2 或 lower: 将用户输入转为小写
afterGetMoreResults 调用 JDBC 标准接口 getMoreResults()后是否关闭之前的结果集;取值 1/2/3;缺省为 1;1:关闭当前一个结果集;2:保持当前结果集打开;3:关闭当前所有结果集
checkExecType 是否检查 executeXXX 接口执行的 SQL 语句类型与接口是否匹配;取值 1/0 或 true/false;缺省为 false;1/true:是,0/false:否
quoteReplace 是否将 SQL 语句中的双引号改成单引号;取值 1/0 或 true/false;缺省为 false;1/true:是,0/false:否
ignoreWarnings 用于设置忽略指定的 SQLWarnings,取值与含义如下: all:忽略所有警告; sqlCode:忽略指定的警告; op sqlCode:忽略满足条件的警告,op 可以为符号 >、<、>=、<=、!; (sqlCode,sqlCode):忽略指定的多个警告,默认为空
paramBindMode 用于设置参数绑定类型,取值 1/0,缺省为 0。0:参数为推荐类型时,按用户类型进行绑定;1:参数为推荐类型时,按服务器推荐类型进行绑定
language 使用的语言信息:CN(表示简体中文)、EN(表示英文)和 CNT_HK(表示香港繁体中文)。 可以不指定,若不指定,系统会读取操作系统信息获得语言信息,建议有需要才指定。如果此处想使用 CNT_HK,则建库时 CHARSET/UNICODE_FLAG 必须指定为 UTF-8
errMap 自定义 DM 错误码和 Oracle 错误码的映射关系。 格式:errMap=(dmCode:oracleCode, …, dmCode:oracleCode) 例如:errMap=(-2223:955, -2207:2289)
customFilter SQL 拦截器,用于在执行 SQL 语句之前实现其他相关操作
zipkinServiceName zipkin 服务名,用于 zipkin 链路追踪,必须和 sql 拦截器 customFilter =com.dameng.zipkin.DmZipkinCustom 一起使用,缺省值为“dmService”。 例如:jdbc:dm://localhost:5236?customFilter=com.dameng.zipkin.DmZipkinCustom&zipkinServiceName=myDatabaseService
reconnectErrors 用于指定需要重连的异常,即当用服务名进行连接时,若发生指定的异常时将继续找下一个节点进行连接,发生其他异常则会抛出异常停止连接。 配置格式:reconnectErrors=(errorCode,errorCode,…)。errorCode 为数据库错误码(其中,超过了最大连接限制错误码-6001 不论设置与否,都会继续重连)。 例如:reconnectErrors=(-14009,-13217)
LogSwitchMode logLevel 不为 off 时生效。logSwitchMode 表示 SQL 日志文件切换的模式:0:不切换;1:按文件中记录数量切换;2:按文件大小切换;3:按时间间隔切换。缺省值为 2
logSwitchLimit logLevel 不为 off 时生效。logSwitchLimit 默认值与切换模式有关。 不同切换模式(logSwitchMode)下,意义不同:logSwitchMode=1(按数量切换时),一个日志文件中的记录条数达到多少条之后,系统自动将日志切换到另一个文件中。取值范围 1000-10000000,缺省为 100000; logSwitchMode=2(按文件大小切换时),一个日志文件达到该大小后,系统自动将日志切换到另一个文件中,单位为 MB,取值范围 1-2000,缺省 128; logSwtichMode=3(按时间间隔切换时),每隔指定的时间间隔,系统自动将日志切换到另一个文件中,单位分钟,取值范围 1-30000,缺省值为 60
logFileNum 总共记录多少个日志文件(会清除当前目录下旧有的 dmjdbc 日志,请注意使用),当日志文件达到这个设定值以后,再生成新的文件时,会删除最早的那个日志文件。取值范围 2-1024。日志文件名称中将包含日期时间信息。缺省值为 5
sslProtocol 指定 SSL 协议版本。例如 SSLv3,缺省为空
GWDSN Gateway 连接的数据源名称
numTruncSwitch 对超级小的数字做截断处理。缺省为 false
userNewPwd 当前用户修改的新密码。缺省为为空
serverOption 登录数据库的附加信息。缺省为空
statFileType 监控信息记录的文件格式:csv、txt。缺省 csv
highConcurrency 是否为高并发模式。取值 true/false。缺省为 false
compatibleURL 第三方 URL 解析标识符。缺省为 true
Shakecrypto 加密引擎名,例如 ZB。缺省为空
rsCacheEnable 是否开启对特定 SQL 获取所有结果集并缓存。取值 1/0 或 true/false;缺省为 false;特定 SQL 需满足两个条件:1.类型为 SELECT;2. SQL 语句中包含/*jdbcrscache*/或 SQL 在文件中被指定
rsCacheTimeout 缓存有效时间。缺省为 60,取值范围 0~ 2147483647
rsCacheTimeoutUnit 缓存有效时间单位,可选项 0/1/2,对应单位为秒/分/时,缺省为秒
rsCacheLimit 每个 SQL 绑定参数的值存在多种组合情况,本参数表示组合情况的最大值,缺省为 100,取值范围 1~ 2147483647
rsCacheFilePath 指定文件路径。文件用于保存需要被缓存的类型为 SELECT 的 SQL 语句。缺省为 NULL

▶ 参考:

https://eco.dameng.com/document/dm/zh-cn/pm/jdbc-rogramming-guide#4.5.4%20DM%20%E6%89%A9%E5%B1%95%E8%BF%9E%E6%8E%A5%E5%B1%9E%E6%80%A7%E7%9A%84%E4%BD%BF%E7%94%A8

人大金仓

数据库特性

特性 mysql pgsql 人大金仓 达梦
创建表名大小写 全部转换小写
(根据lower_case_table_names设置)不论是否加反引号
全部转换小写
如果加在双引号的,则保持来格式
访问表名大小写 不区分(根据lower_case_table_names设置) 不论是否加反引号 不加双引号的,则转为小写,表名也不能加双引号,不然查询不到
创建字段大小写 保持原来格式(根据lower_case_table_names设置)不论是否加反引号 全部转换小写
如果加在双引号的,则保持来格式
访问字段名大小写 不区分(不论是否加反引号),但是返回的字段名为SQL语句中的格式 不加双引号的,则转为小写,表名也不能加双引号,不然查询不到
查询字符串字段值(相等操作) 支持不区分大小写(根据collate设置) 不支持(有其他方式,但是支持不全面)
字符串类型字段排序(比较)区分大小写 支持不区分大小写(根据collate设置) 支持不区分大小写(根据collate设置,例如en_US)
是否可创建多个数据库 支持 支持
是否有schema
切换数据库 use dbname;
切换schema set search_path to

▶ Mysql lower_case_table_names设置值:

  • lower_case_table_names=0 :存储为给定的大小和比较是区分大小写
  • lower_case_table_names = 1 :存储在磁盘是小写的,但是比较的时候是不区分大小写
  • lower_case_table_names=2 :存储为给定的大小写但是比较的时候是小写的

unix,linuxlower_case_table_names默认值为 0 ,Windows下默认值是 1,Mac OS` 下默认值是 2。

▶ pgsql

DROP COLLATION  english_ci;
CREATE COLLATION english_ci (
   PROVIDER = icu,
   -- 'en-US@colStrength=secondary' for old ICU versions
   LOCALE = 'en-US-u-ks-level2',
   DETERMINISTIC = FALSE    -- 设置为false,则支持,不区分大小写,但是不能使用like
    						-- 设置为true,则不支持,不区分大小写,但是可以使用like
);


create table if not exists zzzz
(
    id       varchar(32)                               not null,
    doc_name varchar(128)            COLLATE english_ci                  not null,
    doc_type smallint                                  not null,
    Subhead  varchar(64) default ''   COLLATE english_ci    not null
)


nondeterministic collations are not supported for LIKE

参考:https://www.cybertec-postgresql.com/en/case-insensitive-pattern-matching-in-postgresql/

limit

  • mysql

    SELECT * FROM users LIMIT 10; -- 返回前10条记录
    SELECT * FROM users LIMIT 20, 10;       -- 跳过前20条,返回接下来的10条
    SELECT * FROM users LIMIT 10 OFFSET 20; -- 同上,更易读的写法
    
  • pgsql

    SELECT * FROM users LIMIT 10;             -- 返回前10条记录
    SELECT * FROM users LIMIT 10 OFFSET 20;   -- 跳过前20条,返回接下来的10条
    
    SELECT * FROM users FETCH FIRST 10 ROWS ONLY;             -- 返回前10条记录
    SELECT * FROM users OFFSET 20 ROWS FETCH NEXT 10 ROWS ONLY; -- 跳过前20条,返回接下来的10条
    

    注意: FETCH FIRSTLIMIT 在 PostgreSQL 中可以互换使用,选择哪种取决于个人或团队的编码规范。

  • derby

    SELECT * FROM users FETCH FIRST 10 ROWS ONLY; -- 返回前10条记录
    
    SELECT * FROM EMP
    -- 偏移n行
    OFFSET ? ROWS
    -- 获取n行
    FETCH NEXT ? ROWS ONLY
    
  • 人大金仓

    #与pgsql相同
    SELECT * FROM users LIMIT 10;             -- 返回前10条记录
    SELECT * FROM users LIMIT 10 OFFSET 20;   -- 跳过前20条,返回接下来的10条
    
    SELECT * FROM users FETCH FIRST 10 ROWS ONLY;             -- 返回前10条记录
    SELECT * FROM users OFFSET 20 ROWS FETCH NEXT 10 ROWS ONLY; -- 跳过前20条,返回接下来的10条
    

你可能感兴趣的:(数据库,数据库,细节对比)