connection impossible SQL Server
je veux utiliser le JDBC pour me connecter à ma base sql server.
mais toujours c'est le login et mot de passe qui sont incorrect:
j'ai assayé le nom de ma machibne, le workgroup name, le "sa" "sa"(superadmin normalment de la base par défaut en installant le sql server)
j'ai assayé le "sa" comme login et "" comme mot de passe mais rien ne passe.
j'ai configuré normalement mon sqlserver via son outil de configuration.
aidez moi et dites moi comment faire pour utiliser peut étre le ODBC si ça marchera
Connection à ms sqlserver problèmes
J'ai le même problème
Je suis en java version 8 (1.8.0_25 64 bits)
Bon voici ce que j'ai fait:
j'ai downloader le driver de krosoft c'est le bon sqljdbc4.jar contenu dans un exe: sqljdbc_4.0.2206.100_enu.exe
je l'ai extrait dans un de mes folders
Ensuite dans mon application java, j'ai ajouté le chemin au jar sqljdbc4.jar en indiquant au projet le chemin d'accès dans le java build path
et enfin pondu le code suivant:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| private void initConnection() {
String driver = "com.microsoft.sqlserver.jdbc.SQLServerDriver";
String userName = "user";
String passWord = "password";
String connectionUrl = "jdbc:sqlserver://SQLHRC00500P01:1433";
con = null;
try {
Class.forName(driver);
con = (Connection) DriverManager.getConnection(connectionUrl, userName, passWord);
} catch(ClassNotFoundException cnfe){
System.out.println("Driver not found");
cnfe.printStackTrace();
} catch (SQLException e) {
System.out.println("Sql Error");
System.out.println(e.getSQLState());
System.out.println(e.getStackTrace());
e.printStackTrace();
}
}
} |
j'ai remplacé ici, le userName et passWord pour raison de sécurité :-)
Je suis sur du nom du serveur, j'ai fait un ping, je suis sur du userName et
passWord, c'est celui de mon collègue qui lui accède directement à SQL Server
j'ai essayer d'ajouter la property: integrated Authentification = true
mais cela me sort un message étrange qui est le suivant pour le connexion string qui est le suivant
String connectionUrl = "jdbc:sqlserver://SQLHRC00500P01:1433;IntegratedSecurity=true";
Message:
May 26, 2016 4:18:05 PM com.microsoft.sqlserver.jdbc.AuthenticationJNI <clinit>
AVERTISSEMENT: Failed to load the sqljdbc_auth.dll cause : no sqljdbc_auth in java.library.path
Sinon dans la property IntegartedSecurity=yes, j'ai les erreurs suivantes.
je pense que cela pourrait-être une histoire de registration de dll, path ou connection string
le DriverManager est celui de java.sql.driveManger
voici la liste des erreurs et merci pour toute aide qui pourrait m'aider à comprendre pourquoi
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
| com.microsoft.sqlserver.jdbc.SQLServerException: Login failed for user 'pgiroua'. ClientConnectionId:d15f54a2-4144-47a9-8d78-bfee25110879
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:216)
at com.microsoft.sqlserver.jdbc.TDSTokenHandler.onEOF(tdsparser.java:254)
at com.microsoft.sqlserver.jdbc.TDSParser.parse(tdsparser.java:84)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.sendLogon(SQLServerConnection.java:2908)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.logon(SQLServerConnection.java:2234)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.access$000(SQLServerConnection.java:41)
at com.microsoft.sqlserver.jdbc.SQLServerConnection$LogonCommand.doExecute(SQLServerConnection.java:2220)
at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:5696)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:1715)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:1326)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:991)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:827)
at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:1012)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at application.EmployeePortalDialog.initConnection(EmployeePortalDialog.java:534)
at application.EmployeePortalDialog.<init>(EmployeePortalDialog.java:146)
at application.EmployeePortalDialog$1.run(EmployeePortalDialog.java:107)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$400(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source) |