Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ticket Expired Error when connecting to SQL Server from Red Hat 8 using Active DIrectory Authentication #744

Closed
jrisi256 opened this issue Apr 16, 2020 · 2 comments

Comments

@jrisi256
Copy link

jrisi256 commented Apr 16, 2020

Environment

  • Python: 3.7.6
  • pyodbc: 4.0.30
  • OS: Red Hat 8
  • DB: SQL Server (and SQL Server Express)
  • driver: ODBC Driver for 17 for SQL Server

Issue

Hello! Thanks for making such a great package, and I hope you're staying safe and healthy during these difficult times.

Below is a screenshot detailing the error message I receive upon trying to connect to a particular server at my company using pyodbc.

image

I don't believe there is an issue with the odbc.ini entry or the server itself because I'm able to connect to the server (from the machine in question) using the R programming language so I believe it has something to do with pyodbc.

Below is the relevant entry in the odbc.ini file (with sensitive information excluded).

[Projects]
Driver = ODBC Driver 17 for SQL Server
Description = Microsoft ODBC Driver 17 for SQL Server
Server = /* sensitive */
ServerSPN = /* sensitive */
Trusted_Connection = yes

I suspect the issue has something to do with the fact we authenticate users using our Active Directory system, and pyodbc has its "prompt" turned off by default. As a result, users aren't able to enter in their credentials. This is just a hunch though, and I figured I would submit this as an issue to see if you had any further insight into what may be causing the issue.

@v-chojas
Copy link
Contributor

Trusted_Connection=yes will use Kerberos for authentication, and the message indicates the Kerberos ticket has expired. Check that the clock is correct and use the kinit command to request a new one.

See this document for more information: https://docs.microsoft.com/en-us/sql/connect/odbc/linux-mac/using-integrated-authentication

@jrisi256
Copy link
Author

Thanks this solved it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants