microsoft提供的数据库驱动存在bug。需要换一种驱动连接,jtds-1.2.jar,引用到eclipse中项目目录下,更改hibernate配置文件:
<property name="connection.driver_class">com.microsoft.jdbc.sqlserver.SQLServerDriver</property>
<property name="connection.url">jdbc:microsoft:sqlserver://127.0.0.1:1433;DatabaseName=hibernate</property>
更改jtds连接:
<property name="connection.driver_class">net.sourceforge.jtds.jdbc.Driver</property>
<property name="connection.url">jdbc:jtds:sqlserver://127.0.0.1:1433;DatabaseName=hibernate</property>
<property name="connection.driver_class">com.microsoft.jdbc.sqlserver.SQLServerDriver</property>
<property name="connection.url">jdbc:microsoft:sqlserver://127.0.0.1:1433;DatabaseName=hibernate</property>
更改jtds连接:
<property name="connection.driver_class">net.sourceforge.jtds.jdbc.Driver</property>
<property name="connection.url">jdbc:jtds:sqlserver://127.0.0.1:1433;DatabaseName=hibernate</property>