OLE DB Provider for SQL Server' Error

Issue #13 resolved
Anonymous created an issue

I have some strange issue with querying MS-SQL from django. When I query db twice in single request, I got errors in some cases. Namely when first db query returns big amount of data, we end up with error while querying db second time.

Details:

We're using Microsoft SQL server backend for Django (https://bitbucket.org/Manfre/django-mssql/src) running on windows.

We want allow user to filter data from some table ("Activity") via form, display it on the website's table and then show related data from another table ("Frames") on map. class Frames(models.Model): ...

class Activity(models.Model): frame_from = models.ForeignKey(Frames, ...) ...

The problem is: when we want to filter larger amount of data from Activity (let's say 200rows x 6 colums), we can not make other queries in the same request on table Frames (MARS is turned on in Django settings.py): result = Aktywnosci.objects.filter(qset1)

is always ok, but

path = Frames.objects.filter(qset2)

when the previous query returned larger amount of data, raises OLE DB Error: 'Microsoft OLE DB Provider for SQL Server' Error: Cannot create new connection because in manual or distributed transaction mode.

What can I do about it?

Thanks in advance

Comments (2)

  1. Michael Manfre repo owner

    SQLOLEDB and MARS doesn't work very well and I intend on changing all of the documentation and defaults to assume a native client driver will be used. Try using the native client; "SQLNCLI10" or "SQLNCLI11".

    DATABASES = {
        'default': {
            'ENGINE': 'sqlserver_ado',
            'NAME': 'mydb',
            'HOST': r'localhost',
            'USER': '',
            'PASSWORD': '',
            'OPTIONS': {
                'provider': 'SQLNCLI10',
                'extra_params': 'DataTypeCompatibility=80;MARS Connection=True;',
            },
        }
    }
    
  2. Log in to comment