Closed AndreiLetyushov closed 1 year ago
This has nothing to do with pyODBC. Please contact your DBMS vendor instead.
Use the Windows ODBC Administrator (odbcad32.exe) to create a System DSN for your database, and use the "Test Connection" button to verify that the DSN is configured correctly. Then try
import pyodbc
cnxn = pyodbc.connect("DSN=your_dsn;UID=your_username;PWD=your_password")
print("Connected.")
If that fails, then it is a pyodbc issue. Otherwise, you have some other problem.
Good day for you! I have the same issue.
When i try to connect to the database, i get the following error: "Error ('28000', '[28000] [SAP][ODBC Driver][SQL Anywhere]Invalid user ID or password (-103) (SQLDriverConnect); [28000] [SAP][ODBC Driver][SQL Anywhere]Invalid user ID or password (-103)')"
Code:
import pyodbc
if __name__ == '__main__':
try:
connection = pyodbc.connect('DSN=TEST;UID=dba;PWD=sql;')
except Exception as e:
print(f'Error {e}')
It was the server that changed to cause this problem, and not pyODBC, so you should talk to your DBMS vendor about this. pyODBC is just a passthrough.
@SmallGreenHedgehog - Was your test (above) run from a Windows machine?
Yes. It was Windows 11
Yes. It was Windows 11
Okay, thanks. Please save the following code to a file named odbc_test.vbs
…
' odbc_test.vbs
Set conn = CreateObject("ADODB.Connection")
conn.Open "DSN=TEST;UID=dba;PWD=sql;"
WScript.Echo "Connected."
… and try running it from a command prompt with
cscript odbc_test.vbs
Does it give the same error?
Unfortunately yes. The same error.
Microsoft OLE DB Provider for ODBC Drivers: [SAP][ODBC Driver][SQL Anywhere]Invalid user ID or password
Thank you for answers.
OK so this is not a pyodbc issue per se, because the VBScript also fails and it doesn't use pyodbc.
As @v-chojas suggests, you'll need to reach out to the SQL Anywhere community and ask about what might have broken ODBC functionality in a recent release of SQL Anywhere.
And BTW, I just tried to get an ODBC trace when I click the "Test Connection" button in the ODBC Data Source Administrator. I got the "Connection successful" message but no trace file was created, so whatever the "Test Connection" button is doing it's apparently not going through the ODBC Driver Manager.
Environment
Issue
After SQL Anywhere server was updated to 17.0.10.5963 version, python application get error about wrong user id or password. Tried from MacOS, linux, Windows. The same error on the all platforms.
But SQL Central(Windows version) with the same credentials works perfect, connects to server without problem.