J'essaie de connecter un programme Java à une base de données SQL Server. L'important est que je travaille sur une machine Windows 7, mon Eclipse est sur une machine Linux sur le réseau de mon entreprise, et le SQL Server demande une authentification Windows.Je ne comprends pas pourquoi "no sqljdbc_auth in java.library.path" persiste
J'ai copié et collé le pilote sqljdbc41.jar à l'emplacement de mon projet (sur Eclipse, faites un clic droit sur le projet, propriétés et voir l'emplacement). J'ai également collé le sqljdbc_auth.dll dans le même emplacement. J'ai essayé d'ajouter le chemin de ce fichier .dll sur le « emplacement de la bibliothèque autochtone suivant ce poste. https://stackoverflow.com/a/958074/7812989 Mais j'ai encore cette erreur:
Jul 10, 2017 10:52:35 AM com.microsoft.sqlserver.jdbc.AuthenticationJNI <clinit>
WARNING: Failed to load the sqljdbc_auth.dll cause : no sqljdbc_auth in java.library.path
com.microsoft.sqlserver.jdbc.SQLServerException: This driver is not configured for integrated authentication. ClientConnectionId:39389d4c-36cd-459f-b9f8-15d3cf422b34
at com.microsoft.sqlserver.jdbc.SQLServerConnection.terminate(SQLServerConnection.java:2397)
at com.microsoft.sqlserver.jdbc.AuthenticationJNI.<init>(AuthenticationJNI.java:68)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.logon(SQLServerConnection.java:3132)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.access$100(SQLServerConnection.java:43)
at com.microsoft.sqlserver.jdbc.SQLServerConnection$LogonCommand.doExecute(SQLServerConnection.java:3123)
at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:7505)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:2445)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:1981)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:1628)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectInternal(SQLServerConnection.java:1459)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:773)
at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:1168)
at java.sql.DriverManager.getConnection(DriverManager.java:571)
at java.sql.DriverManager.getConnection(DriverManager.java:215)
at sqlconnectiontest.SqlSelection.main(SqlSelection.java:19)
Caused by: java.lang.UnsatisfiedLinkError: no sqljdbc_auth in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1878)
at java.lang.Runtime.loadLibrary0(Runtime.java:849)
at java.lang.System.loadLibrary(System.java:1087)
at com.microsoft.sqlserver.jdbc.AuthenticationJNI.<clinit>(AuthenticationJNI.java:41)
... 13 more
Mon code est le suivant:
package sqlconnectiontest;
import java.sql.*;
public class SqlSelection {
/**
* @param args
*/
public static void main(String[] args) {
try
{
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
String userName = "myUser";
String password = "myPassword";
String url = "jdbc:sqlserver://fr0-iaascls-190.eu.company.corp:10001;databaseName=MYDATABASE;integratedSecurity=true;";
Connection con = DriverManager.getConnection(url, userName, password);
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
avez-vous une idée qui peut aider s'il vous plaît? Merci :)
Merci! Ca marche, je n'ai pas fait attention à ça avant ... – LaPalme
@LaPalme, De rien! ;) –
Je reviens juste pour ajouter un détail. Cela fonctionne réellement dans l'Eclipse que j'ai installé sur mon ordinateur Windows, mais lorsque j'utilisais l'Eclipse dont je parlais, sur une machine Linux sur le réseau de l'entreprise, ça ne fonctionne toujours pas avec la bonne version de sqljdbc_auth.dll. Donc finalement le problème est résolu car j'ai une Eclipse sur ma machine Windows. – LaPalme