spring+spring MVC+mybatis+maven+sqlserver+eclipse

1、generatorConfig.xml

      修改<!--数据库连接的信息:驱动类、连接地址、用户名、密码 -->

<jdbcConnection driverClass="com.microsoft.sqlserver.jdbc.SQLServerDriver"

connectionURL="jdbc:sqlserver://127.0.0.1:1433;DatabaseName=数据库名"

userId="帐号"

password="密码">

</jdbcConnection>

      <!--schema里的值不要填写-->

<table schema="" tableName="数据库表名" domainObjectName="实体类名(任意取)"

enableCountByExample="false" enableUpdateByExample="false"

enableDeleteByExample="false" enableSelectByExample="false"

selectByExampleQueryId="false">

</table>

2、jdbc.properties

<!--修改Driver与Url的值-->

driver=com.microsoft.sqlserver.jdbc.SQLServerDriver

url=jdbc:sqlserver://127.0.0.1:1433/数据库名

3、pom.xml

<!-- 导入Sqlserver数据库连接jar包 -->

<dependency>

   <groupId>com.hynnet</groupId>

   <artifactId>sqljdbc4-chs</artifactId>

   <version>4.0.2206.100</version>

</dependency>

4、Java版本错误

<!--在build后面加上-->

<plugins>

   <plugin>

       <groupId>org.apache.maven.plugins</groupId>

       <artifactId>maven-compiler-plugin</artifactId>

       <version>2.3.2</version>

       <configuration>

            <source>1.6</source>

            <target>1.6</target>

       </configuration>

   </plugin>

</plugins>

猜你喜欢

转载自201607190027.iteye.com/blog/2323152