Jtds using JDBC to link SQL Server

Source: Internet
Author: User
Tags sql server driver

Previously, when you did not use MAVEN to manage the jar package, the SQL Server database was linked to the Sqljdbc4.jar driver package, and just when I was testing with Maven, I couldn't find the coordinates of Sqljdbc4.jar in the central warehouse.

To search the Internet, said to be able to use Jtds through the JDBC to link SQL Server, the experiment, indeed line!

Pom.xml:

... ... ... ... ...
<!--SQL Server driver--
<dependency>
<groupId>net.sourceforge.jtds</groupId>
<artifactId>jtds</artifactId>
<version>1.2.4</version>
</dependency>
... ... ... ... ...


Hibernate.cfg.xml:



<session-factory>

<!--Database connection Settings--
<property name= "Connection.driver_class" >net.sourceforge.jtds.jdbc.Driver</property>
<property name= "Connection.url" >jdbc:jtds:sqlserver://localhost:1433/TEST</property>
<property name= "Connection.username" >USERNAME</property>
<property name= "Connection.password" >PASSWORD</property>

<!--JDBC Connection pool (use the built-in)
<property name= "Connection.pool_size" >1</property>
-

<!--SQL dialect--
<property name= "dialect" >org.hibernate.dialect.HSQLDialect</property>

<!--Enable Hibernate ' s automatic session context management
<property name= "Current_session_context_class" >thread</property>
-

<!--Disable the Second-level cache
<property name= "Cache.provider_class" >org.hibernate.cache.NoCacheProvider</property>
-

<!--Echo all executed SQL to stdout
<property name= "Show_sql" >true</property>

<!--
<property name= "Format_sql" >true</property>
-

<!--Drop and re-create the database schema on startup
<property name= "Hbm2ddl.auto" >update</property>
-

<!--
<mapping resource= "Com/fancy/po/person.hbm.xml"/>
-

</session-factory>





   [Essays are original, reproduced please indicate the source: http://www.blogjava.net/fancydeepin ] 

Related Article

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.