How to set Hibernate with sqlserver&jtds driver in Netbeans
I am trying to set up Netbeans to work with Hibernate using jtds driver to connect to SQLSERVER 2008.
The sqlserver 2008 is installed localy, no username or password.
This is hibernate.cfg:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="hibernate.show_sql">true</property>
<property name="hibernate.current_session_context_class">thread</property>
<property name="hibernate.query.factory_class">org.hibernate.hql.classic.ClassicQueryTranslatorFactory</property>
<property name="hibernate.connection.driver_class">net.sourceforge.jtds.jdbc.Driver</property>
<property name="hibernate.connection.url">jdbc:jtds:sqlserver://localhost:2545/MyDB</property>
</session-factory>
</hibernate-configuration>
When I try to setup Hibernate reverse engineering file with Hibernate reverse engineering wizard, I get the following error:
Unable to connect. Cannot establish a connection to jdbc:jtds:sqlserver://localhost:2545/MyDB using net.sourceforge.jtds.j开发者_C百科dbc.Driver (I/O Error: SSO Failed: Native SSPI library not loaded. Check the java.library.path system property.).
I have ntlmauth.dll in WINDOWS\system32.
jdbc:jtds:sqlserver://localhost:2545/MyDB
appears to be an incomplete JDBC URL for the jTDS driver.
Going by the jTDS FAQ, you'll need to specify the username
and password
properties as well. Also, since you appear to be using integrated Windows authentication in MS SQL Server 2008, you would also need to set the domain
property.
Note that, the username
and password
values will have to be provided unless you install the jTDS SSO library i.e. ntlmauth.dll; since you already have it in your PATH, you'll need to specify the domain
property to login as the currently logged in user on the workstation.
精彩评论