java - com.microsoft.sqlserver.jdbc.SQLServerException: Login failed for user 'sa' -
I'm just trying to test my connection with SQL Server 2008:
public class ForJDBC {public static void (String [] args) {try {connection Conn = DriverManager.getConnection ( "JDBC: sqlserver: //XX.XX.X.XXX: 1433; DatabaseName = mydb; user = Sa; password = my password "); If (conn! = Null) {System.out.println ("The connection is successful"); }} Hold (preclass preference) {ex.printStackTrace (); }}} but I am getting the following exception:
com.microsoft.sqlserver.jdbc.SQLServerException: User 'sa' ClientConnectionId: 96f7d048-9734-4fd8-8216-21231d89b2e6 com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError (SQLServerException.java:216) com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError at (SQLServerException.javamore16) com.microsoft on .sqlserver.jdbc.TDSTokenHandler.onEOF (tdsparser.java:254) com.microsoft.sqlserver.jdbc.TDSParser.parse (tdsparser.java:84) on com.microsoft.sqlserver.jdbc.SQLServerConnection.sendLogon (com.microsoft on .sqlserver.jdbc.SQLServerConnection.logon (SQLServerConnection.java:2234) SQLServerConnection.java:2908) on com.microsoft.sqlserver.jdbc.SQLServerConnection.access $ 000 (SQLServerConnection.java:41) com.microsoft. Sqlserver.jdbc.SQLServerConnection $ LogonCommand.doExecute at com.microsoft.sqlserver.jdbc.TDSCommand.execute (IOBuffer.java.t696) at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand (SQLServerConnection.java.220) SQLServerConnection. Java: 1715) on n.connectHelper com.microsoft.sqlserver.jdbc.SQLServerConnection.login (SQLServerConnection.java:991) on com.microsoft.sqlserver.jdbc.SQLServerConnectio (SQLServerConnection.java:1326) com.microsoft.sqlserver.jdbc on .SQLServerConnection.connect (SQLServerConnection.java:827) on .microsoft.sqlserver.jdbc.SQLServerDriver.connect java.sql.DriverManager.getConnection at com (SQLServerDriver.java:1012) (DriverManager.java:664) java.sql. On DriverManager.getConnection (DriverManager.javaumer70) on forjdbc. ForJDBC.main (ForJDBC.java35) When I connect to MySQL 5.5, it works fine.
I have followed the troubleshooting steps: 1) Username "sa" in SQL Server Management Console and SQL Server Management Studio Try logging in with password
2) I
3) Updated to Java 8
Please tell me what I am doing and I Tell me if I can answer someone question.
connection string problem ...
Class.forName ("com.microsoft .sqlserver.jdbc.SQLServerDriver ");
connection = DriverManager .getConnection ( "JDBC: Sqlserver: // Sthaniyhost: 1433; \ SQLEXPRESS; Detabesnam = Theme 6", "bit", "123456")
Comments
Post a Comment