-
Notifications
You must be signed in to change notification settings - Fork 8.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
druid1.2.8以上的版本中jdbc:mysql:loadbalance://执行超过10秒会报超时错误 #5396
Comments
核实是initFromUrlOrProperties方法,没有判断loadbalance格式的url,没有识别到参数。 |
lizongbo
added a commit
to lizongbo/druid
that referenced
this issue
Sep 30, 2023
针对mysql loadbalance格式的url,加上connectTimeout等属性的识别支持 alibaba#5396 if (jdbcUrl.startsWith("jdbc:mysql://") || jdbcUrl.startsWith("jdbc:mysql:loadbalance://")) { 配套单侧验证ok,mvn validate验证ok,mvn clean install 无新增错误
wenshao
pushed a commit
that referenced
this issue
Sep 30, 2023
* 针对mysql loadbalance格式的url,加上connectTimeout等属性的识别支持 #5396 针对mysql loadbalance格式的url,加上connectTimeout等属性的识别支持 #5396 if (jdbcUrl.startsWith("jdbc:mysql://") || jdbcUrl.startsWith("jdbc:mysql:loadbalance://")) { 配套单侧验证ok,mvn validate验证ok,mvn clean install 无新增错误 * 解决PG时使用KeepSourceLocation不生效的问题 #5287 传入参数加上 features ,mvn validate 通过,单测验证ok
请使用最新版本。 |
还没发布呃 |
1.2.20已经发布,请更新 |
测试可以了,感谢。 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
1.2.8以上版本,当协议是jdbc:mysql:loadbalance://时,查询超过10秒就会报错.
经过验证发现1.2.8以上的版本中新增了一个socketTimeout属性,而这个属性在1.2.8以上的版本中无论是connectionProperties中设置还是直接在url中设置都不生效.只能在获取到数据源对象后,手动设置一下才可以.
如果我把协议换成jdbc:mysql://时,则1.2.8以上在url中加上socketTimeout也可以支持.但是这样就不支持集群了,只能固定一个数据库地址查询.
如果把druid换成1.2.8版本,则不需要配置socketTimeout这些属性就不会报错,推测1.2.8及以下的版本是读取的maxWait这个属性.
`com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure
The last packet successfully received from the server was 10,090 milliseconds ago. The last packet sent successfully to the server was 10,090 milliseconds ago.
at com.mysql.cj.jdbc.exceptions.SQLError.createCommunicationsException(SQLError.java:174)
at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:64)
at com.mysql.cj.jdbc.ClientPreparedStatement.executeInternal(ClientPreparedStatement.java:974)
at com.mysql.cj.jdbc.ClientPreparedStatement.executeQuery(ClientPreparedStatement.java:1024)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.mysql.cj.jdbc.ha.MultiHostConnectionProxy$JdbcInterfaceProxy.invoke(MultiHostConnectionProxy.java:105)
at com.sun.proxy.$Proxy88.executeQuery(Unknown Source)
at com.alibaba.druid.pool.DruidPooledPreparedStatement.executeQuery(DruidPooledPreparedStatement.java:213)`
The text was updated successfully, but these errors were encountered: