Java executable

3

I have already converted my Java executable to .exe, but when I run the .exe I log in and I accept, I get the following error:

  

"This driver is not configured for authentication   integrated ".

This is my connection to the sql server database:

public Connection getConectar(){
        Connection cn = null;
        try {
            Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
            cn = DriverManager.getConnection(
                   "jdbc:sqlserver://localhost:1433;
                   databaseName=FEBAN_PRUEBA_ERP;integratedSecurity=true;");
        } 
        catch (Exception e) {
            e.printStackTrace();
            System.out.println("Error"+e.getMessage());
            JOptionPane.showMessageDialog(null, "Error:"+" "+e.getMessage());
        }
        return cn;
    }

in the run configurations, in the arguments option I write the path where the sqljdbc_auth.dll dll is located

    
asked by Leandro 07.03.2017 в 20:23
source

1 answer

1

I'll copy you translated what it says Microsoft about your business:

  

Connecting with Integrated Authentication

     

The JDBC driver supports the   use of Type 2 integrated authentication on Windows operating systems   through the integratedSecurity connection string property. To use   integrated authentication, copy the sqljdbc_auth.dll file to a   directory on the Windows system path on the computer where the JDBC   driver is installed. The sqljdbc_auth.dll files are installed in the   following location: \ sqljdbc _ \\ auth \

     

Note : If you are running a 32-bit Java Virtual Machine (JVM), use the sqljdbc_auth.dll file in the x86 folder, even if the operating system is the x64 version. If you are running 64-bit JVM on a x64 processor, use the sqljdbc_auth.dll file in the x64 folder. If you are running a 64-bit JVM on a IA-64 processor, use the sqljdbc_auth.dll file in the IA64    folder Alternatively, you can set the java.libary.path system property    to specify the directory of the sqljdbc_auth.dll. For example, if the    JDBC driver is installed in the default directory, you can specify the    location of the DLL by using the following virtual machine (VM)    argument when the Java application is started:

     

-Djava.library.path = C: \ Microsoft SQL Server 2005 JDBC Driver \ sqljdbc_ \ enu \ auth \ x86

     

Connection with integrated authentication

     

The JDBC driver supports the use of integrated authentication of   type 2 on Windows operating systems through the ownership of   IntegratedSecurity connection string. To use authentication   integrated, copy the file sqljdbc_auth.dll to a directory in the   Windows system path on the computer where the system is installed   JDBC driver . The sqljdbc_auth.dll files are installed in the   Next location: <installation directory>\sqljdbc_<version>\<language>\auth\

     

Note :

     
  • If you are running a 32-bit Java virtual machine (JVM), use the sqljdbc_auth.dll file in the x86 folder, even if the operating system is version x64 .

  •   
  • If you are running a 64-bit JVM on an x64 processor, use the   file sqljdbc_auth.dll in the folder x64 .

  •   
  • If you are running a 64-bit JVM on an IA-64 processor, use the sqljdbc_auth.dll file in the IA64 folder.

  •   

    You can also set the system property java.libary.path to specify the sqljdbc_auth.dll directory.   For example, if the JDBC driver is installed in the directory   By default, you can specify the location of the DLL using the   following virtual machine (VM) argument when the   Java application:

         

    -Djava.library.path=C:\Microsoft SQL Server 2005 JDBC Driver\sqljdbc_<version>\enu\auth\x86

    Connection Chains I imagine that your connection chains are fine. Anyway, here are some examples taken from Microsoft :

    Connect to the default database on the local computer by using integrated authentication:

    jdbc:sqlserver://localhost;integratedSecurity=true;
    

    Connect to a database named on a remote server:

    jdbc:sqlserver://localhost;databaseName=AdventureWorks;integratedSecurity=true;
    

    Connect on the default port to the remote server:

    jdbc:sqlserver://localhost:1433;databaseName=AdventureWorks;integratedSecurity=true;
    

    Connect by specifying a customized application name:

    jdbc:sqlserver://localhost;databaseName=AdventureWorks;integratedSecurity=true;applicationName=MyApp;
    
        
    answered by 07.03.2017 / 23:01
    source