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

v.1.30 - connection issue using MS SQL + pyodbc + SQL Driver #181

Closed
amochin opened this issue Jul 20, 2023 · 1 comment
Closed

v.1.30 - connection issue using MS SQL + pyodbc + SQL Driver #181

amochin opened this issue Jul 20, 2023 · 1 comment
Assignees
Labels

Comments

@amochin
Copy link
Collaborator

amochin commented Jul 20, 2023

Got this error back while trying to establish a connection

OperationalError: ('08001', '[08001] [Microsoft][ODBC SQL Server Driver][DBNETLIB]Invalid connection. (14) (SQLDriverConnect); [08001] [Microsoft][ODBC SQL Server Driver][DBNETLIB]ConnectionOpen (ParseConnectParams()). (14); [08001] [Microsoft][ODBC SQL Server Driver]Invalid connection string attribute (0)')

with connectionstring

pyodbc.connect(DRIVER={SQL Server};SERVER=dbserver:1433;DATABASE=database;UID=user;PWD=***).

The version of pyodbc is 4.0.39 and calling the keyword looks like this in our setup

Connect To Database    pyodbc    ${database}    ${${omgeving}.user}    ${DBPassword}    ${${omgeving}.host}    ${${omgeving}.port}
@amochin amochin added the bug label Jul 20, 2023
@amochin amochin self-assigned this Jul 20, 2023
@amochin amochin reopened this Jul 20, 2023
amochin added a commit that referenced this issue Jul 20, 2023
…r - SQL Server drivers use a comma between server and port, others - a colon
@amochin amochin changed the title v.1.30 - connection issue using MS SQL + pyodbc v.1.30 - connection issue using MS SQL + pyodbc + SQL Driver Jul 20, 2023
@amochin
Copy link
Collaborator Author

amochin commented Jul 20, 2023

The issue must be related to the updated syntax of the connection string, when using the pyodbc module.

It was changed to put a colon instead of a comma between the server and the port.
The problem is that it's different depending on the SQL Driver - pyodbc just transfers the connection string to the driver without any parsing.

The colon syntax is required by My SQL drivers, the old comma syntax is necessary for the SQL Server drivers.

Now different syntax is used depending on the driver in use - should solve the issue.

@amochin amochin closed this as completed Jul 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant