How would I know the password of my Microsoft SQL server ?

V.T. BHARGAV 10 Reputation points
2024-02-23T08:26:49.7966667+00:00

I want to connect the java to my Microsoft SQL server. In order to connect that I need the password and username how would I know them?

SQL Server Other
{count} votes

5 answers

Sort by: Most helpful
  1. RahulRandive 10,486 Reputation points Volunteer Moderator
    2024-02-23T14:17:08.72+00:00

    Hi @V.T. BHARGAV

    To connect to your Microsoft SQL Server, you will need a valid SQL login and password. Here are the steps to find them:

    1. Open SQL Server Management Studio (SSMS) on your computer.
    2. In the Connect to Server or Connect to Database Engine dialog box, edit the Server name value. Enter the IP address or full DNS name of the SQL Server.
    3. In the Authentication box, select SQL Server Authentication.
    4. In the Login box, you should see a list of valid SQL logins. If you don't see any, you will need to create a new SQL login.
    5. If you need to create a new SQL login, follow the steps in this Azure documentation.
    6. Once you have a valid SQL login, you can use it to connect to your Microsoft SQL Server. In the Login box, type the name of the SQL login. In the Password box, type the password of the login.

    If SQL authentication is already enabled, your admin should have the password; there is no way to retrieve it from SQL Server. Otherwise, you may need to reset the password and use in connection string.

    I hope this helps! Let me know if you have any further questions. Thank you!

    1 person found this answer helpful.
    0 comments No comments

  2. Dronec 181 Reputation points
    2024-02-23T08:36:33.3633333+00:00

    You need to switch your SQL server to SQL authentication mode (see here https://learn.microsoft.com/en-us/sql/database-engine/configure-windows/change-server-authentication-mode?view=sql-server-ver16) and then create a user with login and password which you'd use in your JDBC connection string.

    0 comments No comments

  3. Erland Sommarskog 121.4K Reputation points MVP Volunteer Moderator
    2024-02-23T18:03:40.4333333+00:00

    You would have to ask your DBA what credentials to use. No one here knows what users there are on the SQL Server instance you are connecting to. Even less their passwords.

    There is a fair chance, though, that the best connection is through Windows authentication. Then you say Trusted_connection=yes or similar in the connection string, and SQL Server will get the security token from Windows.

    Whether this is what you actually should use - against ask your DBA.

    0 comments No comments

  4. webserverforum 65 Reputation points
    2024-02-25T12:29:10.43+00:00

    SQL server password is not saved in plain text anywhere so if you do not have it, you can reset it by first login with Windows Authentication to SQL and then reset password of "SA" user which is main user of MSSQL service

    0 comments No comments

  5. LiHongMSFT-4306 31,566 Reputation points
    2024-02-26T03:19:52.4933333+00:00

    Hi @V.T. BHARGAV Here is an article on how to recover SA password.

    Best regards,

    Cosmog Hong


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our Documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.