MySQL驱动参数你知道多少呢?常见的几个大家应该都见过,如下:| 参数 | 说明 |
| user | 数据库用户名 |
| password | 用户密码 |
| useUnicode | 是否使用Unicode字符集,如果参数characterEncoding设置为gb2312或gbk,本参数值必须设置为true |
| characterEncoding | 当useUnicode设置为true时,指定字符编码。比如可设置为gb2312或gbk |
| autoReconnect | 当数据库连接异常中断时,是否自动重新连接。true为自动连接;false则相反。 |
| autoReconnectForPools | 是否使用针对数据库连接池的重连策略 |
| failOverReadOnly | 自动重连成功后,连接是否设置为只读 |
| maxReconnects | 设置为true时,重试连接的次数3 |
| initialTimeout | 设置为true时,两次重连之间的时间间隔,单位:秒 |
| connectTimeout | 连接超时框时间(以毫秒为单位),0 表示没有超时。 |
| socketTimeout | 网络套接字操作的超时时间,以毫秒为单位指定。值“0”表示没有超时。 |
| sslMode | 默认情况下,网络连接是 SSL 加密的;此属性允许关闭安全连接,或选择不同的安全级别。 |
| connectionTimeZone | 数据库连接时区 |
| rewriteBatchedStatements | 重写SQL,以提高批量操作的性能 |
| logSlowQueries | 是否启用慢查询日志 |
| slowQueryThresholdMillis | logSlowQueries为true的情况下,此参数用于配置慢查询的时间,大于 这个值就是慢查询 |
| 属性名称 | 默认值 | 发布版本 |
| user | - | 所有版本 |
| password | - | 所有版本 |
| password1 | - | 8.0.28 |
| password2 | - | 8.0.28 |
| password3 | - | 8.0.28 |
| authenticationPlugins | - | 5.1.19 |
| disabledAuthenticationPlugins | - | 5.1.19 |
| ociConfigFile | - | 8.0.27 |
| authenticationFidoCallbackHandler | - | 8.0.29 |
| defaultAuthenticationPlugin | mysql_native_password | 5.1.19 |
| ldapServerHostname | - | 8.0.23 |
| 属性名称 | 默认值 | 发布版本 |
| connectionAttributes | - | 5.1.25 |
| connectionLifecycleInterceptors | - | 5.1.4 |
| useConfigs | - | 3.1.5 |
| clientInfoProvider | com.mysql.cj.jdbc.CommentClientInfoProvider | 5.1.0 |
| createDatabaseIfNotExist | false | 3.1.9 |
| databaseTerm | CATALOG | 8.0.17 |
| detectCustomCollations | false | 5.1.29 |
| disconnectOnExpiredPasswords | true | 5.1.23 |
| interactiveClient | false | 3.1.0 |
| passwordCharacterEncoding | - | 5.1.7 |
| propertiesTransform | - | 3.1.4 |
| rollbackOnPooledClose | true | 3.0.15 |
| useAffectedRows | false | 5.1.7 |
| 属性名称 | 默认值 | 发布版本 |
| sessionVariables | - | 3.1.8 |
| characterEncoding | - | 1.1g |
| characterSetResults | - | 3.0.13 |
| connectionCollation | - | 3.0.13 |
| customCharsetMapping | - | 8.0.26 |
| trackSessionState | false | 8.0.26 |
| 属性名称 | 默认值 | 发布版本 |
| 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 | false | 8.0.19 |
| localSocketAddress | - | 5.0.5 |
| maxAllowedPacket | 65535 | 5.1.8 |
| socksProxyRemoteDns | false | 8.0.29 |
| tcpKeepAlive | true | 5.0.7 |
| tcpNoDelay | true | 5.0.7 |
| tcpRcvBuf | 0 | 5.0.7 |
| tcpSndBuf | 0 | 5.0.7 |
| tcpTrafficClass | 0 | 5.0.7 |
| useCompression | false | 3.0.17 |
| useUnbufferedInput | true | 3.0.11 |
| 属性名称 | 默认值 | 发布版本 |
| paranoid | false | 3.0.1 |
| serverRSAPublicKeyFile | - | 5.1.31 |
| allowPublicKeyRetrieval | false | 5.1.31 |
| sslMode | PREFERRED | 8.0.13 |
| trustCertificateKeyStoreUrl | - | 5.1.0 |
| trustCertificateKeyStoreType | JKS | 5.1.0 |
| trustCertificateKeyStorePassword | - | 5.1.0 |
| fallbackToSystemTrustStore | true | 8.0.22 |
| clientCertificateKeyStoreUrl | - | 5.1.0 |
| clientCertificateKeyStoreType | JKS | 5.1.0 |
| clientCertificateKeyStorePassword | - | 5.1.0 |
| fallbackToSystemKeyStore | true | 8.0.22 |
| tlsCiphersuites | - | 5.1.35 |
| tlsVersions | - | 8.0.8 |
| allowLoadLocalInfile | false | 3.0.3 |
| allowLoadLocalInfileInPath | - | 8.0.22 |
| allowMultiQueries | false | 3.1.1 |
| allowUrlInLocalInfile | false | 3.1.4 |
| requireSSL | false | 3.1.0 |
| useSSL | true | 3.0.2 |
| verifyServerCertificate | false | 5.1.6 |
| 属性名称 | 默认值 | 发布版本 |
| cacheDefaultTimeZone | true | 8.0.20 |
| continueBatchOnError | true | 3.0.3 |
| dontTrackOpenResources | false | 3.1.7 |
| queryInterceptors | - | 8.0.7 |
| queryTimeoutKillsConnection | false | 5.1.9 |
| 属性名称 | 默认值 | 发布版本 |
| allowNanAndInf | false | 3.1.5 |
| autoClosePStmtStreams | false | 3.1.12 |
| compensateOnDuplicateKeyUpdateCounts | false | 5.1.7 |
| emulateUnsupportedPstmts | true | 3.1.7 |
| generateSimpleParameterMetadata | false | 5.0.5 |
| processEscapeCodesForPrepStmts | true | 3.1.12 |
| useServerPrepStmts | false | 3.1.0 |
| useStreamLengthsInPrepStmts | true | 3.0.2 |
| 属性名称 | 默认值 | 发布版本 |
| clobberStreamingResults | false | 3.0.9 |
| emptyStringsConvertToZero | true | 3.1.8 |
| holdResultsOpenOverStatementClose | false | 3.1.7 |
| jdbcCompliantTruncation | true | 3.1.2 |
| maxRows | -1 | all versions |
| netTimeoutForStreamingResults | 600 | 5.1.0 |
| padCharsWithSpace | false | 5.0.6 |
| populateInsertRowWithDefaultValues | false | 5.0.5 |
| scrollTolerantForwardOnly | false | 8.0.24 |
| strictUpdates | true | 3.0.4 |
| tinyInt1isBit | true | 3.0.16 |
| transformedBitIsBoolean | false | 3.1.9 |
| 属性名称 | 默认值 | 发布版本 |
| getProceduresReturnsFunctions | true | 5.1.26 |
| noAccessToProcedureBodies | false | 5.0.3 |
| nullDatabaseMeansCurrent | false | 3.1.8 |
| useHostsInPrivileges | true | 3.0.2 |
| useInformationSchema | false | 5.0.0 |
| 属性名称 | 默认值 | 发布版本 |
| autoDeserialize | false | 3.1.5 |
| blobSendChunkSize | 1048576 | 3.1.9 |
| blobsAreStrings | false | 5.0.8 |
| clobCharacterEncoding | - | 5.0.0 |
| emulateLocators | false | 3.1.0 |
| functionsNeverReturnBlobs | false | 5.0.8 |
| locatorFetchBufferSize | 1048576 | 3.2.1 |
| 属性名称 | 默认值 | 发布版本 |
| connectionTimeZone | - | 3.0.2 |
| forceConnectionTimeZoneToSession | false | 8.0.23 |
| noDatetimeStringSync | false | 3.1.7 |
| preserveInstants | true | 8.0.23 |
| sendFractionalSeconds | true | 5.1.37 |
| sendFractionalSecondsForTime | true | 8.0.23 |
| treatUtilDateAsTimestamp | true | 5.0.5 |
| yearIsDateType | true | 3.1.9 |
| zeroDateTimeBehavior | EXCEPTION | 3.1.4 |
| 属性名称 | 默认值 | 发布版本 |
| autoReconnect | false | 1.1 |
| autoReconnectForPools | false | 3.1.3 |
| failOverReadOnly | true | 3.0.12 |
| maxReconnects | 3 | 1.1 |
| reconnectAtTxEnd | false | 3.0.10 |
| retriesAllDown | 120 | 5.1.6 |
| initialTimeout | 2 | 1.1 |
| queriesBeforeRetrySource | 50 | 3.0.2 |
| secondsBeforeRetrySource | 30 | 3.0.2 |
| allowReplicaDownConnections | false | 6.0.2 |
| allowSourceDownConnections | false | 5.1.27 |
| ha.enableJMX | false | 5.1.27 |
| loadBalanceHostRemovalGracePeriod | 15000 | 6.0.3 |
| readFromSourceWhenNoReplicas | false | 6.0.2 |
| selfDestructOnPingMaxOperations | 0 | 5.1.6 |
| selfDestructOnPingSecondsLifetime | 0 | 5.1.6 |
| ha.loadBalanceStrategy | random | 5.0.6 |
| loadBalanceAutoCommitStatementRegex | - | 5.1.15 |
| loadBalanceAutoCommitStatementThreshold | 0 | 5.1.15 |
| loadBalanceBlocklistTimeout | 0 | 5.1.0 |
| loadBalanceConnectionGroup | - | 5.1.13 |
| loadBalanceExceptionChecker | com.mysql.cj.jdbc.ha.StandardLoadBalanceExceptionChecker | 5.1.13 |
| loadBalancePingTimeout | 0 | 5.1.13 |
| loadBalanceSQLExceptionSubclassFailover | - | 5.1.13 |
| loadBalanceSQLStateFailover | - | 5.1.13 |
| loadBalanceValidateConnectionOnSwapServer | false | 5.1.13 |
| pinGlobalTxToPhysicalConnection | false | 5.0.1 |
| replicationConnectionGroup | - | 8.0.7 |
| resourceId | - | 5.0.1 |
| serverAffinityOrder | - | 8.0.8 |
| 属性名称 | 默认值 | 发布版本 |
| callableStmtCacheSize | 100 | 3.1.2 |
| metadataCacheSize | 50 | 3.1.1 |
| useLocalSessionState | false | 3.1.7 |
| useLocalTransactionState | false | 5.1.7 |
| prepStmtCacheSize | 25 | 3.0.10 |
| prepStmtCacheSqlLimit | 256 | 3.0.10 |
| queryInfoCacheFactory | com.mysql.cj.PerConnectionLRUFactory | 5.1.1 |
| serverConfigCacheFactory | com.mysql.cj.util.PerVmServerConfigCacheFactory | 5.1.1 |
| alwaysSendSetIsolation | true | 3.1.7 |
| maintainTimeStats | true | 3.1.9 |
| useCursorFetch | false | 5.0.0 |
| cacheCallableStmts | false | 3.1.2 |
| cachePrepStmts | false | 3.0.10 |
| cacheResultSetMetadata | false | 3.1.1 |
| cacheServerConfiguration | false | 3.1.5 |
| defaultFetchSize | 0 | 3.1.9 |
| dontCheckOnDuplicateKeyUpdateInSQL | false | 5.1.32 |
| elideSetAutoCommits | false | 3.1.3 |
| enableEscapeProcessing | true | 6.0.1 |
| enableQueryTimeouts | true | 5.0.6 |
| largeRowSizeThreshold | 2048 | 5.1.1 |
| readOnlyPropagatesToServer | true | 5.1.35 |
| rewriteBatchedStatements | false | 3.1.13 |
| useReadAheadInput | true | 3.1.5 |
| 属性名称 | 默认值 | 发布版本 |
| logger | com.mysql.cj.log.StandardLogger | 3.1.1 |
| profilerEventHandler | com.mysql.cj.log.LoggingProfilerEventHandler | 5.1.6 |
| useNanosForElapsedTime | false | 5.0.7 |
| maxQuerySizeToLog | 2048 | 3.1.3 |
| maxByteArrayAsHex | 1024 | 8.0.31 |
| profileSQL | false | 3.1.0 |
| logSlowQueries | false | 3.1.2 |
| slowQueryThresholdMillis | 2000 | 3.1.2 |
| slowQueryThresholdNanos | 0 | 5.0.7 |
| autoSlowLog | true | 5.1.4 |
| explainSlowQueries | false | 3.1.2 |
| gatherPerfMetrics | false | 3.1.2 |
| reportMetricsIntervalMillis | 30000 | 3.1.2 |
| logXaCommands | false | 5.0.5 |
| traceProtocol | false | 3.1.2 |
| enablePacketDebug | false | 3.1.3 |
| packetDebugBufferSize | 20 | 3.1.3 |
| useUsageAdvisor | false | 3.1.1 |
| resultSetSizeThreshold | 100 | 5.0.5 |
| autoGenerateTestcaseScript | false | 3.1.9 |
| 属性名称 | 默认值 | 发布版本 |
| dumpQueriesOnException | false | 3.1.3 |
| exceptionInterceptors | - | 5.1.8 |
| ignoreNonTxTables | false | 3.0.9 |
| includeInnodbStatusInDeadlockExceptions | false | 5.0.7 |
| includeThreadDumpInDeadlockExceptions | false | 5.1.15 |
| includeThreadNamesAsStatementComment | false | 5.1.15 |
| useOnlyServerErrorMessages | true | 3.0.15 |
| 属性名称 | 默认值 | 发布版本 |
| overrideSupportsIntegrityEnhancementFacility | false | 3.1.12 |
| ultraDevHack | false | 2.0.3 |
| 属性名称 | 默认值 | 发布版本 |
| useColumnNamesInFindColumn | false | 5.1.7 |
| pedantic | false | 3.0.0 |
| useOldAliasMetadataBehavior | false | 5.0.4 |
| 属性名称 | 默认值 | 发布版本 |
| xdevapi.auth | PLAIN | 8.0.8 |
| xdevapi.compression | PREFERRED | 8.0.20 |
| xdevapi.compression-algorithms | zstd_stream,lz4_message,deflate_stream | 8.0.22 |
| xdevapi.compression-extensions | - | 8.0.22 |
| xdevapi.connect-timeout | 10000 | 8.0.13 |
| xdevapi.connection-attributes | - | 8.0.16 |
| xdevapi.dns-srv | false | 8.0.19 |
| xdevapi.fallback-to-system-keystore | true | 8.0.22 |
| xdevapi.fallback-to-system-truststore | true | 8.0.22 |
| xdevapi.ssl-keystore | - | 8.0.22 |
| xdevapi.ssl-keystore-password | - | 8.0.22 |
| xdevapi.ssl-keystore-type | JKS | 8.0.22 |
| xdevapi.ssl-mode | REQUIRED | 8.0.7 |
| xdevapi.ssl-truststore | - | 6.0.6 |
| xdevapi.ssl-truststore-password | - | 6.0.6 |
| xdevapi.ssl-truststore-type | JKS | 6.0.6 |
| xdevapi.tls-ciphersuites | - | 8.0.19 |
| xdevapi.tls-versions | - | 8.0.19 |
exe应该在我打开页面时运行。异步进程需要运行。有什么方法可以在ruby中使用两个参数异步运行exe吗?我已经尝试过ruby命令-system()、exec()但它正在等待过程完成。我需要用参数启动exe,无需等待进程完成是否有任何rubygems会支持我的问题? 最佳答案 您可以使用Process.spawn和Process.wait2:pid=Process.spawn'your.exe','--option'#Later...pid,status=Process.wait2pid您的程序将作为解释器的子进程执行。除
我有一些Ruby代码,如下所示:Something.createdo|x|x.foo=barend我想编写一个测试,它使用double代替block参数x,这样我就可以调用:x_double.should_receive(:foo).with("whatever").这可能吗? 最佳答案 specify'something'dox=doublex.should_receive(:foo=).with("whatever")Something.should_receive(:create).and_yield(x)#callthere
我正在为一个项目制作一个简单的shell,我希望像在Bash中一样解析参数字符串。foobar"helloworld"fooz应该变成:["foo","bar","helloworld","fooz"]等等。到目前为止,我一直在使用CSV::parse_line,将列分隔符设置为""和.compact输出。问题是我现在必须选择是要支持单引号还是双引号。CSV不支持超过一个分隔符。Python有一个名为shlex的模块:>>>shlex.split("Test'helloworld'foo")['Test','helloworld','foo']>>>shlex.split('Test"
我不确定传递给方法的对象的类型是否正确。我可能会将一个字符串传递给一个只能处理整数的函数。某种运行时保证怎么样?我看不到比以下更好的选择:defsomeFixNumMangler(input)raise"wrongtype:integerrequired"unlessinput.class==FixNumother_stuffend有更好的选择吗? 最佳答案 使用Kernel#Integer在使用之前转换输入的方法。当无法以任何合理的方式将输入转换为整数时,它将引发ArgumentError。defmy_method(number)
两者都可以defsetup(options={})options.reverse_merge:size=>25,:velocity=>10end和defsetup(options={}){:size=>25,:velocity=>10}.merge(options)end在方法的参数中分配默认值。问题是:哪个更好?您更愿意使用哪一个?在性能、代码可读性或其他方面有什么不同吗?编辑:我无意中添加了bang(!)...并不是要询问nobang方法与bang方法之间的区别 最佳答案 我倾向于使用reverse_merge方法:option
我有一个只接受一个参数的方法:defmy_method(number)end如果使用number调用方法,我该如何引发错误??通常,我如何定义方法参数的条件?比如我想在调用的时候报错:my_method(1) 最佳答案 您可以添加guard在函数的开头,如果参数无效则引发异常。例如:defmy_method(number)failArgumentError,"Inputshouldbegreaterthanorequalto2"ifnumbereputse.messageend#=>Inputshouldbegreaterthano
我没有找到太多关于如何执行此操作的信息,尽管有很多关于如何使用像这样的redirect_to将参数传递给重定向的建议:action=>'something',:controller=>'something'在我的应用程序中,我在路由文件中有以下内容match'profile'=>'User#show'我的表演Action是这样的defshow@user=User.find(params[:user])@title=@user.first_nameend重定向发生在同一个用户Controller中,就像这样defregister@title="Registration"@user=Use
对于作为String#tr参数的单引号字符串文字中反斜杠的转义状态,我觉得有些神秘。你能解释一下下面三个例子之间的对比吗?我特别不明白第二个。为了避免复杂化,我在这里使用了'd',在双引号中转义时不会改变含义("\d"="d")。'\\'.tr('\\','x')#=>"x"'\\'.tr('\\d','x')#=>"\\"'\\'.tr('\\\d','x')#=>"x" 最佳答案 在tr中转义tr的第一个参数非常类似于正则表达式中的括号字符分组。您可以在表达式的开头使用^来否定匹配(替换任何不匹配的内容)并使用例如a-f来匹配一
我正在使用RubyonRails3.0.9,我想生成一个传递一些自定义参数的link_toURL。也就是说,有一个articles_path(www.my_web_site_name.com/articles)我想生成如下内容:link_to'Samplelinktitle',...#HereIshouldimplementthecode#=>'http://www.my_web_site_name.com/articles?param1=value1¶m2=value2&...我如何编写link_to语句“alàRubyonRailsWay”以实现该目的?如果我想通过传递一些
按照目前的情况,这个问题不适合我们的问答形式。我们希望答案得到事实、引用或专业知识的支持,但这个问题可能会引发辩论、争论、投票或扩展讨论。如果您觉得这个问题可以改进并可能重新打开,visitthehelpcenter指导。关闭10年前。问题1)我想知道rubyonrails是否有功能类似于primefaces的gem。我问的原因是如果您使用primefaces(http://www.primefaces.org/showcase-labs/ui/home.jsf),开发人员无需担心javascript或jquery的东西。据我所知,JSF是一个规范,基于规范的各种可用实现,prim