2011-08-26 35 views
2

我试图建立Netbeans的使用JTDS司机Hibernate的工作连接到SQLSERVER 2008如何设置与Netbeans的

SQLServer的2008 localy安装,没有用户名或密码SQLSERVER&JTDS司机休眠。

这是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> 

当我尝试使用Hibernate逆向工程向导安装的Hibernate逆向工程文件,我得到以下错误:

Unable to connect. Cannot establish a connection to jdbc:jtds:sqlserver://localhost:2545/MyDB using net.sourceforge.jtds.jdbc.Driver (I/O Error: SSO Failed: Native SSPI library not loaded. Check the java.library.path system property.).

我有ntlmauth.dll在WINDOWS \ system32中。

+0

你有没有达到这个解决方案?反向工程向导在使用jTDS驱动程序时不执行任何操作,并且可以与MS驱动程序一起正常工作。 – lm2s

回答

0

jdbc:jtds:sqlserver://localhost:2545/MyDB对于jTDS驱动程序来说似乎是一个不完整的JDBC URL。

通过jTDS FAQ,您还需要指定usernamepassword属性。另外,由于您似乎在MS SQL Server 2008中使用集成Windows身份验证,因此您还需要设置domain属性。

请注意,必须提供usernamepassword值,除非您安装jTDS SSO库(即ntlmauth.dll;由于您已经在PATH中拥有它,因此您需要指定domain属性以登录为工作站上当前登录的用户。

+0

nope,jtds工作正常,如果我尝试不使用hibirnate进行连接:Connection con = DriverManager.getConnection( “jdbc:jtds:sqlserver:// localhost:2545/MyDB”)) – jerrys