首页 > 数据库技术 > 详细

MySQL Connector to J 8.0 Q&A

时间:2018-06-11 11:48:50      阅读:194      评论:0      收藏:0      [点我收藏+]
Connection

Q:Driver/Datasource Class Name

A:
?低版本:com.mysql.jdbc.Driver
?高版本(5.7+):com.mysql.cj.jdbc.Driver
?

Q:Connection URL Syntax

A:
This is the generic format of the connection URL:

    protocol//[hosts][/database][?properties]

For example:

    jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=utf8&useSSL=true&serverTimezone=GMT%2B8

注:使用tomcat开设服务器(端口3306),数据库名test,属性使用‘&’分隔
?
?

Properties


Q:Using Character Sets and Unicode

A:
The character encoding between client and server is automatically detected upon connection. You must specify the encoding on server using the URL to connect database.
For example, to user UTF-8 chatacter sets with Connector/J. You can using "characterEncoding=utf8" to config your Connector/J.

技术分享图片
?

Q:Connecting Securely Using SSL

A:
SSL:Secure Socket Layer,用以保障在Internet上数据传输之安全,利用数据加密(Encryption)技术,可确保数据在网络上之传输过程中不会被截取及窃听。
For example:

    useSSL=true or useSSL=false

?

Q:使用JDBC驱动关于时区引发的问题

A:
1.降低MySQL版本(5.6以下)
2.增加serverTimezone=UTC或GMT,如果指定使用gmt+8时区,需要写为GMT%2B8,否则可能解析为空。

MySQL Connector to J 8.0 Q&A

原文:http://blog.51cto.com/13801495/2127946

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!