This repository has been archived by the owner. It is now read-only.
Switch branches/tags
Nothing to show
Clone or download



This fork has been abandoned in favor of, which contains all fixes from this fork as well as numerous others (including django 1.5 support). It is being actively maintained, and since I no longer work at the organization that required this library, I have no intention of continuing the efforts. Please visit for ongoing changes.

What follows is the original README.txt file.


A Django_ MS SQL Server external DB backend that uses ODBC by employing
the pyodbc_ library. It supports SQL Server 2000 and 2005.

.. _Django:
.. _pyodbc:


* Supports LIMIT+OFFSET and offset w/o LIMIT emulation under SS2005.
* Supports LIMIT+OFFSET under SS2000.
* Transparently supports Django's TextField both under SS2000 and SS2005.
* Passes most of the tests of the Django test suite.
* Compatible with SQL Server and SQL Server Native Client from Microsoft
  (Windows) and FreeTDS ODBC drivers (Linux).


* Django from SVN, revision 8328 or newer (1.0 is r8961.)
* pyodbc 2.0.58 or newer


 1. Install pyodbc.

 2. Add the directory where you have copied the project files to your Python
    path. So, for example, if you have the following directory structure::

            +- sql_server
                  +- pyodbc

    you should add ``/home/user/src/django-pyodbc`` to you Python module search
    path. One way to do this is setting the ``PYTHONPATH`` environment

       $ export PYTHONPATH=/home/user/src/django-pyodbc

 3. Now you can point the ``DATABASE_ENGINE`` setting in the settings file used
    by your Django application or project to the ``'sql_server.pyodbc'``
    module path::



The following settings control the behavior of the backend:

Standard Django settings

    String. Database name. Required.

    String. SQL Server instance in ``"server\instance"`` format.

    String. Server instance port.

    String. Database user name. If not given then MS Integrated Security will
    be used.

    String. Database user password.

    Dictionary. Current available keys are:

        Boolean. Indicates if pyodbc should direct the the ODBC driver to
        activate the autocommit feature. Default value is ``False``.

        Boolean. Only relevant when running on Windows and with SQL Server 2005
        or later through MS *SQL Server Native client* driver (i.e. setting
	``DATABASE_ODBC_DRIVER`` to ``"SQL Native Client"``). See
        Default value is ``False``.

        Boolean. Only relevant if using the FreeTDS ODBC driver under

        By default, when using the FreeTDS ODBC driver the value specified in
        the ``DATABASE_HOST`` setting is used in a ``SERVERNAME`` ODBC
        connection string component instead of being used in a ``SERVER``
        component; this means that this value should be the name of a
        *dataserver* definition present in the ``freetds.conf`` FreeTDS
        configuration file instead of a hostname or an IP address.

        But if this option is present and it's value is True, this special
        behavior is turned off.

        See for more information.

``django-pyodbc``-specific settings

    String. A named DSN can be used instead of ``DATABASE_HOST``.

    String. ODBC Driver to use. Default is ``"SQL Server"`` on Windows and
    ``"FreeTDS"`` on other platforms.

    String. Additional parameters for the ODBC connection. The format is

    String. Name of the collation to use when performing text field lookups
    against the database. Default value is ``"Latin1_General_CI_AS"``.
    For Chinese language you can set it to ``"Chinese_PRC_CI_AS"``.




* Ramiro Morales `<>`_
* Filip Wasilewski (
* Wei guangjing `<>`_
* mamcx (
* Alex Vidal `<>`_