Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8531889
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T09:35:14+00:00 2026-06-11T09:35:14+00:00

I have some strange issue with querying SQL Server from django. When I query

  • 0

I have some strange issue with querying SQL Server 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.

PS. Database settings from settings.py:

# Database for this installation. 
DATABASES = {
'default':{
    'ENGINE': 'django.db.backends.sqlserver_ado', 
    'NAME': '***',                      
    'USER': '***',                      
    'PASSWORD': '***',                  
    'HOST': '***',                      
    'PORT': '',                        
    'OPTIONS' : {
        'provider': 'SQLOLEDB',
        'use_mars': True,                    
          }
}
}

PS2. I came across this issue on the google-code page of djang-mssql: http://code.google.com/p/django-mssql/issues/detail?id=79 – but it seems to be solved in new version of package…

What can I do about it?

Thanks in advance

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T09:35:15+00:00Added an answer on June 11, 2026 at 9:35 am

    We got the solution at bitbucket: https://bitbucket.org/Manfre/django-mssql/issue/13/ole-db-provider-for-sql-server-error from Michael Manfre – thanks a lot for this.

    The solution is following:

    “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;',
            },
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: AJAX request fails to process $_SESSION variable I have some strange issue
I have encountered strange issue. From Activity onStart() I request Bluetooth activation and 120s
So i have this rather strange issue, i am trying to line up some
I have some strange comportement with my ajax request. The ajax request processes correctly,
I have some strange behavior redirecting stdout and stderr from s3cmd. For example: $
Seeing some strange things; help is being solicited. I have a query, like so:
I've been having some strange errors lately. I have a working install of Git,
I have this strange issue with some third party DLL's. The third party provider
I have a strange issue from a client in that our code, which they
So I have some strange issue with nl2br so I have the following code:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.