jdbc:mysql 语法

版权声明:大家好,我是笨笨,笨笨的笨,笨笨的笨,转载请注明出处,谢谢! https://blog.csdn.net/jx520/article/details/89513324


JDBC 连接 MySQL 5.1

jdbc:mysql://

https://dev.mysql.com/doc/connector-j/5.1/en/connector-j-reference-url-format.html

连接参数

https://dev.mysql.com/doc/connector-j/5.1/en/connector-j-reference-configuration-properties.html

例子说明

  • autoReconnect 自动重连。默认false
  • failOverReadOnly 自动重连后设为只读。默认 true
  • allowMultiQueries 批量执行SQL。默认false
jdbc.driverClassName=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://localhost:3306/jerry?autoReconnect=true&failOverReadOnly=false&useUnicode=true&characterEncoding=utf-8
jdbc.username=root
jdbc.password=root

有坑

xml文件里url中的&要转义成& 如果哪天又拆出来配置到 jdbc.properties 中记得改回 &。(被这个坑过)


JDBC 连接 MySQL 8.0

https://dev.mysql.com/doc/connector-j/8.0/en/connector-j-reference-jdbc-url-format.html

猜你喜欢

转载自blog.csdn.net/jx520/article/details/89513324