logo logo
关于我们

技术分享

技术分享 数据库配置文件-默认数据库连接设置

数据库配置文件-默认数据库连接设置

2021-06-07

在pom.xml文件中需要修改的节点

 1  <!--默认本地模式, 需要本地新建mysql数据库--> 2     <profiles> 3         <profile> 4             <id>dev</id> 5             <activation> 6                 <activeByDefault>true</activeByDefault> 7             </activation> 8             <properties> 9                 <datasource.type>org.apache.tomcat.jdbc.pool.DataSource</datasource.type>10                 <datasource.url>jdbc:mysql://47.103.144.156:3306/mgudb</datasource.url>11                 <datasource.username>root</datasource.username>12                 <datasource.password>root123456</datasource.password>13                 <datasource.driver-class-name>com.mysql.jdbc.Driver</datasource.driver-class-name>14                 <datasource.validationQuery>select 1 </datasource.validationQuery>15                 <datasource.tomcat.test-while-idle>true</datasource.tomcat.test-while-idle>16                 <datasource.tomcat.test-on-borrow>true</datasource.tomcat.test-on-borrow>17             </properties>18         </profile>19         <profile>20             <id>dat</id>21             <properties>22                 <datasource.type>org.apache.tomcat.jdbc.pool.DataSource</datasource.type>23                 <datasource.url>jdbc:mysql://47.103.144.156:3306/mgudat</datasource.url>24                 <datasource.username>root</datasource.username>25                 <datasource.password>root123456</datasource.password>26                 <datasource.driver-class-name>com.mysql.jdbc.Driver</datasource.driver-class-name>27                 <datasource.validationQuery>select 1 </datasource.validationQuery>28                 <datasource.tomcat.test-while-idle>true</datasource.tomcat.test-while-idle>29                 <datasource.tomcat.test-on-borrow>true</datasource.tomcat.test-on-borrow>30             </properties>31         </profile>32         <profile>33             <id>uat</id>34             <properties>35                 <datasource.type>org.apache.tomcat.jdbc.pool.DataSource</datasource.type>36                 <datasource.url>jdbc:mysql://47.103.153.87:33306/mgudb</datasource.url>37                 <datasource.username>sinosoft</datasource.username>38                 <datasource.password>Xay4EyHJyeY+n7IzNc7D</datasource.password>39                 <datasource.driver-class-name>com.mysql.jdbc.Driver</datasource.driver-class-name>40                 <datasource.validationQuery>select 1 </datasource.validationQuery>41                 <datasource.tomcat.test-while-idle>true</datasource.tomcat.test-while-idle>42                 <datasource.tomcat.test-on-borrow>true</datasource.tomcat.test-on-borrow>43             </properties>44         </profile>45     </profiles>

其中关键节点名称设置:

<activeByDefault>true</activeByDefault>
这样就会默认连接dev数据库。
                   
云祺备份软件,云祺容灾备份系统,虚拟机备份,数据库备份,文件备份,实时备份,勒索软件,美国,图书馆
  • 标签:
  • 容灾备份

您可能感兴趣的新闻 换一批

现在下载,可享30天免费试用

立即下载

jia7jia_7
请添加好友
为您提供支持

请拨打电话
为您提供支持

400-9955-698