java連接mysql5和mysql8的區(qū)別
2023-06-23 20:59 作者:淘畢業(yè)設(shè)計 | 我要投稿
mysql5
驅(qū)動:com.mysql.jdbc.Driver
數(shù)據(jù)庫連接:
如果是普通java文件用:jdbc:mysql://localhost:3306/foodservers?useUnicode=true&characterEncoding=utf-8
如果是xml之類的配置文件用:jdbc:mysql://127.0.0.1:3306/hello?useUnicode=true&characterEncoding=UTF-8
hibernate方言:org.hibernate.dialect.MySQLDialect
hibernate自動創(chuàng)建表配置:<prop key="hibernate.hbm2ddl.auto">update</prop>
mysql8
jar包:mysql-connector-java-8.0.15.jar
驅(qū)動:com.mysql.cj.jdbc.Driver
數(shù)據(jù)庫連接:
如果是普通java文件用:jdbc:mysql://localhost:3306/student?serverTimezone=UTC&useSSL=false
如果是xml之類的配置文件用:jdbc:mysql://localhost:3306/ds?characterEncoding=utf-8&serverTimezone=GMT%2B8&useSSL=false
hibernate方言:org.hibernate.dialect.MySQLDialect
hibernate自動創(chuàng)建表配置:<prop key="hibernate.hbm2ddl.auto">update</prop>
標(biāo)簽: