我需要知道從多個數(shù)據(jù)庫訪問存儲庫和實體類的簡單步驟。例如:我有用戶表DB1和電子郵件在DB2必須從單一的服務(wù)請求訪問。數(shù)據(jù)庫 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數(shù)據(jù)庫 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條經(jīng)驗 獲得超3個贊
(不是直接回答。)
如果您將使用普通英語以外的文本,請考慮以下設(shè)置:
休眠 XML:
<property name="hibernate.connection.CharSet">utf8mb4</property>
<property name="hibernate.connection.characterEncoding">UTF-8</property>
<property name="hibernate.connection.useUnicode">true</property>
連接網(wǎng)址:
db.url=jdbc:mysql://localhost:3306/db_name?useUnicode=true&character_set_server=utf8mb4
添加回答
舉報
0/150
提交
取消