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 ]