如何在單個(gè)Boot應(yīng)用中配置多數(shù)據(jù)庫
慕絲7291255
2018-09-05 05:09:05
TA貢獻(xiàn)1877條經(jīng)驗(yàn) 獲得超1個(gè)贊
--在WEB.config配置下面的節(jié)點(diǎn),connectionstring寫的是連接數(shù)據(jù)庫的字符串datasource是填寫的數(shù)據(jù)庫,initialcatalog是連接的數(shù)據(jù)庫名稱,user id是連接數(shù)據(jù)的賬戶名,password是賬戶的密碼
<connectionStrings>
<add name="connstring" connectionString="Data Source=.\HH;Initial Catalog=stu;User ID=sa;Password=123;"/>
</connectionStrings>
--在web應(yīng)用層獲取這段數(shù)據(jù)庫連接字符串的語句是
ConfigurationManager.ConnectionStrings["connstring"].ToString()
舉報(bào)