com.mysql.cj.jdbc.Driver 是 mysql-connector-java 6及以上版本中的
jdbc.url=jdbc:mysql://localhost:3306/test?serverTimezone=Asia/Chongqing&useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&useSSL=false&verifyServerCertificate=false&autoReconnct=true&autoReconnectForPools=true&allowMultiQueries=true
參數(shù)詳解:
serverTimezone:設(shè)置時(shí)區(qū)
在設(shè)定時(shí)區(qū)的時(shí)候残黑,如果設(shè)定serverTimezone=UTC馍佑,會(huì)比中國(guó)時(shí)間早8個(gè)小時(shí),如果在中國(guó)梨水,可以選擇Asia/Shanghai拭荤,Asia/Chongqing或者Asia/Hongkong
useUnicode:是否使用Unicode字符集,如果參數(shù)characterEncoding設(shè)置為utf8疫诽,gb2312或gbk穷劈,本參數(shù)值必須設(shè)置為true
characterEncoding:當(dāng)useUnicode設(shè)置為true時(shí),指定字符編碼踊沸。比如可設(shè)置為utf8歇终,gb2312或gbk
characterSetResults:結(jié)果集的字符集編碼,比如可設(shè)置為utf8逼龟,gb2312或gbk
useSSL:是否進(jìn)行SSL連接评凝,不需要的話直接設(shè)置成false
autoReconnct:當(dāng)數(shù)據(jù)庫(kù)連接異常中斷時(shí),是否自動(dòng)重新連接腺律,不設(shè)置默認(rèn)為false
autoReconnectForPools:是否使用針對(duì)數(shù)據(jù)庫(kù)連接池的重連策略奕短,不設(shè)置默認(rèn)為false
allowMultiQueries:允許批量更新,不設(shè)置默認(rèn)為false