zoukankan      html  css  js  c++  java
  • phpstorm 链接数据库

    当使用 phpstorm 自带的 database 连接数据库时,会出现报错问题

    java.lang.RuntimeException: 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.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:61)
    at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:85)

    提示的报错是因为时区的问题即:JDBC驱动程序的5.2版本与UTC时区配合使用,必须在连接字符串中明确指定serverTimezone。

    解决方案

    jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=UTF-8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC

    下面这个就可以,database_name 是你的数据库名称

    jdbc:mysql://localhost:3306/database_name?serverTimezone=UTC

    这样就可以了

    世事洞明皆学问
  • 相关阅读:
    webapi支持session
    webapi返回数据同时支持xml与json
    webapi权限控制
    Asp.net 将js文件打包进dll 方法
    All Media to FLV asp.net在线视频自动转换并截图调试成功!
    未能从程序集“System.ServiceModel
    [javascript]浮动广告
    [python]multi thread tcp connect port scanner
    [vc]让你Y的用YY
    [python]扫描网站后台脚本
  • 原文地址:https://www.cnblogs.com/Json159/p/12186379.html
Copyright © 2011-2022 走看看