在hibernate

时间:2015-10-04 05:55:15

标签: java sql-server hibernate database-connection

我希望通过windows身份验证连接到hibernate的sql server作为登录方法。所以我的配置,但没有连接到SQL。

我还将sql maven依赖项添加到pom.xml。 我在url连接中尝试使用计算机名称和localhost,但是没有连接到db。

 <property name="hibernateProperties">
        <props>
            <prop key="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</prop>
            <prop key="cache.use_query_cache">true</prop>
            <prop key="cache.use_second_level_cache">true</prop>
            <prop key="hibernate.connection.driver_class">
                com.microsoft.sqlserver.jdbc.SQLServerDriver
            </prop>
            <prop key="hibernate.connection.url">jdbc:sqlserver://.;databaseName=test;integratedSecurity=true</prop>
            <prop key="hibernate.connection.username">windows username
            </prop>
            <prop key="hibernate.connection.password">windows password
            </prop>
            <prop key="show_sql">true</prop>
            <prop key="hibernate.c3p0.min_size">5</prop>
            <prop key="hibernate.c3p0.max_size">20</prop>
            <prop key="hibernate.c3p0.timeout">300</prop>
            <prop key="hibernate.c3p0.max_statements">50</prop>
            <prop key="hibernate.c3p0.idle_test_period">3000</prop>
        </props>
  </property> 

这个例子来自于出局

com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:1105)
    com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:827)
    com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:1012)
    com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:146)

0 个答案:

没有答案