Unable to load authentication DLL mssql-jdbc_auth

Scott Klement's open source interface to using JDBC database drivers from RPG. http://www.scottklement.com/jdbc/
Post Reply
kris5421
Posts: 2
Joined: Fri Dec 20, 2024 2:40 pm

Unable to load authentication DLL mssql-jdbc_auth

Post by kris5421 »

Hey

I need to receive data from an external ms sqlserver. I use ms jdbc driver for this. The connection works, but only using the sql server user with login and password. For security reasons, we must use domain login in the company. I'm still having trouble with the error:
"Caused by: java.lang.UnsatisfiedLinkError: Unable to load authentication DLL mssql-jdbc_auth-12.8.1.x64 " "

From what I can see, Java in my windows system is 32 bit, windows system is 64 bit, in the as400 system we have 7.4, several versions of java. I put mssql-jdbc_auth-12.8.1.x64.dll and mssql-jdbc_auth-12.8.1.x86.dll into system32, sysWOW64, to the folder where I have the jar file mssql-jdbc-12.8.1.jre8.jar, I tried adding the command in the rpgle program itself like:

Code: Select all

jarPath = 'QIBM/UserData/Java400/ext/mssql-jdbc-12.8.1.jre8.jar';

         monitor;
          cmd = 'ADDENVVAR ENVVAR(QIBM_RPG_JAVA_PROPERTIES) ' +
          'VALUE("-Djava.library.path=QIBM/UserData/Java400/ext/")';
          sCall(%trimr(cmd):%len(%trimr(cmd)));


           cmd = 'CHGENVVAR '+
            'ENVVAR(CLASSPATH) VALUE('''+ %trim(jarPath) +''')';
           sCall(%trimr(cmd):%len(%trimr(cmd)));
         on-error;
           monitor;
              cmd = 'ADDENVVAR ENVVAR(CLASSPATH) ' +
               ' VALUE('''+ %trim(jarPath) +''')';
              sCall(%trimr(cmd):%len(%trimr(cmd)));
            on-error;
            endmon;
        endmon;                       
parameters in url looks like:

Code: Select all

 url = 'jdbc:sqlserver://'
                 + %trim(inSettings.server) 
                 + ':'
                 + %trim(inSettings.port)
                 +';integratedSecurity=true;'
                 +';encrypt=true'
                 +';trustServerCertificate=true'   
                 ;     
for user with login/password I use only 1 parameter: ;trustServerCertificate=true';

And ... I still have the error in log Unable to load authentication DLL mssql-jdbc_auth-12.8.1.x64 "
I would be grateful for your tips.
Please help me, what could I try to do, I have no more ideas.
Scott Klement
Site Admin
Posts: 856
Joined: Sun Jul 04, 2021 5:12 am

Re: Unable to load authentication DLL mssql-jdbc_auth

Post by Scott Klement »

A DLL is a program that is compiled for the Microsoft Windows operating system. You can't run a DLL on the IBM i operating system.

You should make sure you are using a type 4 JDBC driver, which means the entire driver is written in in Java. This is important because Java is a cross-platform environment, so runs on any platform. A DLL is not, it only works on Windows.

The last time I worked with the Microsoft SQL Server driver, it was a type 4 driver for everything _except_ for authentication. If your server is configured to use Windows authentication, it would use a DLL to access the Windows user profile, active directory, etc information. Obviously that won't work on IBM i, it can't be a player in a Windows domain because it isn't Windows. So you must use SQL authentication instead.
kris5421
Posts: 2
Joined: Fri Dec 20, 2024 2:40 pm

Re: Unable to load authentication DLL mssql-jdbc_auth

Post by kris5421 »

Thank you Scott for your quick reply! I suspected so, but I hoped that I was wrong and there would be some way. I found a lot of information on how to connect to a db2 database using jdbc and the kerberos protocol, but only from external system to db2, but not the other way, which is what I need, i.e. as400 to external db (ms sql server) t
.hen I have to convince the administrators that it has to stay this way - SQL authentication
Post Reply