我需要知道从多个数据库访问存储库和实体类的简单步骤。例如:我有用户表DB1和电子邮件在DB2必须从单一的服务请求访问。数据库 1spring.datasource.url = jdbc:mysql://localhost:3306/dbName1?useSSL=falsespring.datasource.username = userspring.datasource.password = passwordspring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5InnoDBDialectspring.jpa.hibernate.ddl-auto = update数据库 2spring.datasource.url = jdbc:mysql://localhost:3306/dbName2?useSSL=falsespring.datasource.username = userspring.datasource.password = passwordspring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5InnoDBDialect其他属性spring.jpa.properties.hibernate.jdbc.batch_size=20spring.jpa.properties.hibernate.order_inserts=truespring.jpa.properties.hibernate.order_updates=truespring.jpa.properties.hibernate.jdbc.batch_versioned_data=truespring.servlet.multipart.max-file-size=100MB spring.servlet.multipart.max-request-size=100MB
3 回答
牛魔王的故事
TA贡献1830条经验 获得超3个赞
(不是直接回答。)
如果您将使用普通英语以外的文本,请考虑以下设置:
休眠 XML:
<property name="hibernate.connection.CharSet">utf8mb4</property>
<property name="hibernate.connection.characterEncoding">UTF-8</property>
<property name="hibernate.connection.useUnicode">true</property>
连接网址:
db.url=jdbc:mysql://localhost:3306/db_name?useUnicode=true&character_set_server=utf8mb4
添加回答
举报
0/150
提交
取消