最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

jdbc連接mysq之serverTimezone設(shè)定方式

 更新時(shí)間:2024年01月27日 09:15:49   作者:喵主子  
這篇文章主要介紹了jdbc連接mysq之serverTimezone設(shè)定方式,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教

jdbc連接mysq之serverTimezone設(shè)定

mysql返回的時(shí)間總是有問題,比實(shí)際時(shí)間要早8小時(shí)。

檢查是jdbc連接的url中配置的時(shí)區(qū)有問題,原先是

jdbc:mysql://172.xx.xx.xx:3306/test?useUnicode=true&characterEncoding=gbk&useSSL=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC

嘗試了GMT、GMT8、UTC+8,UTC0800等可能的參數(shù)均報(bào)錯(cuò)。

后來在mysql文檔中發(fā)現(xiàn)可用的時(shí)區(qū)都在/usr/share/zoneinfo目錄下

ll下發(fā)現(xiàn)可用的時(shí)區(qū)信息

如下:

lewis@lewis-dzwww:/usr/share/zoneinfo$ ll
總用量 308
drwxr-xr-x  21 root root  4096 5月  27 12:54 ./
drwxr-xr-x 334 root root 12288 6月  21 15:11 ../
drwxr-xr-x   2 root root  4096 5月  27 12:56 Africa/
drwxr-xr-x   6 root root  4096 5月  27 12:56 America/
drwxr-xr-x   2 root root  4096 5月  27 12:56 Antarctica/
drwxr-xr-x   2 root root  4096 5月  27 12:56 Arctic/
drwxr-xr-x   2 root root  4096 5月  27 12:56 Asia/
drwxr-xr-x   2 root root  4096 5月  27 12:56 Atlantic/
drwxr-xr-x   2 root root  4096 5月  27 12:56 Australia/
drwxr-xr-x   2 root root  4096 5月  27 12:56 Brazil/
drwxr-xr-x   2 root root  4096 5月  27 12:56 Canada/
-rw-r--r--   1 root root  2102 4月  21 02:09 CET
drwxr-xr-x   2 root root  4096 5月  27 12:56 Chile/
-rw-r--r--   1 root root  2294 4月  21 02:09 CST6CDT
-rw-r--r--   1 root root  2437 4月  21 02:09 Cuba
-rw-r--r--   1 root root  1876 4月  21 02:09 EET
-rw-r--r--   1 root root  1972 4月  21 02:09 Egypt
-rw-r--r--   1 root root  3559 4月  21 02:09 Eire
-rw-r--r--   1 root root   127 4月  21 02:09 EST
-rw-r--r--   1 root root  2294 4月  21 02:09 EST5EDT
drwxr-xr-x   2 root root  4096 5月  27 12:56 Etc/
drwxr-xr-x   2 root root  4096 5月  27 12:56 Europe/
-rw-r--r--   1 root root   264 4月  21 02:09 Factory
-rw-r--r--   1 root root  3687 4月  21 02:09 GB
lrwxrwxrwx   1 root root     2 5月  27 09:07 GB-Eire -> GB
-rw-r--r--   1 root root   127 4月  21 02:09 GMT
lrwxrwxrwx   1 root root     3 5月  27 09:07 GMT0 -> GMT
lrwxrwxrwx   1 root root     3 5月  27 09:07 GMT-0 -> GMT
lrwxrwxrwx   1 root root     3 5月  27 09:07 GMT+0 -> GMT
lrwxrwxrwx   1 root root     3 5月  27 09:07 Greenwich -> GMT
-rw-r--r--   1 root root  1189 4月  21 02:09 Hongkong
-rw-r--r--   1 root root   128 4月  21 02:09 HST
-rw-r--r--   1 root root  1190 4月  21 02:09 Iceland
drwxr-xr-x   2 root root  4096 5月  27 12:56 Indian/
-rw-r--r--   1 root root  1678 4月  21 02:09 Iran
-rw-r--r--   1 root root  4475 2月  24 17:01 iso3166.tab
-rw-r--r--   1 root root  2265 4月  21 02:09 Israel
-rw-r--r--   1 root root   507 4月  21 02:09 Jamaica
-rw-r--r--   1 root root   355 4月  21 02:09 Japan
-rw-r--r--   1 root root   237 4月  21 02:09 Kwajalein
-rw-r--r--   1 root root 10384 2月  22 23:58 leap-seconds.list
-rw-r--r--   1 root root   655 4月  21 02:09 Libya
lrwxrwxrwx   1 root root    14 5月  27 09:07 localtime -> /etc/localtime
-rw-r--r--   1 root root  2102 4月  21 02:09 MET
drwxr-xr-x   2 root root  4096 5月  27 12:56 Mexico/
-rw-r--r--   1 root root   127 4月  21 02:09 MST
-rw-r--r--   1 root root  2294 4月  21 02:09 MST7MDT
-rw-r--r--   1 root root  2453 4月  21 02:09 Navajo
-rw-r--r--   1 root root  2460 4月  21 02:09 NZ
-rw-r--r--   1 root root  2057 4月  21 02:09 NZ-CHAT
drwxr-xr-x   2 root root  4096 5月  27 12:56 Pacific/
-rw-r--r--   1 root root  2705 4月  21 02:09 Poland
-rw-r--r--   1 root root  3453 4月  21 02:09 Portugal
drwxr-xr-x  19 root root  4096 5月  27 12:56 posix/
-rw-r--r--   1 root root  3545 4月  21 02:09 posixrules
-rw-r--r--   1 root root   414 4月  21 02:09 PRC
-rw-r--r--   1 root root  2294 4月  21 02:09 PST8PDT
drwxr-xr-x  19 root root  4096 5月  27 12:56 right/
-rw-r--r--   1 root root   800 4月  21 02:09 ROC
-rw-r--r--   1 root root   571 4月  21 02:09 ROK
-rw-r--r--   1 root root   428 4月  21 02:09 Singapore
drwxr-xr-x   2 root root  4096 5月  27 12:56 SystemV/
-rw-r--r--   1 root root  2747 4月  21 02:09 Turkey
-rw-r--r--   1 root root   127 4月  21 02:09 UCT
lrwxrwxrwx   1 root root     4 5月  27 09:07 Universal -> Zulu
drwxr-xr-x   2 root root  4096 5月  27 12:56 US/
lrwxrwxrwx   1 root root     4 5月  27 09:07 UTC -> Zulu
-rw-r--r--   1 root root  1873 4月  21 02:09 WET
-rw-r--r--   1 root root  1528 4月  21 02:09 W-SU
-rw-r--r--   1 root root 17533 4月  13 16:01 zone1970.tab
-rw-r--r--   1 root root 19014 4月  13 16:01 zone.tab
-rw-r--r--   1 root root   127 4月  21 02:09 Zulu

為解決此問題

可以選擇東8區(qū)的Hongkong、Asia/Shanghai或者Asia/Hongkong作為參數(shù),修改后url為

jdbc:mysql://172.xx.xx.xx:3306/test?useUnicode=true&characterEncoding=gbk&useSSL=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Hongkong

時(shí)間返回就沒問題了!

總結(jié)

以上為個(gè)人經(jīng)驗(yàn),希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。

相關(guān)文章

  • MySQL Installer 8.0.21安裝教程圖文詳解

    MySQL Installer 8.0.21安裝教程圖文詳解

    這篇文章主要介紹了MySQL Installer 8.0.21安裝教程,本文通過圖文并茂的形式給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2020-08-08
  • 詳解mysql 中的鎖結(jié)構(gòu)

    詳解mysql 中的鎖結(jié)構(gòu)

    這篇文章主要介紹了mysql 中的鎖結(jié)構(gòu)的相關(guān)資料,幫助大家更好的理解和使用數(shù)據(jù)庫,感興趣的朋友可以了解下
    2020-10-10
  • mysql間隙鎖的應(yīng)用

    mysql間隙鎖的應(yīng)用

    本文主要介紹了mysql間隙鎖的應(yīng)用,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2023-01-01
  • MySQL無法存儲(chǔ)emoji表情解決方案分析

    MySQL無法存儲(chǔ)emoji表情解決方案分析

    這篇文章主要介紹了MySQL無法存儲(chǔ)emoji表情解決方案,結(jié)合實(shí)例形式分析了Python爬蟲爬取文章中emoji表情存入數(shù)據(jù)庫的實(shí)現(xiàn)方法,涉及mysql utf8mb4編碼的修改相關(guān)操作技巧,需要的朋友可以參考下
    2018-07-07
  • Mysql中關(guān)于on,in,as,where的區(qū)別

    Mysql中關(guān)于on,in,as,where的區(qū)別

    這篇文章主要介紹了Mysql中關(guān)于on,in,as,where的區(qū)別說明,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2023-03-03
  • Sphinx/MySQL 協(xié)議支持與SphinxQL應(yīng)用實(shí)例

    Sphinx/MySQL 協(xié)議支持與SphinxQL應(yīng)用實(shí)例

    Sphinx/MySQL 協(xié)議支持與SphinxQL應(yīng)用例子,供大家學(xué)習(xí)參考
    2013-02-02
  • MySQL數(shù)據(jù)庫修復(fù)方法(MyISAM/InnoDB)

    MySQL數(shù)據(jù)庫修復(fù)方法(MyISAM/InnoDB)

    這篇文章主要為大家整理了7條修復(fù)MySQL數(shù)據(jù)庫的方法,當(dāng)簡(jiǎn)單的重啟對(duì)數(shù)據(jù)庫不起作用,或者有表崩潰時(shí),需要的朋友可以參考下
    2014-06-06
  • Mac下mysql 5.7.13 安裝配置方法圖文教程

    Mac下mysql 5.7.13 安裝配置方法圖文教程

    這篇文章主要介紹了Mac下mysql 5.7.13 安裝配置方法圖文教程,內(nèi)容很詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2017-03-03
  • MySQL數(shù)據(jù)庫表的增刪改查操作(進(jìn)階)

    MySQL數(shù)據(jù)庫表的增刪改查操作(進(jìn)階)

    這篇文章主要給大家介紹了關(guān)于MySQL數(shù)據(jù)庫表的增刪改查操作,文章記錄常用的SQL查詢語句,包括數(shù)據(jù)庫、表和數(shù)據(jù)的增刪改查,逐漸擴(kuò)展到其他比較復(fù)雜的查詢語句,需要的朋友可以參考下
    2023-11-11
  • MySQL數(shù)據(jù)庫之存儲(chǔ)過程?procedure

    MySQL數(shù)據(jù)庫之存儲(chǔ)過程?procedure

    這篇文章主要介紹了MySQL數(shù)據(jù)庫之存儲(chǔ)過程?procedure,文章圍繞主題展開詳細(xì)的內(nèi)容介紹,具有一定的參考價(jià)值,感興趣的小伙伴可以參考一下
    2022-06-06

最新評(píng)論

辉县市| 双江| 镇宁| 东兰县| 双鸭山市| 攀枝花市| 江源县| 德兴市| 万宁市| 内丘县| 扬中市| 东乡县| 平陆县| 讷河市| 鸡泽县| 永胜县| 精河县| 河津市| 开江县| 泰和县| 酉阳| 尼木县| 英德市| 营山县| 许昌县| 赣榆县| 渭南市| 奉贤区| 会理县| 隆化县| 茶陵县| 石河子市| 濮阳市| 陕西省| 乌鲁木齐县| 吉首市| 卫辉市| 晋宁县| 山东| 云浮市| 遵义市|