mybatis config datasource:
<!-- 配置数据源 使用的是Druid数据源 --> <bean name="dataSource" class="org.apache.commons.dbcp.BasicDataSource" > <property name="driverClassName" value="${sqlserver.driver}" /> <property name="url" value="${sqlserver.url}" /> <property name="username" value="${sqlserver.username}" /> <property name="password" value="${sqlserver.password}" /> </bean>
connectproperties
validationQuery=SELECT 1 sqlserver.driver=com.microsoft.sqlserver.jdbc.SQLServerDriver sqlserver.url=jdbc:sqlserver://127.0.0.1:1433;databaseName=startappnotice sqlserver.username=sa sqlserver.password=123
pom.xml
<!--sqlserver--> <dependency> <groupId>com.microsoft.sqlserver</groupId> <artifactId>sqljdbc4</artifactId> <version>4.0</version> </dependency> <dependency> <groupId>commons-dbcp</groupId> <artifactId>commons-dbcp</artifactId> <version>1.4</version> </dependency>
和mysql 区别是驱动不同 遇到同样问题者联系我qq:513439252 加我时备注:博客园