0

I'm new to Java. I'd like to build a CRUD application with SQL Server as the database. It will be implemented on an Active Directory domain and I'd like to use integrated security. How can I package the application so that the driver including the authentication library "mssql-jdbc_auth-9.2.0.x64.dll" be included and used in the installed application.

I created a test application where I included a Java Build Path\Classpath entry of: "C:\Program Files\Microsoft JDBC DRIVER 9.2 for SQL Server\sqljdbc_9.2\enu\mssql-jdbc-9.2.0.jre15.jar" for the driver.

It runs in Eclipse with integrated security if I put a copy of the authentication library "mssql-jdbc_auth-9.2.0.x64.dll" from the driver in either of the following directories:

  • C:\Program Files\Java\jdk-15.0.2\bin
  • C:\Windows\System32
  • C:\Program Files\SQL1-Test\runtime\bin of installed application

Or use:

  • VM run configuration arguments: -Djava.library.path="C:\Program Files\Microsoft JDBC DRIVER 9.2 for SQL Server\sqljdbc_9.2\enu\auth\x64" in the project.

When I try to export to a jar file for packaging with the above VM arguments applied it says "VM arguments will not be part of the runnable JAR".

The installed application will run with integrated security if the the authentication library "mssql-jdbc_auth-9.2.0.x64.dll" is in any of the above directories.

How can the I ensure that the authentication library "mssql-jdbc_auth-9.2.0.x64.dll" will be functionally included in the installed application.

Has anyone created such an application or have pointers on how to do this.

Thanks.

wdevca
  • 1
  • 1
  • Perhaps it's an error on Microsoft's part, but the [Deploying the JDBC driver](https://learn.microsoft.com/en-us/sql/connect/jdbc/deploying-the-jdbc-driver) page says, _The JDBC Driver versions 6.0, 6.2, 6.4, 7.0, 7.2, 7.4, 8.2, and 8.4 are redistributable_ which implies that anything later is not. Normally you would make the .dll a [Maven dependency in the POM.xml file](https://learn.microsoft.com/en-us/sql/connect/jdbc/download-microsoft-jdbc-driver-for-sql-server). – AlwaysLearning Feb 02 '21 at 09:52
  • Thanks @AlwaysLearning, I'll try with earlier driver versions and explore how to use Maven. – wdevca Feb 02 '21 at 14:52

0 Answers0