SQLServerException: This driver is not configured for integrated authentication

6

Usage:

  • Eclipse Oxygen
  • SQL Server 2017
  • SQL Management Studio 17.3
  • Microsoft JDBC Driver 6.0 for SQL Server
  • Java jre1.8.0_151 x64
  • Windows 10 x64

Every time I run my program I get the following error.

Error:

  

SQLServerException: This driver is not configured for integrated authentication.

I tried:

  • link
  • link
  • link
  • link
  • link
  • link
  • link
  • I have sqljdbc_auth in "C: \ Program Files \ Java \ jre1.8.0_151 \ bin".
  • I have sqljdbc_auth in "C: \ Program Files \ Java \ jre1.8.0_151 \ lib".
  • I have sqljdbc42 in my project and in Java Build Path.
  • I tried adding sqljdbc_auth (x64 and x86) to "C: \ Windows \ System32".
  • I tried adding sqljdbc_auth (x64 and x86) to "C: \ Windows \ SysWOW64".

My connection class:

public class ConexionSQL {

    public String driver = "com.microsoft.sqlserver.jdbc.SQLServerDriver";
    public String database = "industriaCine";
    public String hostname = "localhost";
    public String port = "1433";
    public String url = "jdbc:sqlserver://" + hostname + ":" + port + ";databaseName=" + database + ";integratedSecurity=true";

    public Connection conectarSQL() {
        Connection conn = null;

        try {
            Class.forName(driver);
            conn = DriverManager.getConnection(url);
            System.out.println("Conectado a la base de datos.");
        } catch (ClassNotFoundException | SQLException e) {
            JOptionPane.showMessageDialog(null, "SQLException:\n" + e, "Error: conectarSQL()", JOptionPane.ERROR_MESSAGE);
        }

        return conn;
    }
}

Nothing works for me, I still get the same error. How can I fix it?

Thanks in advance.

    
asked by Robert Gomez 08.11.2017 в 23:13
source

1 answer

1

It is not known if this is a bug that has come back to life. The truth is that in 2005 this bug was already reported in Eclipse, and if you review this thread , You will see that the problem appears intermittently at the end of the years (the last report is February 2017).

As you said that you have been doing things and putting the file in different folders, I think it was time to do clean . To do this, delete wherever you have copied the file sqljdbc_auth.dll and then put it back into practice what the documentation says about it:

  

To use integrated authentication, copy the file    sqljdbc_auth.dll in a directory of the Windows system path in   that the JDBC driver is installed.

The route would be: <directorio de instalación>\sqljdbc_<version>\<language>\auth\

Keep in mind what the notes say:

  • If you are running a Java virtual machine (JVM, Java Virtual Machine) 32 bits, use the sqljdbc_auth.dll file in the x86 folder, even if the operating system version is x64. If you are running a 64-bit JVM on an x64 processor, use the sqljdbc_auth.dll file in the x64 folder. If you are running a 64-bit JVM on an Itanium processor, use the sqljdbc_auth.dll file in the IA64 folder.

  • The JDBC driver does not support integrated authentication when the driver is running on non-Windows operating systems. The driver does not provide functionality to provide Windows authentication credentials, such as username and password when connecting to SQL from non-Windows operating systems. In such cases, applications must use SQL Server authentication.

Taking into account the above, and seeing that in your environment everything is compatible with 64 bits, delete everything else related to this matter and download all again , the JDBC drivers included.

As for the sqljdbc_auth.dll file, be sure to copy the corresponding file to the folder indicated above:

JDBC 4.2 & JDBC 6.0

    auth
        x64
            sqljdbc_auth.dll <-----ESTE ES TU ARCHIVO
        x86
            sqljdbc_auth.dl
        jre7
            sqljdbc41.jar
        jre8
            sqljdbc42.jar    <-----ESTE ES TU ARCHIVO
    samples
    xa
        x64
            sqljdbc_xa.dll
        x86
            sqljdbc_xa.dll

If doing all of that, and everything you've done before is not resolved. We could think that we are facing a bug. If you report to Eclipse commenting on the same thread as the link already indicated, it could help clarify that doubt.

If with version 6 it does not work, then it temporarily changes to version 4.

In any case, make sure you have cleaned everything, lest you try to read one of the files that does not work first.

    
answered by 16.11.2017 в 02:57