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

Renato Battaglia 0 Reputation points
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
{count} votes

3 answers

Sort by: Most helpful
  1. LiHongMSFT-4306 31,566 Reputation points
    2024-10-31T03:23:26.3+00:00

    Hi @Renato Battaglia

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


  2. Olaf Helper 47,436 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. Bruce (SqlWork.com) 77,686 Reputation points Volunteer Moderator
    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

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.