I ran into a problem with a Python script that connects to a MS SQL mirror database. It throws a segmentation error when I try to connect to the database a second time. Both application servers and DB instances run on the Google Compute Engine.
Here is some code that replicates the problem:
import pyodbc params = { 'autocommit': True, 'uid': 'myuser', 'tds_version': '8.0', 'DRIVER': '{mssql}', 'pwd': 'mypassword', 'server': 'sql-server-01', 'database': 'mydb', 'port': 1433, } c1 = pyodbc.connect(**params) c2 = pyodbc.connect(**params)
The first connection (c1) completed successfully, but the second connection (c2) does not work immediately with segfault. "mydb" is mirrored on the second server (sql-server-02). Using a non-mirrored database or disabling mirroring for this database forces it to leave.
We tried to update several libraries, and this did not help to solve the problem. Versions:
- Microsoft SQL Server: 12.00.2000 (latest version)
- Python: 2.7.6
- pyodbc: 3.0.10 (last)
- unixODBC: 2.2.14p2-5ubuntu5, 2.3.0, 2.3.4 (last)
- MS ODBC driver for RedHat: 11.0.1790.0, 11.0.2270.0 (last)
To add here, Java code doing the exact same thing works fine.
Any ideas?
source share