10bet网址
MySQL连接器/ J 8.0开发者指南
相关的文档10bet官方网站 本手册下载
PDF (Ltr)- 0.8 mb
PDF (A4)- 0.8 mb
HTML下载(TGZ)- 146.7 kb
HTML下载(邮政编码)- 166.0 kb


6.3配置属性

配置属性定义连接器/ J将如何连接到MySQL服务器。除非另有说明,否则可以为数据源对象或用于连接对象。

配置属性可以通过以下方式设置:

  • 使用设置* ()方法的MySQL实现java.sql.DataSource(这是使用的实现时的首选方法java.sql.DataSource):

    • com.mysql.cj.jdbc.MysqlDataSource

    • com.mysql.cj.jdbc.MysqlConnectionPoolDataSource

  • 的键-值对java.util.Properties实例传递给DriverManager.getConnection ()Driver.connect ()

  • 作为给定URL中的JDBC URL参数java.sql.DriverManager.getConnection ()java.sql.Driver.connect ()的MySQL实现javax.sql.DataSourcesetURL ()方法。如果您在URL中指定配置属性而没有为其提供值,则什么也不会设置;例如,添加useServerPrepStmts单独到URL不使Connector/J使用服务器端准备语句;你需要添加useServerPrepStmts = true

    请注意

    如果用于配置JDBC URL的机制是基于XML的,则使用XML字符文字,分隔配置参数,因为“&”是XML的保留字符。

属性是按类别列出的,先在下表中列出,然后在下面的子部分中列出。点击表中属性名看到部分的完整描述。

表6.1认证属性

的名字 默认值 从版本
用户 - 所有版本
密码 - 所有版本

表6.2连接属性

的名字 默认值 从版本
connectionAttributes - 5.1.25
connectionLifecycleInterceptors - 5.1.4
useConfigs - 3.1.5
authenticationPlugins - 5.1.19
clientInfoProvider com.mysql.cj.jdbc.CommentClientInfoProvider 5.1.0
createDatabaseIfNotExist 3.1.9
databaseTerm 目录 8.0.17
defaultAuthenticationPlugin mysql_native_password 5.1.19
detectCustomCollations 5.1.29
disabledAuthenticationPlugins - 5.1.19
disconnectOnExpiredPasswords 真正的 5.1.23
interactiveClient 3.1.0
ldapServerHostname - 8.0.23
passwordCharacterEncoding - 5.1.7
propertiesTransform - 3.1.4
rollbackOnPooledClose 真正的 3.0.15
useAffectedRows 5.1.7

表6.3会话属性

的名字 默认值 从版本
sessionVariables - 3.1.8中
characterEncoding - 1.1克
characterSetResults - 3.0.13
connectionCollation - 3.0.13

表6.4网络属性

的名字 默认值 从版本
socksProxyHost - 5.1.34
socksProxyPort 1080 5.1.34
socketFactory com.mysql.cj.protocol.StandardSocketFactory 3.0.3
connectTimeout 0 3.0.1
socketTimeout 0 3.0.1
dnsSrv 8.0.19
localSocketAddress - 5.0.5
maxAllowedPacket 65535 5.1.8
tcpKeepAlive 真正的 5.0.7
tcpNoDelay 真正的 5.0.7
tcpRcvBuf 0 5.0.7
tcpSndBuf 0 5.0.7
tcpTrafficClass 0 5.0.7
useCompression 3.0.17
useUnbufferedInput 真正的 此处


表6.6语句属性

的名字 默认值 从版本
cacheDefaultTimeZone 真正的 8.0.20
continueBatchOnError 真正的 3.0.3
dontTrackOpenResources 3.1.7
queryInterceptors - 8.0.7
queryTimeoutKillsConnection 5.1.9

表6.7预处理语句属性

的名字 默认值 从版本
allowNanAndInf 3.1.5
autoClosePStmtStreams 3.1.12
compensateOnDuplicateKeyUpdateCounts 5.1.7
emulateUnsupportedPstmts 真正的 3.1.7
generateSimpleParameterMetadata 5.0.5
processEscapeCodesForPrepStmts 真正的 3.1.12
useServerPrepStmts 3.1.0
useStreamLengthsInPrepStmts 真正的 3.0.2

表6.8结果集属性

的名字 默认值 从版本
clobberStreamingResults 3.0.9
emptyStringsConvertToZero 真正的 3.1.8中
holdResultsOpenOverStatementClose 3.1.7
jdbcCompliantTruncation 真正的 3.1.2
maxRows -1 所有版本
netTimeoutForStreamingResults 600 5.1.0
padCharsWithSpace 5.0.6
populateInsertRowWithDefaultValues 5.0.5
scrollTolerantForwardOnly 8.0.24
strictUpdates 真正的 3.0.4
tinyInt1isBit 真正的 3.0.16
transformedBitIsBoolean 3.1.9

表6.9元数据属性

的名字 默认值 从版本
getProceduresReturnsFunctions 真正的 5.1.26
noAccessToProcedureBodies 5.0.3
nullDatabaseMeansCurrent 3.1.8中
useHostsInPrivileges 真正的 3.0.2
useInformationSchema 5.0.0

表6.10 BLOB/CLOB处理属性

的名字 默认值 从版本
autoDeserialize 3.1.5
blobSendChunkSize 1048576 3.1.9
blobsAreStrings 5.0.8
clobCharacterEncoding - 5.0.0
emulateLocators 3.1.0
functionsNeverReturnBlobs 5.0.8
locatorFetchBufferSize 1048576 3.2.1之上

表6.11 Datetime类型处理属性

的名字 默认值 从版本
connectionTimeZone - 3.0.2
forceConnectionTimeZoneToSession 8.0.23
noDatetimeStringSync 3.1.7
preserveInstants 真正的 8.0.23
sendFractionalSeconds 真正的 5.1.37
sendFractionalSecondsForTime 真正的 8.0.23
treatUtilDateAsTimestamp 真正的 5.0.5
yearIsDateType 真正的 3.1.9
zeroDateTimeBehavior 异常 3.1.4


表6.13性能扩展属性

的名字 默认值 从版本
callableStmtCacheSize One hundred. 3.1.2
metadataCacheSize 50 3.1.1
useLocalSessionState 3.1.7
useLocalTransactionState 5.1.7
prepStmtCacheSize 25 3.0.10
prepStmtCacheSqlLimit 256 3.0.10
parseInfoCacheFactory com.mysql.cj.PerConnectionLRUFactory 5.1.1
serverConfigCacheFactory com.mysql.cj.util.PerVmServerConfigCacheFactory 5.1.1
alwaysSendSetIsolation 真正的 3.1.7
maintainTimeStats 真正的 3.1.9
useCursorFetch 5.0.0
cacheCallableStmts 3.1.2
cachePrepStmts 3.0.10
cacheResultSetMetadata 3.1.1
cacheServerConfiguration 3.1.5
defaultFetchSize 0 3.1.9
dontCheckOnDuplicateKeyUpdateInSQL 5.1.32
elideSetAutoCommits 3.1.3
enableEscapeProcessing 真正的 6.0.1中
enableQueryTimeouts 真正的 5.0.6
largeRowSizeThreshold 2048 5.1.1
readOnlyPropagatesToServer 真正的 5.1.35
rewriteBatchedStatements 3.1.13
useReadAheadInput 真正的 3.1.5

表6.14调试/分析属性

的名字 默认值 从版本
日志记录器 com.mysql.cj.log.StandardLogger 3.1.1
profilerEventHandler com.mysql.cj.log.LoggingProfilerEventHandler 5.1.6
useNanosForElapsedTime 5.0.7
maxQuerySizeToLog 2048 3.1.3
profileSQL 3.1.0
logSlowQueries 3.1.2
slowQueryThresholdMillis 2000 3.1.2
slowQueryThresholdNanos 0 5.0.7
autoSlowLog 真正的 5.1.4
explainSlowQueries 3.1.2
gatherPerfMetrics 3.1.2
reportMetricsIntervalMillis 30000 3.1.2
logXaCommands 5.0.5
traceProtocol 3.1.2
enablePacketDebug 3.1.3
packetDebugBufferSize 20. 3.1.3
useUsageAdvisor 3.1.1
resultSetSizeThreshold One hundred. 5.0.5
autoGenerateTestcaseScript 3.1.9

表6.15异常/警告属性


表6.16曲调与其他产品的集成特性

的名字 默认值 从版本
overrideSupportsIntegrityEnhancementFacility 3.1.12
ultraDevHack 2.0.3

表6.17 JDBC合规属性

的名字 默认值 从版本
useColumnNamesInFindColumn 5.1.7
学究式的 3.0.0
useOldAliasMetadataBehavior 5.0.4

表6.18 X协议和X DevAPI属性