1

I'm using Hibernate to connect to MSSQL 2012, I have cfg.xml like this

 <property name="hibernate.connection.driver_class">com.microsoft.sqlserver.jdbc.SQLServerDriver</property>
<property name="hibernate.connection.url">jdbc:sqlserver://USER-PC:1433;databaseName=AvtoParki;integratedSecurity=false               databaseName=AvtoParki;integratedSecurity=false</property>
<property name="hibernate.connection.username">user</property>
 <property name="hibernate.connection.password"></property>-->
<property name="hibernate.connection.pool_size">10</property>
<property name="show_sql">true</property>
<property name="dialect">org.hibernate.dialect.SQLServerDialect</property>
<property name="hibernate.hbm2ddl.auto">create-drop</property>
<!-- Mapping files -->
<mapping class="Employee" />

my PC userName is "user", and I'm connecting to SQL by windows authentication I don't have any password on it , so When I run application session.beginTransaction() throws error: "Login failed for user 'user'. Couldn't open connection". Can anyone solve this problem?

1 Answer 1

1

Integrated security should be set to True as you want to connect using Windows Authentication:

<property name="hibernate.connection.url">
jdbc:sqlserver://USER-PC:1433;databaseName=AvtoParki;integratedSecurity=true;
</property>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.