MySQL Connector to J 8.0 Q&A

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.

MySQL Connector to J 8.0 Q&A
 

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,否则可能解析为空。

转载于:https://blog.51cto.com/13801495/2127946

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值