MyBatis Generator generation connection mysql differs from SQL Server

Source: Internet
Author: User
Tags generator

MyBatis Generator Build Connection The difference between MySQL and SQL Server is that the driver and the database URL are different

MyBatis Generator The configuration file that connects MySQL is:

<?xml version= "1.0" encoding= "UTF-8"? ><! DOCTYPE generatorconfiguration Public "-//mybatis.org//dtd mybatis Generator Configuration 1.0//en" "/http        Mybatis.org/dtd/mybatis-generator-config_1_0.dtd "> <generatorConfiguration> <!--Database Driver package Location--  <classpathentry location= "... \mysql-connector-java-5.1.7-bin.jar"/> <context id= "DB2Tables" Targetruntime= "MyBatis3" > <commentGenerator> <property name= "suppressallcomments "Value=" true "/> </commentGenerator> <!--database URL, username, password--<jdbcconn Ection driverclass= "Com.mysql.jdbc.Driver" connectionurl= "jdbc:mysql://localhost/database" userid= "Login name" Passwo rd= "Password" > </jdbcConnection> <javaTypeResolver> <pro Perty name= "Forcebigdecimals" value= "false"/> </javaTypeResolver> <!--Generate the Model package location--<javamodelgenerator targetpackage= "fl.shopping.entity" targetproject= "e:\ Table "> <property name=" enablesubpackages "value=" true "/> <property name=" t Rimstrings "value=" true "/> </javaModelGenerator> <!--build the package name and location of the mapping file----& Lt;sqlmapgenerator targetpackage= "fl.shopping.mapping" targetproject= "E:\table" > <property name= "E            Nablesubpackages "value=" true "/> </sqlMapGenerator> <!--generate the package name and location of the map DAO-- <javaclientgenerator type= "Xmlmapper" targetpackage= "Fl.shopping.dao" targetproject= "E:\table" &G                  T <property name= "Enablesubpackages" value= "true"/> </javaClientGenerator> <!--needs to be generated Those databases (change TableName and Domainobjectname)-<table tablename= "users" Domainobjectname= "User" Enablecountbyexam ple="False" enableupdatebyexample= "false" enabledeletebyexample= "false" enableselectbyexample= "false" Selectbye   Xamplequeryid= "false" > </table> </context> </generatorConfiguration>

  

The difference between connecting to SQL Server is:

<classpathentry location= ".... \sqljdbc4-3.0.jar"/>  <jdbcconnection driverclass= " Com.microsoft.sqlserver.jdbc.SQLServerDriver "                  connectionurl=" jdbc:sqlserver://localhost:1433;databasename= Database "userid=" login name "password=" Password >              </jdbcConnection>  

  

MyBatis Generator generation connection mysql differs from SQL Server

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.