首页 > 数据库 >关于MySql链接url参数的设置 专题

关于MySql链接url参数的设置 专题

时间:2023-01-02 18:32:54浏览次数:66  
标签:10 java 23 url MySql jar mysql com 链接

报错:

Establishing SSL connection without server's identity verification is not recommended.
According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set.
For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'.
You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.

解决办法:
在jdbc.url上添加配置:

useSSL=true

eg:

jdbc.url=jdbc:mysql://localhost:3306/dbName?useUnicode=true&useSSL=true

一个在用的配置:

?useUnicode=true&useSSL=true&autoReconnect=true&failOverReadOnly=false

 

jdbc.driverClassName=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://localhost:3306/database?useUnicode=true&characterEncoding=utf8&autoReconnect=true&rewriteBatchedStatements=TRUE
jdbc.username=root
jdbc.password=password

database.url=jdbc:mysql://database_server:3306/oauth?autoReconnect=true&useUnicode=true&createDatabaseIfNotExist=true&characterEncoding=utf8&useSSL=true&serverTimezone=UTC

 

特别说明其中的jdbc.url配置:如果你已经升级好了mysql-connector,其中的characterEncoding=utf8可以被自动被识别为utf8mb4(当然也兼容原来的utf8),而autoReconnect配置我强烈建议配上,我之前就是忽略了这个属性,导致因为缓存缘故,没有读取到DB最新配置,导致一直无法使用utf8mb4字符集,多么痛的领悟!!

没有让mysql驱动开启批量执行sql的开关。

怎么开启呢?在拼装mysql链接的url时,为其加上allowMultiQueries参数,设置为true,如下:

jdbc.jdbcUrl=jdbc:mysql://127.0.0.1:3306/database?useUnicode=true&characterEncoding=utf8&allowMultiQueries=true

mysql JDBC URL格式如下: 


jdbc:mysql://[host:port],[host:port].../[database][?参数名1][=参数值1][&参数名2][=参数值2]... 


常用的几个较为重要的参数: 


参数名称                                         参数说明                                           缺省值                                                                                                                  最低版本要求 

user                                        数据库用户名(用于连接数据库)                      所有版本 

passWord                                  用户密码(用于连接数据库)                    所有版本 

useUnicode                            是否使用Unicode字符集,如果参数characterEncoding设置为gb2312或gbk,本参数值必须设置为true false 1.1g 

characterEncoding                当useUnicode设置为true时,指定字符编码。比如可设置为gb2312或gbk false 1.1g 

autoReconnect                          当数据库连接异常中断时,是否自动重新连接? false 1.1 

autoReconnectForPools              是否使用针对数据库连接池的重连策略 false 3.1.3 

failOverReadOnly                        自动重连成功后,连接是否设置为只读? true 3.0.12 

maxReconnects                         autoReconnect设置为true时,重试连接的次数 3 1.1 

initialTimeout                               autoReconnect 设置为true时,两次重连之间的时间间隔,单位:秒 2 1.1 

connectTimeout                             和数据库服务器建立socket连接时的超时,单位:毫秒。 0表示永不超时,适用于JDK 1.4及更高版本 0 3.0.1 

socketTimeout                                socket操作(读写)超时,单位:毫秒。 0表示永不超时 0 3.0.1 


关于MySql链接url参数的设置  专题_url

 

driver.url = jdbc:mysql://127.0.0.1:3306/admin?useUnicode=true&useSSL=true&autoReconnect=true&failOverReadOnly=false&maxReconnects=30

com.alibaba.otter.manager.biz.common.exceptions.ManagerException: com.alibaba.otter.manager.biz.common.exceptions.ManagerException: org.springframework.dao.DataAccessResourceFailureException: SqlMapClient operation; SQL [];
--- The error occurred while applying a parameter map.
--- Check the listPipelineByIds-InlineParameterMap.
--- Check the statement (query failed).
--- Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 30 times. Giving up.; nested exception is com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred while applying a parameter map.
--- Check the listPipelineByIds-InlineParameterMap.
--- Check the statement (query failed).
--- Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 30 times. Giving up.
at com.alibaba.otter.manager.biz.config.record.impl.LogRecordServiceImpl.modelToDo(LogRecordServiceImpl.java:165) ~[manager.biz-4.2.18-SNAPSHOT.jar:na]
at com.alibaba.otter.manager.biz.config.record.impl.LogRecordServiceImpl.create(LogRecordServiceImpl.java:68) ~[manager.biz-4.2.18-SNAPSHOT.jar:na]
at com.alibaba.otter.manager.biz.config.record.impl.LogRecordServiceImpl.create(LogRecordServiceImpl.java:45) ~[manager.biz-4.2.18-SNAPSHOT.jar:na]
at com.alibaba.otter.manager.biz.monitor.impl.AbstractRuleMonitor.logRecordAlarm(AbstractRuleMonitor.java:107) ~[manager.biz-4.2.18-SNAPSHOT.jar:na]
at com.alibaba.otter.manager.biz.monitor.impl.ExceptionRuleMonitor.feed(ExceptionRuleMonitor.java:63) ~[manager.biz-4.2.18-SNAPSHOT.jar:na]
at com.alibaba.otter.manager.biz.remote.impl.ArbitrateRemoteServiceImpl.onNodeAlarm(ArbitrateRemoteServiceImpl.java:58) ~[manager.biz-4.2.18-SNAPSHOT.jar:na]
at sun.reflect.GeneratedMethodAccessor318.invoke(Unknown Source) ~[na:na]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_181]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_181]
at com.alibaba.otter.shared.communication.core.impl.AbstractCommunicationEndpoint.acceptEvent(AbstractCommunicationEndpoint.java:72) [shared.communication-4.2.18-SNAPSHOT.jar:na]
at com.alibaba.dubbo.common.bytecode.Wrapper0.invokeMethod(Wrapper0.java) [na:2.5.3]
at com.alibaba.dubbo.rpc.proxy.javassist.JavassistProxyFactory$1.doInvoke(JavassistProxyFactory.java:46) [dubbo-2.5.3.jar:2.5.3]
at com.alibaba.dubbo.rpc.proxy.AbstractProxyInvoker.invoke(AbstractProxyInvoker.java:72) [dubbo-2.5.3.jar:2.5.3]
at com.alibaba.dubbo.rpc.protocol.dubbo.DubboProtocol$1.reply(DubboProtocol.java:108) [dubbo-2.5.3.jar:2.5.3]
at com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.handleRequest(HeaderExchangeHandler.java:84) [dubbo-2.5.3.jar:2.5.3]
at com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.received(HeaderExchangeHandler.java:170) [dubbo-2.5.3.jar:2.5.3]
at com.alibaba.dubbo.remoting.transport.DecodeHandler.received(DecodeHandler.java:52) [dubbo-2.5.3.jar:2.5.3]
at com.alibaba.dubbo.remoting.transport.dispatcher.ChannelEventRunnable.run(ChannelEventRunnable.java:82) [dubbo-2.5.3.jar:2.5.3]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_181]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_181]
at java.lang.Thread.run(Thread.java:748) [na:1.8.0_181]
Caused by: com.alibaba.otter.manager.biz.common.exceptions.ManagerException: org.springframework.dao.DataAccessResourceFailureException: SqlMapClient operation; SQL [];
--- The error occurred while applying a parameter map.
--- Check the listPipelineByIds-InlineParameterMap.
--- Check the statement (query failed).
--- Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 30 times. Giving up.; nested exception is com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred while applying a parameter map.
--- Check the listPipelineByIds-InlineParameterMap.
--- Check the statement (query failed).
--- Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 30 times. Giving up.
at com.alibaba.otter.manager.biz.config.pipeline.impl.PipelineServiceImpl.listByIds(PipelineServiceImpl.java:356) ~[manager.biz-4.2.18-SNAPSHOT.jar:na]
at com.alibaba.otter.manager.biz.config.pipeline.impl.PipelineServiceImpl.findById(PipelineServiceImpl.java:222) ~[manager.biz-4.2.18-SNAPSHOT.jar:na]
at com.alibaba.otter.manager.biz.config.pipeline.impl.PipelineServiceImpl.findById(PipelineServiceImpl.java:53) ~[manager.biz-4.2.18-SNAPSHOT.jar:na]
at com.alibaba.otter.manager.biz.config.channel.impl.ChannelServiceImpl.findByPipelineId(ChannelServiceImpl.java:280) ~[manager.biz-4.2.18-SNAPSHOT.jar:na]
at com.alibaba.otter.manager.biz.config.record.impl.LogRecordServiceImpl.modelToDo(LogRecordServiceImpl.java:145) ~[manager.biz-4.2.18-SNAPSHOT.jar:na]
... 20 common frames omitted
Caused by: org.springframework.dao.DataAccessResourceFailureException: SqlMapClient operation; SQL [];
--- The error occurred while applying a parameter map.
--- Check the listPipelineByIds-InlineParameterMap.
--- Check the statement (query failed).
--- Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 30 times. Giving up.; nested exception is com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred while applying a parameter map.
--- Check the listPipelineByIds-InlineParameterMap.
--- Check the statement (query failed).
--- Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 30 times. Giving up.
at org.springframework.jdbc.support.SQLStateSQLExceptionTranslator.doTranslate(SQLStateSQLExceptionTranslator.java:104) ~[spring-jdbc-3.1.2.RELEASE.jar:3.1.2.RELEASE]
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:72) ~[spring-jdbc-3.1.2.RELEASE.jar:3.1.2.RELEASE]
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80) ~[spring-jdbc-3.1.2.RELEASE.jar:3.1.2.RELEASE]
at org.springframework.orm.ibatis.SqlMapClientTemplate.execute(SqlMapClientTemplate.java:203) ~[spring-orm-3.1.2.RELEASE.jar:3.1.2.RELEASE]
at org.springframework.orm.ibatis.SqlMapClientTemplate.queryForList(SqlMapClientTemplate.java:293) ~[spring-orm-3.1.2.RELEASE.jar:3.1.2.RELEASE]
at com.alibaba.otter.manager.biz.config.pipeline.dal.ibatis.IbatisPipelineDAO.listByMultiId(IbatisPipelineDAO.java:78) ~[manager.biz-4.2.18-SNAPSHOT.jar:na]
at com.alibaba.otter.manager.biz.config.pipeline.impl.PipelineServiceImpl.listByIds(PipelineServiceImpl.java:346) ~[manager.biz-4.2.18-SNAPSHOT.jar:na]
... 24 common frames omitted
Caused by: com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred while applying a parameter map.
--- Check the listPipelineByIds-InlineParameterMap.
--- Check the statement (query failed).
--- Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 30 times. Giving up.
at com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeQueryWithCallback(MappedStatement.java:201) ~[ibatis-sqlmap-2.3.4.726.jar:na]
at com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeQueryForList(MappedStatement.java:139) ~[ibatis-sqlmap-2.3.4.726.jar:na]
at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:567) ~[ibatis-sqlmap-2.3.4.726.jar:na]
at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:541) ~[ibatis-sqlmap-2.3.4.726.jar:na]
at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForList(SqlMapSessionImpl.java:118) ~[ibatis-sqlmap-2.3.4.726.jar:na]
at org.springframework.orm.ibatis.SqlMapClientTemplate$3.doInSqlMapClient(SqlMapClientTemplate.java:295) ~[spring-orm-3.1.2.RELEASE.jar:3.1.2.RELEASE]
at org.springframework.orm.ibatis.SqlMapClientTemplate$3.doInSqlMapClient(SqlMapClientTemplate.java:1) ~[spring-orm-3.1.2.RELEASE.jar:3.1.2.RELEASE]
at org.springframework.orm.ibatis.SqlMapClientTemplate.execute(SqlMapClientTemplate.java:200) ~[spring-orm-3.1.2.RELEASE.jar:3.1.2.RELEASE]
... 27 common frames omitted
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 30 times. Giving up.
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_181]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:1.8.0_181]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_181]
at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[na:1.8.0_181]
at com.mysql.jdbc.Util.handleNewInstance(Util.java:425) ~[mysql-connector-java-5.1.40.jar:5.1.40]
at com.mysql.jdbc.Util.getInstance(Util.java:408) ~[mysql-connector-java-5.1.40.jar:5.1.40]
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:918) ~[mysql-connector-java-5.1.40.jar:5.1.40]
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:918) ~[mysql-connector-java-5.1.40.jar:5.1.40]
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:897) ~[mysql-connector-java-5.1.40.jar:5.1.40]
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:886) ~[mysql-connector-java-5.1.40.jar:5.1.40]
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:860) ~[mysql-connector-java-5.1.40.jar:5.1.40]
at com.mysql.jdbc.ConnectionImpl.connectWithRetries(ConnectionImpl.java:2163) ~[mysql-connector-java-5.1.40.jar:5.1.40]
at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2088) ~[mysql-connector-java-5.1.40.jar:5.1.40]
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2533) ~[mysql-connector-java-5.1.40.jar:5.1.40]
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1861) ~[mysql-connector-java-5.1.40.jar:5.1.40]
at com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:1192) ~[mysql-connector-java-5.1.40.jar:5.1.40]
at org.apache.commons.dbcp.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:172) ~[commons-dbcp-1.4.jar:1.4]
at org.apache.commons.dbcp.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:172) ~[commons-dbcp-1.4.jar:1.4]
at com.ibatis.sqlmap.engine.execution.SqlExecutor.executeQuery(SqlExecutor.java:185) ~[ibatis-sqlmap-2.3.4.726.jar:na]
at com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.sqlExecuteQuery(MappedStatement.java:221) ~[ibatis-sqlmap-2.3.4.726.jar:na]
at com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeQueryWithCallback(MappedStatement.java:189) ~[ibatis-sqlmap-2.3.4.726.jar:na]
... 34 common frames omitted
Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
at sun.reflect.GeneratedConstructorAccessor55.newInstance(Unknown Source) ~[na:na]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_181]
at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[na:1.8.0_181]
at com.mysql.jdbc.Util.handleNewInstance(Util.java:425) ~[mysql-connector-java-5.1.40.jar:5.1.40]
at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:989) ~[mysql-connector-java-5.1.40.jar:5.1.40]
at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:341) ~[mysql-connector-java-5.1.40.jar:5.1.40]
at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2251) ~[mysql-connector-java-5.1.40.jar:5.1.40]
at com.mysql.jdbc.ConnectionImpl.connectWithRetries(ConnectionImpl.java:2104) ~[mysql-connector-java-5.1.40.jar:5.1.40]
... 43 common frames omitted
Caused by: java.net.ConnectException: Connection refused (Connection refused)
at java.net.PlainSocketImpl.socketConnect(Native Method) ~[na:1.8.0_181]
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) ~[na:1.8.0_181]
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) ~[na:1.8.0_181]
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) ~[na:1.8.0_181]
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) ~[na:1.8.0_181]
at java.net.Socket.connect(Socket.java:589) ~[na:1.8.0_181]
at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:211) ~[mysql-connector-java-5.1.40.jar:5.1.40]
at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:300) ~[mysql-connector-java-5.1.40.jar:5.1.40]
... 45 common frames omitted

 

 


对应中文环境,通常mysql连接URL可以设置为:

代码如下:

jdbc:mysql://localhost:3306/test?user=root&password=&useUnicode=true&characterEncoding=utf8&autoReconnect=true&failOverReadOnly=false 

在使用数据库连接池的情况下,最好设置如下两个参数: 

autoReconnect=true&failOverReadOnly=false

需要注意的是,在xml配置文件中,url中的&符号需要转义成  &amp;  
比如在tomcat的server.xml中配置数据库连接池时,mysql jdbc url样例如下: 

代码如下:

jdbc:mysql://localhost:3306/test?user=root&password=&useUnicode=true&characterEncoding=utf8&autoReconnect=true&failOverReadOnly

​http://www.jb51.net/article/47764.htm​

备注:mysql5以上的,设置autoReconnect=true 是无效的 只有4.x版本,起作用 

jdbc:mysql://127.0.0.1:3306/demo_ds?useServerPrepStmts=true&cachePrepStmts=true
设置参数useServerPrepStmts=true,这个参数的作用是让MySQL服务进行prepare。没有这个参数就是让JDBC进行prepare,MySQL完全感知不到,是没有什么意义的。
cachePrepStmts=true这个参数的意思是告诉JDBC缓存需要prepare的SQL

报错:

Caused by: java.sql.SQLException: Value '0000-00-00' can not be represented as java.sql.Timestamp
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:964) ~[mysql-connector-java-5.1.42.jar:5.1.42]
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:897) ~[mysql-connector-java-5.1.42.jar:5.1.42]
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:886) ~[mysql-connector-java-5.1.42.jar:5.1.42]
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:860) ~[mysql-connector-java-5.1.42.jar:5.1.42]
at com.mysql.jdbc.ResultSetRow.getNativeTimestamp(ResultSetRow.java:620) ~[mysql-connector-java-5.1.42.jar:5.1.42]
at com.mysql.jdbc.ByteArrayRow.getNativeTimestamp(ByteArrayRow.java:187) ~[mysql-connector-java-5.1.42.jar:5.1.42]
at com.mysql.jdbc.ResultSetImpl.getNativeTimestamp(ResultSetImpl.java:4308) ~[mysql-connector-java-5.1.42.jar:5.1.42]
at com.mysql.jdbc.ResultSetImpl.getTimestampInternal(ResultSetImpl.java:5904) ~[mysql-connector-java-5.1.42.jar:5.1.42]
at com.mysql.jdbc.ResultSetImpl.getTimestamp(ResultSetImpl.java:5588) ~[mysql-connector-java-5.1.42.jar:5.1.42]
at com.mysql.jdbc.ResultSetImpl.getTimestamp(ResultSetImpl.java:5617) ~[mysql-connector-java-5.1.42.jar:5.1.42]

解决办法1:
在jdbc.url上添加配置:

zeroDateTimeBehavior=convertToNull

eg:
jdbc.url=jdbc:mysql://localhost:3306/dbName?useUnicode=true&useSSL=true&zeroDateTimeBehavior=convertToNull

原因:

对于值为0000-00-00 00:00:00(默认值)的记录,根据不同的配置,会返回不同的结果:
不配置:默认返回异常
zeroDateTimeBehavior=round 0001-01-01 00:00:00.0
zeroDateTimeBehavior=convertToNull null

解决方法2:
将日期"0000-00-00 00:00:00”改为正常日期即可。

关于"0000-00-00 00:00:00”:
在mysql中"0000-00-00 00:00:00”是作为一个特殊值存在的,但是在Java中, java.sql.Date 会被视为 不合法的值,被JVM认为格式不正确。

 

查询的结果集中某数据行的日期值为0000-00-00 00:00:00。因MySQL的时间类型datetime范围是1000-01-01 00:00:00 到 9999-12-31 23:59:59,所以报错。

 

 

 

 

 

在spring boot  2.1.6.RELEASE 中,如果没有配置&serverTimezone=Asia/Shanghai , 就会一直报错:

019-07-24 19:07:30.903 ERROR 9712 --- [eate-1446291553] com.alibaba.druid.pool.DruidDataSource   : create connection SQLException, url: jdbc:mysql://localhost:3306/wxmp?useUnicode=true&characterEncoding=utf-8&useSSL=false, errorCode 0, state 01S00

java.sql.SQLException: The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the serverTimezone configuration property) to use a more specifc time zone value if you want to utilize time zone support.
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:129) ~[mysql-connector-java-8.0.16.jar:8.0.16]
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97) ~[mysql-connector-java-8.0.16.jar:8.0.16]
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:89) ~[mysql-connector-java-8.0.16.jar:8.0.16]
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:63) ~[mysql-connector-java-8.0.16.jar:8.0.16]
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:73) ~[mysql-connector-java-8.0.16.jar:8.0.16]
at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:76) ~[mysql-connector-java-8.0.16.jar:8.0.16]
at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:835) ~[mysql-connector-java-8.0.16.jar:8.0.16]
at com.mysql.cj.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:455) ~[mysql-connector-java-8.0.16.jar:8.0.16]
at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:240) ~[mysql-connector-java-8.0.16.jar:8.0.16]
at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:199) ~[mysql-connector-java-8.0.16.jar:8.0.16]
at com.alibaba.druid.filter.FilterChainImpl.connection_connect(FilterChainImpl.java:156) ~[druid-1.1.10.jar:1.1.10]
at com.alibaba.druid.filter.stat.StatFilter.connection_connect(StatFilter.java:218) ~[druid-1.1.10.jar:1.1.10]
at com.alibaba.druid.filter.FilterChainImpl.connection_connect(FilterChainImpl.java:150) ~[druid-1.1.10.jar:1.1.10]
at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1560) ~[druid-1.1.10.jar:1.1.10]
at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1623) ~[druid-1.1.10.jar:1.1.10]
at com.alibaba.druid.pool.DruidDataSource$CreateConnectionThread.run(DruidDataSource.java:2468) ~[druid-1.1.10.jar:1.1.10]
Caused by: com.mysql.cj.exceptions.InvalidConnectionAttributeException: The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the serverTimezone configuration property) to use a more specifc time zone value if you want to utilize time zone support.
at sun.reflect.GeneratedConstructorAccessor48.newInstance(Unknown Source) ~[na:na]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_191]
at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[na:1.8.0_191]
at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:61) ~[mysql-connector-java-8.0.16.jar:8.0.16]
at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:85) ~[mysql-connector-java-8.0.16.jar:8.0.16]
at com.mysql.cj.util.TimeUtil.getCanonicalTimezone(TimeUtil.java:132) ~[mysql-connector-java-8.0.16.jar:8.0.16]
at com.mysql.cj.protocol.a.NativeProtocol.configureTimezone(NativeProtocol.java:2243) ~[mysql-connector-java-8.0.16.jar:8.0.16]
at com.mysql.cj.protocol.a.NativeProtocol.initServerSession(NativeProtocol.java:2267) ~[mysql-connector-java-8.0.16.jar:8.0.16]
at com.mysql.cj.jdbc.ConnectionImpl.initializePropsFromServer(ConnectionImpl.java:1319) ~[mysql-connector-java-8.0.16.jar:8.0.16]
at com.mysql.cj.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:966) ~[mysql-connector-java-8.0.16.jar:8.0.16]
at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:825) ~[mysql-connector-java-8.0.16.jar:8.0.16]
... 9 common frames omitted

Disconnected from the target VM, address: '127.0.0.1:57625', transport: 'socket'
2019-07-24 19:07:31.324 INFO 9712 --- [ Thread-15] o.s.s.concurrent.ThreadPoolTaskExecutor : Shutting down ExecutorService 'applicationTaskExecutor'
2019-07-24 19:07:31.332 INFO 9712 --- [ Thread-15] com.alibaba.druid.pool.DruidDataSource : {dataSource-1} closed
org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException:
### Error querying database. Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is com.alibaba.druid.pool.DataSourceDisableException
### The error may exist in file [D:\project\work\smartwx-boot\target\classes\mapper\AccountMapper.xml]
### The error may involve com.wxmp.wxcms.mapper.AccountDao.listForPage
### The error occurred while executing a query
### Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is com.alibaba.druid.pool.DataSourceDisableException
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:77)

高版本mysql的另外一个坑:

在将库中的下列日期转换成java.util.Date类型时报错:
2020-03-06 08:32:07
2020-03-06 08:32:07
2020-03-06 08:32:07
2020-03-06 08:32:07
2020-03-06 08:32:08
2020-03-06 08:32:08
2020-03-06 08:32:09
2020-03-06 08:32:09
2020-03-06 08:32:10
2020-03-06 08:32:11
2020-03-06 08:32:12
2020-03-06 08:32:12
2020-03-06 08:32:13
2020-03-06 08:33:07
2020-03-06 08:33:07
2020-03-06 08:33:08
2020-03-06 08:33:09
2020-03-06 08:33:09
2020-03-06 08:33:10
2020-03-06 08:33:10
2020-03-06 08:33:11
2020-03-06 08:33:11
2020-03-06 08:33:11
2020-03-06 08:33:12
2020-03-06 08:33:13
2020-03-06 08:33:13
2020-03-06 08:33:36
2020-03-06 08:34:07
2020-03-06 08:34:08
2020-03-06 08:34:08
2020-03-06 08:34:09
2020-03-06 08:34:09
2020-03-06 08:34:10
2020-03-06 08:34:11
2020-03-06 08:34:19
2020-03-06 08:34:20
2020-03-06 08:34:21
2020-03-06 08:34:22
2020-03-06 08:34:22
2020-03-06 08:34:24
2020-03-06 08:35:17
2020-03-06 08:35:18
2020-03-06 08:35:18
2020-03-06 08:35:19
2020-03-06 08:35:20
2020-03-06 08:35:22
2020-03-06 08:35:23
2020-03-06 08:36:07
2020-03-06 08:36:17
2020-03-06 08:36:18
2020-03-06 08:36:18
2020-03-06 08:36:19
2020-03-06 08:36:20
2020-03-06 08:36:20
2020-03-06 08:36:21
2020-03-06 08:36:21
2020-03-06 08:37:07
2020-03-06 08:38:07
2020-03-06 08:38:08
2020-03-06 08:39:17
2020-03-06 08:40:08
2020-03-06 08:40:08
2020-03-06 08:40:09
2020-03-06 08:40:09
2020-03-06 08:40:17
2020-03-06 08:40:20
2020-03-06 08:40:37
2020-03-06 08:41:19
2020-03-06 08:42:05
2020-03-06 08:42:07
2020-03-06 08:42:08
2020-03-06 08:42:08
2020-03-06 08:42:18
2020-03-06 08:44:08
2020-03-06 08:44:28
2020-03-06 08:45:08
2020-03-06 08:45:48
2020-03-06 08:46:39
2020-03-06 08:47:08
2020-03-06 08:47:08
2020-03-06 08:47:48
2020-03-06 08:47:48
2020-03-06 08:48:28
2020-03-06 08:48:28
2020-03-06 08:48:29
2020-03-06 08:49:08
2020-03-06 08:49:09
2020-03-06 08:49:10
2020-03-06 08:49:10
2020-03-06 08:49:11
2020-03-06 08:49:48
2020-03-06 08:50:08
2020-03-06 08:50:09
2020-03-06 08:50:09
2020-03-06 08:50:11
2020-03-06 08:51:08
2020-03-06 08:51:08
2020-03-06 08:51:09
2020-03-06 08:51:18

 

关于MySql链接url参数的设置  专题_jar_02

 

 

关于MySql链接url参数的设置  专题_bc_03

 

关于MySql链接url参数的设置  专题_jar_04

 

 

关于MySql链接url参数的设置  专题_bc_05

异常原因

系统时区原因。 

解决办法

在数据库连接串加上 &serverTimezone=Asia/Shanghai 即可~

conn_str="jdbc:mysql://${hostname}/${db_name}?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&tinyInt1isBit=false&serverTimezone=Asia/Shanghai&useSSL=true&dontTrackOpenResources=true&defaultFetchSize=10000&useCursorFetch=true"

其它解决办法:

8.X的版本,DBtime写 :2020-03-08 02:01:43

就会报错。

环境:服务器,mysql都是东八区。使用的springboot2.X,DB中字段类型是timestamp

解决办法:
 1. mysql-connector-java.jar版本6.x、8.x降级为5.1.x
 2. 对于高版本jdbc,连接串强制指定时区参数:serverTimezone=GMT%2B8
 3. 对于高版本jdbc,mysql数据库强制修改time_zone为“+8:00”,而非“SYSTEM

 

 

 

ssl的报错:


关于MySql链接url参数的设置  专题_url_06

 

[2020-10-12 10:36:23]10.0.12.164 content: Caused by: org.apache.ibatis.exceptions.PersistenceException: 
[2020-10-12 10:36:23]10.0.12.164
content: ### Error querying database. Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is com.alibaba.druid.pool.GetConnectionTimeoutException: wait millis 60000, active 0, maxActive 20, creating 1, createElapseMillis 1360, createErrorCount 3737
[2020-10-12 10:36:23]10.0.12.164 content: ### The error may exist in class path resource [mapper/customer/CustomerSalesForceDOMapper.xml]
[2020-10-12 10:36:23]10.0.12.164 content: ### The error may involve com.zkh360.boss.sync.customer.dao.mapper.CustomerSalesForceDOMapper.listCustomerBy
[2020-10-12 10:36:23]10.0.12.164 content: ### The error occurred while executing a query
[2020-10-12 10:36:23]10.0.12.164 content: ### Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is com.alibaba.druid.pool.GetConnectionTimeoutException: wait millis 60000, active 0, maxActive 20, creating 1, createElapseMillis 1360, createErrorCount 3737
[2020-10-12 10:36:23]10.0.12.164 content: at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30) ~[mybatis-3.5.4.jar!/:3.5.4]
[2020-10-12 10:36:23]10.0.12.164 content: at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:149) ~[mybatis-3.5.4.jar!/:3.5.4]
[2020-10-12 10:36:23]10.0.12.164 content: at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:140) ~[mybatis-3.5.4.jar!/:3.5.4]
[2020-10-12 10:36:23]10.0.12.164 content: at sun.reflect.GeneratedMethodAccessor103.invoke(Unknown Source) ~[na:na]
[2020-10-12 10:36:23]10.0.12.164 content: at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_144]
[2020-10-12 10:36:23]10.0.12.164 content: at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_144]
[2020-10-12 10:36:23]10.0.12.164 content: at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:426) ~[mybatis-spring-2.0.4.jar!/:2.0.4]
[2020-10-12 10:36:23]10.0.12.164 content: ... 30 common frames omitted
[2020-10-12 10:36:23]10.0.12.164 content: Caused by: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is com.alibaba.druid.pool.GetConnectionTimeoutException: wait millis 60000, active 0, maxActive 20, creating 1, createElapseMillis 1360, createErrorCount 3737
[2020-10-12 10:36:23]10.0.12.164 content: at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:82) ~[spring-jdbc-5.2.8.RELEASE.jar!/:5.2.8.RELEASE]
[2020-10-12 10:36:23]10.0.12.164 content: at org.mybatis.spring.transaction.SpringManagedTransaction.openConnection(SpringManagedTransaction.java:80) ~[mybatis-spring-2.0.4.jar!/:2.0.4]
[2020-10-12 10:36:23]10.0.12.164 content: at org.mybatis.spring.transaction.SpringManagedTransaction.getConnection(SpringManagedTransaction.java:67) ~[mybatis-spring-2.0.4.jar!/:2.0.4]
[2020-10-12 10:36:23]10.0.12.164 content: at org.apache.ibatis.executor.BaseExecutor.getConnection(BaseExecutor.java:336) ~[mybatis-3.5.4.jar!/:3.5.4]
[2020-10-12 10:36:23]10.0.12.164 content: at org.apache.ibatis.executor.SimpleExecutor.prepareStatement(SimpleExecutor.java:86) ~[mybatis-3.5.4.jar!/:3.5.4]
[2020-10-12 10:36:23]10.0.12.164 content: at org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:62) ~[mybatis-3.5.4.jar!/:3.5.4]
[2020-10-12 10:36:23]10.0.12.164 content: at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:324) ~[mybatis-3.5.4.jar!/:3.5.4]
[2020-10-12 10:36:23]10.0.12.164 content: at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:156) ~[mybatis-3.5.4.jar!/:3.5.4]
[2020-10-12 10:36:23]10.0.12.164 content: at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:109) ~[mybatis-3.5.4.jar!/:3.5.4]
[2020-10-12 10:36:23]10.0.12.164 content: at com.github.pagehelper.PageInterceptor.intercept(PageInterceptor.java:108) ~[pagehelper-5.1.11.jar!/:na]
[2020-10-12 10:36:23]10.0.12.164 content: at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:61) ~[mybatis-3.5.4.jar!/:3.5.4]
[2020-10-12 10:36:23]10.0.12.164 content: at com.sun.proxy.$Proxy135.query(Unknown Source) ~[na:na]
[2020-10-12 10:36:23]10.0.12.164 content: at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:147) ~[mybatis-3.5.4.jar!/:3.5.4]
[2020-10-12 10:36:23]10.0.12.164 content: ... 35 common frames omitted
[2020-10-12 10:36:23]10.0.12.164 content: Caused by: com.alibaba.druid.pool.GetConnectionTimeoutException: wait millis 60000, active 0, maxActive 20, creating 1, createElapseMillis 1360, createErrorCount 3737
[2020-10-12 10:36:23]10.0.12.164 content: at com.alibaba.druid.pool.DruidDataSource.getConnectionInternal(DruidDataSource.java:1732) ~[druid-1.1.23.jar!/:1.1.23]
[2020-10-12 10:36:23]10.0.12.164 content: at com.alibaba.druid.pool.DruidDataSource.getConnectionDirect(DruidDataSource.java:1404) ~[druid-1.1.23.jar!/:1.1.23]
[2020-10-12 10:36:23]10.0.12.164 content: at com.alibaba.druid.filter.FilterChainImpl.dataSource_connect(FilterChainImpl.java:5059) ~[druid-1.1.23.jar!/:1.1.23]
[2020-10-12 10:36:23]10.0.12.164 content: at com.alibaba.druid.filter.FilterAdapter.dataSource_getConnection(FilterAdapter.java:2756) ~[druid-1.1.23.jar!/:1.1.23]
[2020-10-12 10:36:23]10.0.12.164 content: at com.alibaba.druid.filter.FilterChainImpl.dataSource_connect(FilterChainImpl.java:5055) ~[druid-1.1.23.jar!/:1.1.23]
[2020-10-12 10:36:23]10.0.12.164 content: at com.alibaba.druid.filter.FilterAdapter.dataSource_getConnection(FilterAdapter.java:2756) ~[druid-1.1.23.jar!/:1.1.23]
[2020-10-12 10:36:23]10.0.12.164
content: at com.alibaba.druid.filter.FilterChainImpl.dataSource_connect(FilterChainImpl.java:5055) ~[druid-1.1.23.jar!/:1.1.23]
-64

[2020-10-12 10:36:23]10.0.12.164
content: at com.alibaba.druid.filter.stat.StatFilter.dataSource_getConnection(StatFilter.java:680) ~[druid-1.1.23.jar!/:1.1.23]
-63

[2020-10-12 10:36:23]10.0.12.164
content: at com.alibaba.druid.filter.FilterChainImpl.dataSource_connect(FilterChainImpl.java:5055) ~[druid-1.1.23.jar!/:1.1.23]
-62

[2020-10-12 10:36:23]10.0.12.164
content: at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:1382) ~[druid-1.1.23.jar!/:1.1.23]
-61

[2020-10-12 10:36:23]10.0.12.164
content: at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:1374) ~[druid-1.1.23.jar!/:1.1.23]
-60

[2020-10-12 10:36:23]10.0.12.164
content: at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:98) ~[druid-1.1.23.jar!/:1.1.23]
-59

[2020-10-12 10:36:23]10.0.12.164
content: at org.springframework.jdbc.datasource.DataSourceUtils.fetchConnection(DataSourceUtils.java:158) ~[spring-jdbc-5.2.8.RELEASE.jar!/:5.2.8.RELEASE]
-58

[2020-10-12 10:36:23]10.0.12.164
content: at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:116) ~[spring-jdbc-5.2.8.RELEASE.jar!/:5.2.8.RELEASE]
-57

[2020-10-12 10:36:23]10.0.12.164
content: at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:79) ~[spring-jdbc-5.2.8.RELEASE.jar!/:5.2.8.RELEASE]
-56

[2020-10-12 10:36:23]10.0.12.164
content: ... 47 common frames omitted
-55

[2020-10-12 10:36:23]10.0.12.164
content: Caused by: java.sql.SQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 3 times. Giving up.
-54

[2020-10-12 10:36:23]10.0.12.164
content: at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:110) ~[mysql-connector-java-8.0.21.jar!/:8.0.21]
-53

[2020-10-12 10:36:23]10.0.12.164
content: at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97) ~[mysql-connector-java-8.0.21.jar!/:8.0.21]
-52

[2020-10-12 10:36:23]10.0.12.164
content: at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:89) ~[mysql-connector-java-8.0.21.jar!/:8.0.21]
-51

[2020-10-12 10:36:23]10.0.12.164
content: at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:63) ~[mysql-connector-java-8.0.21.jar!/:8.0.21]
-50

[2020-10-12 10:36:23]10.0.12.164
content: at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:73) ~[mysql-connector-java-8.0.21.jar!/:8.0.21]
-49

[2020-10-12 10:36:23]10.0.12.164
content: at com.mysql.cj.jdbc.ConnectionImpl.connectWithRetries(ConnectionImpl.java:906) ~[mysql-connector-java-8.0.21.jar!/:8.0.21]
-48

[2020-10-12 10:36:23]10.0.12.164
content: at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:831) ~[mysql-connector-java-8.0.21.jar!/:8.0.21]
-47

[2020-10-12 10:36:23]10.0.12.164
content: at com.mysql.cj.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:456) ~[mysql-connector-java-8.0.21.jar!/:8.0.21]
-46

[2020-10-12 10:36:23]10.0.12.164
content: at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:246) ~[mysql-connector-java-8.0.21.jar!/:8.0.21]
-45

[2020-10-12 10:36:23]10.0.12.164
content: at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:197) ~[mysql-connector-java-8.0.21.jar!/:8.0.21]
-44

[2020-10-12 10:36:23]10.0.12.164
content: at com.alibaba.druid.filter.FilterChainImpl.connection_connect(FilterChainImpl.java:156) ~[druid-1.1.23.jar!/:1.1.23]
-43

[2020-10-12 10:36:23]10.0.12.164
content: at com.alibaba.druid.filter.FilterAdapter.connection_connect(FilterAdapter.java:787) ~[druid-1.1.23.jar!/:1.1.23]
-42

[2020-10-12 10:36:23]10.0.12.164
content: at com.alibaba.druid.filter.FilterChainImpl.connection_connect(FilterChainImpl.java:150) ~[druid-1.1.23.jar!/:1.1.23]
-41

[2020-10-12 10:36:23]10.0.12.164
content: at com.alibaba.druid.filter.FilterAdapter.connection_connect(FilterAdapter.java:787) ~[druid-1.1.23.jar!/:1.1.23]
-40

[2020-10-12 10:36:23]10.0.12.164
content: at com.alibaba.druid.filter.FilterChainImpl.connection_connect(FilterChainImpl.java:150) ~[druid-1.1.23.jar!/:1.1.23]
-39

[2020-10-12 10:36:23]10.0.12.164
content: at com.alibaba.druid.filter.stat.StatFilter.connection_connect(StatFilter.java:218) ~[druid-1.1.23.jar!/:1.1.23]
-38

[2020-10-12 10:36:23]10.0.12.164
content: at com.alibaba.druid.filter.FilterChainImpl.connection_connect(FilterChainImpl.java:150) ~[druid-1.1.23.jar!/:1.1.23]
-37

[2020-10-12 10:36:23]10.0.12.164
content: at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1646) ~[druid-1.1.23.jar!/:1.1.23]
-36

[2020-10-12 10:36:23]10.0.12.164
content: at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1710) ~[druid-1.1.23.jar!/:1.1.23]
-35

[2020-10-12 10:36:23]10.0.12.164
content: at com.alibaba.druid.pool.DruidDataSource$CreateConnectionThread.run(DruidDataSource.java:2774) ~[druid-1.1.23.jar!/:1.1.23]
-34

[2020-10-12 10:36:23]10.0.12.164
content: Caused by: com.mysql.cj.exceptions.CJCommunicationsException: Communications link failure
-33

[2020-10-12 10:36:23]10.0.12.164
content:
-32

[2020-10-12 10:36:23]10.0.12.164
content: The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
-31

[2020-10-12 10:36:23]10.0.12.164
content: at sun.reflect.GeneratedConstructorAccessor119.newInstance(Unknown Source) ~[na:na]
-30

[2020-10-12 10:36:23]10.0.12.164
content: at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_144]
-29

[2020-10-12 10:36:23]10.0.12.164
content: at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[na:1.8.0_144]
-28

[2020-10-12 10:36:23]10.0.12.164
content: at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:61) ~[mysql-connector-java-8.0.21.jar!/:8.0.21]
-27

[2020-10-12 10:36:23]10.0.12.164
content: at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:105) ~[mysql-connector-java-8.0.21.jar!/:8.0.21]
-26

[2020-10-12 10:36:23]10.0.12.164
content: at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:151) ~[mysql-connector-java-8.0.21.jar!/:8.0.21]
-25

[2020-10-12 10:36:23]10.0.12.164
content: at com.mysql.cj.exceptions.ExceptionFactory.createCommunicationsException(ExceptionFactory.java:167) ~[mysql-connector-java-8.0.21.jar!/:8.0.21]
-24

[2020-10-12 10:36:23]10.0.12.164
content: at com.mysql.cj.protocol.a.NativeProtocol.negotiateSSLConnection(NativeProtocol.java:334) ~[mysql-connector-java-8.0.21.jar!/:8.0.21]
-23

[2020-10-12 10:36:23]10.0.12.164
content: at com.mysql.cj.protocol.a.NativeAuthenticationProvider.connect(NativeAuthenticationProvider.java:164) ~[mysql-connector-java-8.0.21.jar!/:8.0.21]
-22

[2020-10-12 10:36:23]10.0.12.164
content: at com.mysql.cj.protocol.a.NativeProtocol.connect(NativeProtocol.java:1342) ~[mysql-connector-java-8.0.21.jar!/:8.0.21]
-21

[2020-10-12 10:36:23]10.0.12.164
content: at com.mysql.cj.NativeSession.connect(NativeSession.java:157) ~[mysql-connector-java-8.0.21.jar!/:8.0.21]
-20

[2020-10-12 10:36:23]10.0.12.164
content: at com.mysql.cj.jdbc.ConnectionImpl.connectWithRetries(ConnectionImpl.java:850) ~[mysql-connector-java-8.0.21.jar!/:8.0.21]
-19

[2020-10-12 10:36:23]10.0.12.164
content: ... 14 common frames omitted
-18

[2020-10-12 10:36:23]10.0.12.164
content: Caused by: javax.net.ssl.SSLHandshakeException: java.security.cert.CertificateExpiredException: NotAfter: Mon Oct 12 01:12:03 CST 2020
-17

[2020-10-12 10:36:23]10.0.12.164
content: at sun.security.ssl.Alerts.getSSLException(Alerts.java:192) ~[na:1.8.0_144]
-16

[2020-10-12 10:36:23]10.0.12.164
content: at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1959) ~[na:1.8.0_144]
-15

[2020-10-12 10:36:23]10.0.12.164
content: at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:302) ~[na:1.8.0_144]
-14

[2020-10-12 10:36:23]10.0.12.164
content: at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:296) ~[na:1.8.0_144]
-13

[2020-10-12 10:36:23]10.0.12.164
content: at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1514) ~[na:1.8.0_144]
-12

[2020-10-12 10:36:23]10.0.12.164
content: at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:216) ~[na:1.8.0_144]
-11

[2020-10-12 10:36:23]10.0.12.164
content: at sun.security.ssl.Handshaker.processLoop(Handshaker.java:1026) ~[na:1.8.0_144]
-10

[2020-10-12 10:36:23]10.0.12.164
content: at sun.security.ssl.Handshaker.process_record(Handshaker.java:961) ~[na:1.8.0_144]
-9

[2020-10-12 10:36:23]10.0.12.164
content: at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1072) ~[na:1.8.0_144]
-8

[2020-10-12 10:36:23]10.0.12.164
content: at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1385) ~[na:1.8.0_144]
-7

[2020-10-12 10:36:23]10.0.12.164
content: at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1413) ~[na:1.8.0_144]
-6

[2020-10-12 10:36:23]10.0.12.164
content: at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1397) ~[na:1.8.0_144]
-5

[2020-10-12 10:36:23]10.0.12.164
content: at com.mysql.cj.protocol.ExportControlled.performTlsHandshake(ExportControlled.java:336) ~[mysql-connector-java-8.0.21.jar!/:8.0.21]
-4

[2020-10-12 10:36:23]10.0.12.164
content: at com.mysql.cj.protocol.StandardSocketFactory.performTlsHandshake(StandardSocketFactory.java:188) ~[mysql-connector-java-8.0.21.jar!/:8.0.21]
-3

[2020-10-12 10:36:23]10.0.12.164
content: at com.mysql.cj.protocol.a.NativeSocketConnection.performTlsHandshake(NativeSocketConnection.java:99) ~[mysql-connector-java-8.0.21.jar!/:8.0.21]
-2

[2020-10-12 10:36:23]10.0.12.164
content: at com.mysql.cj.protocol.a.NativeProtocol.negotiateSSLConnection(NativeProtocol.java:325) ~[mysql-connector-java-8.0.21.jar!/:8.0.21]
-1

[2020-10-12 10:36:23]10.0.12.164
content: ... 18 common frames omitted
0

[2020-10-12 10:36:23]10.0.12.164
content: Caused by: java.security.cert.CertificateExpiredException: NotAfter: Mon Oct 12 01:12:03 CST 2020
+1

[2020-10-12 10:36:23]10.0.12.164
content: at sun.security.x509.CertificateValidity.valid(CertificateValidity.java:274) ~[na:1.8.0_144]
+2

[2020-10-12 10:36:23]10.0.12.164content: at sun.security.x509.X509CertImpl.checkValidity(X509CertImpl.java:629) ~[na:1.8.0_144]
+3

[2020-10-12 10:36:23]10.0.12.164content: at sun.security.x509.X509CertImpl.checkValidity(X509CertImpl.java:602) ~[na:1.8.0_144]
+4

[2020-10-12 10:36:23]10.0.12.164 content: at com.mysql.cj.protocol.ExportControlled$X509TrustManagerWrapper.checkServerTrusted(ExportControlled.java:383) ~[mysql-connector-java-8.0.21.jar!/:8.0.21]
+5

[2020-10-12 10:36:23]10.0.12.164 content: at sun.security.ssl.AbstractTrustManagerWrapper.checkServerTrusted(SSLContextImpl.java:985) ~[na:1.8.0_144]
+6

[2020-10-12 10:36:23]10.0.12.164 content: at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1496) ~[na:1.8.0_144]
+7

[2020-10-12 10:36:23]10.0.12.164 content: ... 29 common frames omitted

 



标签:10,java,23,url,MySql,jar,mysql,com,链接
From: https://blog.51cto.com/u_15147537/5983944

相关文章

  • angularJS友好URL实现 good
    nginx部署angularjs时的rewrite问题使用h5+angularjs完成了一个项目此项目在正式环境上使用nginx做webserver此项目的入口在微信/微博分享中由于分享时的项目访问地址中......
  • SQL注入之MYSQL注入
    前言:MYSQL注入中首先要明确当前注入点权限,高权限注入时有更多的攻击手法,有的能直接进行geshell操作。其中也会遇到很多阻碍,相关的防御反感也要明确。高权限注入及低权限......
  • 获取微信支付码url
    (1)获取微信支付码url主方法///<summary>///获取微信支付二维码///</summary>///<paramname="log">日志</param>///......
  • MySql学习笔记--基础篇02
    约束外键--父表和子表,如果要删除父表的记录时,会判断子表是否存在关联关系,如果存在不予删除  多表关系一对多,在此表中建立外键关联主表的主键多对多,建立第三张中......
  • (转)主从复制报错Fatal error:The slave I/O thread stops because master and slave ha
    最后发现/var/lib/mysql/auto.cnf还有一个auto.cnf文件,我们直接执行rm-rf/var/lib/mysql/auto.cnf命令删除主机和从机中的这个auto.cnf文件就可以,当然也可以选择修改里面......
  • Apache和Nginx设置伪静态(URL Rewrite)的方法
    在Apache中有两种方法配置,一是通过httpd.conf文件,二是通过.htaccess文件。 使用httpd.conf来配置rewrite策略。 要使用httpd.conf文件来设置伪静态策略,我们可以......
  • MySQL-MVCC
    首先MVCC不是MySQL才有的概念,它是一种思想,一种方法论。MVCC全称:Multi-VersionConcurrencyControl多版本并发控制最早于1978年,论文『NamingandSynchronizationina......
  • Mysql常见注意事项小记
    Mysql常见注意事项小记1.排序问题正常如果按照某字段升序排列,空值会排到有值的前面;如果逆序排序空值排在最后。有时候我们需要该字段为空的行数据要排到最......
  • curl命令常见用法汇总 good
     ​​curl​​是一种命令行工具,作用是发出网络请求,然后得到和提取数据,显示在"标准输出"(stdout)上面。curl是一个强大的命令行工具,它可以通过网络将信息传递给服务器或者从服......
  • MySQL——基础架构
    1、MySQL逻辑架构图  2、整体解析大体上MySQL可以分为Server层和存储引擎层两部分。Server层包括连接器、查询缓存、分析器、优化器、执行器等,涵盖MySQL的大......