MyBatis配置连接SQL Server

  <environments default="development">
    <environment id="development">
      <transactionManager type="JDBC"/>
      <dataSource type="POOLED">
        <property name="driver" value="com.microsoft.sqlserver.jdbc.SQLServerDriver"/>
        <property name="url" value="jdbc:sqlserver://localhost:1433;databaseName=myDB"/>
        <property name="username" value="sa"/>
        <property name="password" value="123456"/>
      </dataSource>
    </environment>
  </environments>

MySQL版本只是在driver,url和username上略有不同:

<property name="driver" value="com.mysql.jdbc.Driver"/>
<property name="url" value="jdbc:mysql://localhost:3306/myDB"/>
<property name="username" value="root"/>
<property name="password" value="123456"/>
    原文作者:KardelShaw
    原文地址: https://www.jianshu.com/p/7905e89761eb
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞