0

I am working in a jee maven project that needs to make a JDBC connection to SqlServer, using windows authentication.

To achieve that, I need to have the "sqljdbc_auth.dll" in my java.library.path .

I tried multiple solutions, none of them worked:

  • maven_surefire_plugin to modify the property path.
  • System.setProperty("java.library.path", "..."): this changed the property, but the connection didn't succeed telling me that the driver isn't configured for integratedSecurity connection.
  • Add the dll to a lib folder in Web_Inf & set the "Native Library_Path" of the maven dependency sqljdbc.
  • Add the dll to the bin folder in the "wildfly" server: gave me an exception: Exception Access Violation (fatal)

I appreciate any help, thank's in advance.

  • Didn't solve my problem, I edited the question to explain that. – user3420018 Jul 03 '18 at 12:37
  • Have you configured a DataSource in WildFly to use your mssql-jdbc driver? – Steve C Jul 03 '18 at 14:24
  • The dataSource needs to define the DataBase, username & password. In my case, these info will be specified by the user. – user3420018 Jul 04 '18 at 06:59
  • Do you mean the user that WildFly runs as, or the user of your application? – Steve C Jul 04 '18 at 08:52
  • The user of my application. – user3420018 Jul 05 '18 at 07:15
  • It is my understanding that the DLL in question provides access to a SQLServer instance using the credentials of the authenticated user that owns the process that is connecting to the database. i.e. the user that owns the WildFly process. This is how I use that DLL today. It *might* be possible to propagate browser originated security tokens to the driver, but it would likely need some serious research to figure that out. I can explain how to to get the DLL to work for the WildFly process owner, but it seems like that won't help you right now. – Steve C Jul 05 '18 at 11:28
  • Thank you @SteveC, even though I appreciate If you explain how to get it to work for the WildFly process owner... – user3420018 Jul 06 '18 at 10:41

2 Answers2

0

Adding .dll (which is windows-specific library) to JEE application (deployed on application server, usually running on linux platform) sound like a bad idea.

In your case, I believe that solution is much simpler: try to add integratedSecurity=true to your JDBC string, so it would like like this:

String url ="jdbc:sqlserver://localhost\sqlexpress;databaseName=myDatabase;integratedSecurity=true";

If this won't help, maybe consider using jTDS instead of regular driver from Microsoft - from my experience, it works much better.

Greg Witczak
  • 1,634
  • 4
  • 27
  • 56
0

Try adding below to your JDBC string:

Integrated Security=SSPI

The SSPI allows an application to use any of the available security packages on a system without changing the interface to use security services

brijesh
  • 760
  • 6
  • 4
  • An error showed that integratedSecurity attribute should be only true or false. – user3420018 Jul 03 '18 at 12:39
  • @user3420018 Have you checked my answer? – Greg Witczak Jul 04 '18 at 12:15
  • Yes, thank you for your reply: I already use the "integratedSecurity=true;" attribute, & didn't work for me...For jTDS, I found it's difficult to switch to it in this stage of my project, If I don't find any workaround to my problem, I'll give it a try... – user3420018 Jul 05 '18 at 07:17