GitHub - sqlanywhere/sqlany-django: Django driver for SAP Sybase SQL Anywhere (original) (raw)

This is a SQL Anywhere database backend for Django. The backend is distributed as a stand-alone python module. This backend has been tested with SQL Anywhere versions 12, 16, and 17 using Django versions 1.1.4, 1.2.7, 1.3.7, 1.4.10, 1.5.5, 1.6.1, 1.7.1, and 1.8.5.

 'NAME': 'django',  
 'USER': 'dba',  
 'PASSWORD': 'sql',  
 'HOST': 'myhost',  
 'PORT': 'portnum'  

}
}

Here's how the parameters correspond to SQL Anywhere connection parameters:

  • NAME = DatabaseName (DBN)
  • USER = Userid (UID)
  • PASSWORD = Password (PWD)
  • HOST = Host
  • PORT = (port number in host, i.e. myhost:portnum)

If you need to specify other connection parameters (eg. ENG), you can set a value with the key "OPTIONS", like this:

DATABASES = {
'default' : {
'ENGINE': 'sqlany_django',
'NAME': 'django',
'USER': 'dba',
'PASSWORD': 'sql',
'OPTIONS': {'eng': 'django'}
}
}

HOST and PORT default to 'localhost' and '2638'. If you want to use shared memory, set the HOST and PORT values to None:

DATABASES = {
'default' : {
'ENGINE': 'sqlany_django',
'NAME': 'django',
'USER': 'dba',
'PASSWORD': 'sql',
'OPTIONS': {'eng': 'django'},
'HOST': None,
'PORT': None
}
}

Alternatively, you can set the parameters in an ODBC data source using the dbdsn utility and then specify the DSN connection parameter. The ENGINE parameter must still be specified. Any other parameters (eg. USER, HOST, etc.) that are specified will override the value in the DSN. For example:

DATABASES = {
'default' : {
'ENGINE': 'sqlany_django',
'OPTIONS': {'dsn': 'my_django_dsn'}
}
}

Note: SQL Anywhere allows you to run several database servers on one machine. For this reason you should always specify the server you want to connect to as well as the database name. However if you want to connect to a server running in a SA OnDemand (cloud) environment, you should specify the NAME and HOST (and optionally PORT) options, and not specify the server name.

This package is licensed under the terms of the license described in the LICENSE file.