ReplicationDriver 与 Driver 的区别:
ReplicationDriver的实际相实现代码:为实际上是2个connecton 一个 write的connection一个是 read的 connection 。在程序中使用connection时(包括spring、hibernate、mybatis等框架),是通过 connection.setReadly(true) 来区分的。
jdbc.replicationDriver=com.mysql.jdbc.ReplicationDriver #jdbc.url=jdbc:mysql:replication://172.16.0.91:3306,172.16.0.71:3306/textbook?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull jdbc.type=mysql jdbc.driver=com.mysql.jdbc.Driver jdbc.url=jdbc:mysql://172.16.0.91:3306/textbook?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull #jdbc.url=jdbc:mysql://127.0.0.1:3306/textbook?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull jdbc.username=root jdbc.password=123456
配置文件中写上之后,程序中不需要做任何处理