更换mysql-connector-java-6.0.5jar包后程序出现的两个异常及解决方法
2017-07-02 00:31
681 查看
异常一:Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered
via the SPI and manual loading of the driver class is generally unnecessary.
异常二: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.
解决方法:
第一个异常是因为mysql-connection-java的最新版本不建议使用“com.mysql.jdbc” 包下面的“Driver”,改正方法直接把配置文件中的“com.mysql.jdbc.Driver”改为在异常中提示的“com.mysql.cj.jdbc.Driver”。
第二个异常显示新版本的数据库连接程序需要指定UTC时区,改正方法将配置文件中的“url”后面加上指定的时区,将其值改为“url=jdbc:mysql://localhost:3306/。。。&serverTimezone=GMT”
via the SPI and manual loading of the driver class is generally unnecessary.
异常二: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.
解决方法:
第一个异常是因为mysql-connection-java的最新版本不建议使用“com.mysql.jdbc” 包下面的“Driver”,改正方法直接把配置文件中的“com.mysql.jdbc.Driver”改为在异常中提示的“com.mysql.cj.jdbc.Driver”。
第二个异常显示新版本的数据库连接程序需要指定UTC时区,改正方法将配置文件中的“url”后面加上指定的时区,将其值改为“url=jdbc:mysql://localhost:3306/。。。&serverTimezone=GMT”
相关文章推荐
- 使用MySQL和Hibernate时,出现java.lang.UnsupportedOperationException: Update queries only supported through HQL异常的解决方法
- Struts+Mysql+Tomcat5.0.28+mysql-connector-java-3.0.16-ga-bin.jar 国际化乱码解决方法
- Connector/Net 连接 MySQL远程服务器出现 "Unable to connect to any of the specified MySQL hosts" 解决方法
- POI操作excel2007 出现异常 java.lang.ClassNotFoundException: org.apache.xmlbeans.XmlOptions 解决方法
- Android项目更换开发环境时出现的 java.lang.VerifyError 异常解决办法
- 遇到的错误-----MySQL使用临时表 出现 “ERROR 1137 (HY000): Can't reopen table” 的异常 解决方法
- C程序访问hadoop出现的各种编译错误和运行时各种类DefFound异常的解决方法(makefile的书写和环境变量的配置)
- Launcher中动态加载APK出现java.lang.SecurityException异常的解决方法(二)
- JNI调用native方法出现 java.lang.UnsatisfiedLinkError: XXXclass.XXXmethod()异常的解决办法
- 某APK中使用了动态注册BroadcastReceiver,Launcher中动态加载此APK出现java.lang.SecurityException异常的解决方法
- (收藏)Java与SQL Server, MySql, Oracle, Access的连接方法以及一些异常解决
- Struts+Mysql+Tomcat5.0.28+mysql-connector-java-3.0.16-ga-bin.jar 国际化乱码解决方法
- java操作mysql库出现乱码的解决方法
- Hibernate查询出现java.lang.IllegalArgumentException异常解决方法
- JNI调用native方法出现 java.lang.UnsatisfiedLinkError: XXXclass.XXXmethod()异常的解决办法
- Myeclipse(Tomcat)发布工程出现java.io.EOFException异常的原因和解决方法
- 执行EXE程序出现unable to locate suitable Java runtime Environment on this machine java解决方法
- 从WinForm程序中显示WPF Window出现"The URI prefix is not recognized"异常的解决方法
- 某APK中使用了动态注册BroadcastReceiver,Launcher中动态加载此APK出现java.lang.SecurityException异常的解决方法
- C程序访问hadoop出现的各种编译错误和运行时各种类DefFound异常的解决方法