I have made a connection to a mssql using persistence.xml
in java. For doing that i had to copy sqljdbc_auth.dll
in to system32 because i wanted to use the windows authentication in order to connect. Is there a way to achieve the same result without copying the dll file? Removing the dll causes this warning and prevents the execution:
Failed to load the sqljdbc_auth.dll cause : no sqljdbc_auth in java.library.path
This is my persistence:
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.1"
xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
<persistence-unit name="migration">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<class>migration.xcs.model.Kennzahl</class>
<properties>
<property name="javax.persistence.jdbc.driver"
value="com.microsoft.sqlserver.jdbc.SQLServerDriver" />
<property name="hibernate.dialect" value="org.hibernate.dialect.SQLServerDialect" />
<property name="javax.persistence.jdbc.url"
value="jdbc:sqlserver://localhost:1433;databaseName=kendb;integratedSecurity=true;" />
<property name="hibernate.archive.autodetection" value="class" />
</properties>
</persistence-unit>
And these are my pom dependencies:
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>5.0.5.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>5.0.5.Final</version>
</dependency>
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>sqljdbc4</artifactId>
<version>4.0</version>
</dependency>
<dependency>
<groupId>javax.transaction</groupId>
<artifactId>jta</artifactId>
<version>1.1</version>
</dependency>