SqlServer Login failed for user

0 votes

I created a pretty straightforward JDBC login test program. And after a variety of issues, I'm almost there. Nearly, but I just can't seem to move beyond this issue:

SQLServerException: Login failed for user xxxxx

I made a basic database called PersonInfo, then I made user user1 and password1 (SQL authentication). Despite my best efforts, I was unable to establish a connection to the database. I have the most recent Microsoft JDBC driver and I'm running SQL Server 2008 on Windows 7.

My code is:

import java.sql.*;

public class hell {
public static void main(String[] args) {
    
    try {
        Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver").newInstance();
Connection conn=  DriverManager.getConnection("jdbc:sqlserver://localhost:1433;databaseName=PersonInfo;user=Sohaib;password=0000;");


System.out.println("connected");
       }

    } catch (Exception e) {
        e.printStackTrace();
    }
}
}

Here's the Exception:

Exception: Unable to get connect
com.microsoft.sqlserver.jdbc.SQLServerException: Login failed for user 'Sohaib'.
and all other supporting errors.
Aug 26 in Database by Kithuzzz
• 11,640 points
35 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In Database

0 votes
1 answer

Login failed for user 'sa'. The user is not associated with a trusted SQL Server connection. (Microsoft SQL Server, Error: 18452) in sql 2008

Solution Go to Start > Programs > Microsoft SQL Server > Enterprise Manager. Right-click the SQL ...READ MORE

answered Sep 12 in Database by narikkadan
• 19,680 points
34 views
0 votes
1 answer

MySQL Error: : 'Access denied for user 'root'@'localhost'

Hello @kartik, I did this to set my ...READ MORE

answered May 4, 2020 in Database by Niroj
• 82,780 points
15,107 views
0 votes
0 answers

Access denied for user 'root@localhost' (using password:NO)

I wanted to run WordPress and it ...READ MORE

May 8 in Database by Kichu
• 19,040 points
669 views
0 votes
0 answers
0 votes
1 answer

Using Real Time flume Data for Analysis

By using MorphlineSolrSink we can extract, transform ...READ MORE

answered Jul 17, 2018 in Database by kurt_cobain
• 9,390 points
344 views
0 votes
0 answers

com.microsoft.sqlserver.jdbc.SQLServerDriver not found error

I'm having the same issue as this thread. ...READ MORE

Sep 6 in Database by Kithuzzz
• 11,640 points
10 views
0 votes
1 answer

How to retrieve column names from java.sql.ResultSet?

You may refer the below code: ResultSet ...READ MORE

answered Jul 4, 2018 in Java by sophia
• 1,400 points
1,804 views
0 votes
1 answer

Establish JDBC Connection in R through single sign-on

You can certainly connect to databases with ...READ MORE

answered Sep 12, 2018 in AWS by Priyaj
• 58,080 points
1,463 views
0 votes
1 answer

Find Oracle JDBC driver in Maven repository

Download the jar and place it in ...READ MORE

answered Sep 26, 2018 in Java by Daisy
• 8,120 points
2,242 views
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP