rajeshveerepalli / pyodbc

Automatically exported from code.google.com/p/pyodbc
MIT No Attribution
0 stars 0 forks source link

pyodbc.connect() crashes on Windows 2003 with SQL Server #109

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. pyodbc 2.1.7 installed on Python 2.6.5, Windows 2003 SP1, MS SQL Server 2005 
Express
2. create an empty database
3. create a system DSN in ODBC data sources for that DB
4. pyodbc.connect(dsn='TEST') crashes the Python interpreter (without 
exception) from time to time, not always but quite often.
5. same thing with pyodbc.connect('DRIVER={SQL Native 
Client};SERVER=localhost\\SQLEXPRESS;DATABASE=TEST_DB;Trusted_Connection=yes')
6. The same tests on Vista with SQL Server 2008 Express never crash.

What is the expected output? What do you see instead?
The interpreter should not crash silently. pyodbc should raise an exception if 
an error occurs.

What version of the product are you using? On what operating system?
pyodbc 2.1.7 installed on Python 2.6.5, Windows 2003 SP1, MS SQL Server 2005 
Express

Please provide any additional information below.

The following code can be used to test the issue:

import pyodbc

DSN = 'TEST' # ODBC data source name
DB = 'TEST_DB' # database name
SERVER = 'localhost\\SQLEXPRESS' # server and instance

for i in range(100):
    print 'pyodbc connection', i+1
    # connect via DSN or directly:
    #connection = pyodbc.connect('Trusted_Connection=Yes', dsn=DSN)
    connection = pyodbc.connect('DRIVER={SQL Native Client};SERVER=%s;DATABASE=%s;Trusted_Connection=Yes' % (SERVER, DB))

=> when the issue happens the script stops at 1 without raising any exception, 
else it should stop at 100.

Original issue reported on code.google.com by decal...@laposte.net on 20 Jul 2010 at 9:44

GoogleCodeExporter commented 8 years ago
I upgraded the servers to Windows 2003 SP2, and the bug does not seem to happen 
anymore. So it might be related to ODBC in Windows 2003 SP1 only.
Pyodbc still needs to be fixed to avoid crashing python on legacy servers, 
unless the bug is in Windows libraries.

Original comment by decal...@laposte.net on 20 Jul 2010 at 10:54

GoogleCodeExporter commented 8 years ago
If I'm not mistaken, it is actually a race condition in the DCOM libraries.  I 
worked with Microsoft on this a couple of years ago and got a hotfix which was 
rolled into SP2.

Original comment by mkleehammer on 20 Aug 2010 at 7:48

GoogleCodeExporter commented 8 years ago

Original comment by mkleehammer on 21 Nov 2010 at 4:44