Share via

How to connect to SQL Server using JDBC Driver, with the user as myDomain\myUser, from Linux without DotNet?

Anonymous
2024-10-30T13:58:35.2566667+00:00

How to connect to SQL Server using JDBC Driver, with the user as myDomain\myUser, from Linux without DotNet?

  • JDBC driver .jar file being used is mssql-jdbc-12.8.1.jre8.jar
  • MS SQL Server version being used is 16
  • Requires encryption = true
  • The computer trying to connect to the SQL Server is a Linux box without any DotNet infrastructure

PS: (edited, fixed user in this question from myUser\myDomain to myDomain\myUser)

SQL Server | Other
0 comments No comments

3 answers

Sort by: Most helpful
  1. Bruce (SqlWork.com) 83,741 Reputation points
    2024-11-11T16:37:24.1933333+00:00

    To connect to Sqlserver from Linux with a domain account you use kerberos. Basically you connect with kinit first, then use trusted_connection:

    https://learn.microsoft.com/en-us/sql/connect/odbc/linux-mac/using-integrated-authentication?view=sql-server-ver16

    note: on a Mac you can just ticket viewer to connect.

    0 comments No comments

  2. Olaf Helper 47,616 Reputation points
    2024-11-01T09:40:25.0333333+00:00

    with the user as myDomain\myUser

    If the Linux server is joined to a domain, then you can use the connection string property "integratedSecurity", see

    https://learn.microsoft.com/en-us/sql/connect/jdbc/building-the-connection-url?view=sql-server-ver16


  3. LiHongMSFT-4306 31,621 Reputation points
    2024-10-31T03:23:26.3+00:00

    Hi @Anonymous

    Please check this article for detailed steps: Microsoft SQL Server JDBC for Linux.

    Best regards,

    Cosmog


    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".


Your answer

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