Can't connect with Data Virtuality Server - even though the connection via ISQL works #1387
-
Hi everybody, I am trying to connect to Data Virtuality Server using PyODBC. This command works: isql -v DataVirtualityDSN <USERNAME> <PASSWORD> However, no matter how hard I try (different conn_str formats, as consulting whatever I found online), I always get the same error when running the following script (x86/ARM universal python venv, Terminal under Rosetta) arch -x86_64 python3 connection.py
Available drivers: ['DataVirtuality']
Available DSNs: ['DataVirtualityDSN', 'dvodbc']
Attempting to connect...
Error connecting to the database: ('0000', '[0000] c (202) (SQLDriverConnect)') Here the script: import pyodbc
pyodbc.pooling = False
conn_str = (
"Driver=DataVirtuality;"
"Server=XXX.XXX.XXX.XX;"
"Port=35432;"
"Database=datavirtuality;"
"UID=<USERNAME>;"
"PWD=<PASSWORD>;"
)
# conn_str = "DSN=DataVirtualityDSN;UID=<USERNAME>;PWD=<PASSWORD>" # also did not work
# conn_str = "DSN=DataVirtualityDSN" # also did not work
try:
# Driver is available, DSN as well
print("Available drivers:", [x for x in pyodbc.drivers()])
print("Available DSNs:", [x for x in pyodbc.dataSources()])
print("Attempting to connect...")
conn = pyodbc.connect(conn_str)
print("Connection successful!")
cursor = conn.cursor()
cursor.execute("SELECT 1")
result = cursor.fetchone()
print("Test query result:", result)
except pyodbc.Error as e:
print(f"Error connecting to the database: {e}") Since the Anything else I could try? |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 3 replies
-
What version of pyodbc are you using? Also, please provide the ODBC trace from a failed connection attempt. |
Beta Was this translation helpful? Give feedback.
-
thanks for the response! pyodbc==5.2.0 ODBC trace:
|
Beta Was this translation helpful? Give feedback.
-
(under python 3.9.20)
|
Beta Was this translation helpful? Give feedback.
-
@gordthompson |
Beta Was this translation helpful? Give feedback.
@gordthompson
Finally I made it, I had to downgrade pyodbc even further. That pretty much did the trick.
pyodbc==4.0.34