Check out the LimeSurvey source code on GitHub!

Database connection problem using MSSQL

6 years 3 months ago #51269 by Scotbot

My Limesurvey install works fine with MYSQL, no problems at all. I'm running CentOS 5.5 and have all the required software installed as far as I know.

However I get this message from lime survey, whether I try to reconfigure an existing installation or with a new installation:

Can't connect to LimeSurvey database. Reason: [unixODBC][Driver Manager]Data source name not found, and no default driver specified

Other php scripts can connect to the database without any problem, eg this one:


$hostdbnot = "volante";
$userdbnot = "limesurveytest";
$passdbnot = "******";
$basedbnot = "limesurveytest";

$dbgamesnot = mssql_connect($hostdbnot, $userdbnot, $passdbnot);
if ($dbgamesnot) echo 'Great!';
else echo 'Damn';
mssql_select_db($basedbnot, $dbgamesnot);

echo mssql_get_last_message();


Here's the contents of my congif.php database section:

// Basic Setup

$databasetype = 'odbc_mssql'; // ADOdb database driver - valid values are mysql, mysqli, odbc_mssql, mssql_n, odbtp or postgres
// mysql: Recommended driver for mysql
// mysqli: Slightly faster driver for mysql - not on all server systems available
// odbc_mssql: MSSQL driver using ODBC with MS SQL Server
// mssqlnative: Native SQL Server driver for SQL Server 2005+
// mssql_n: Experimental driver for MS SQL Server which handles UTF-8 charsets
// odbtp: ODBTP driver to access MSSQL-Server is needed for this one - we also recommend to activate $databasepersistent for decent speed
// postgres: Standard postgres driver

$databaselocation = 'volante'; // Network location of your Database - for odbc_mssql or mssqlnative use the mssql servername, not localhost or IP
$databasename = 'limesurveytest'; // The name of the database that we will create
$databaseuser = 'limesurveytest'; // The name of a user with rights to create db (or if db already exists, then rights within that db)
$databasepass = '****'; // Password of db user
$dbprefix = 'lime_'; // A global prefix that can be added to all LimeSurvey tables. Use this if you are sharing
// a database with other applications. Suggested prefix is 'lime_'

Any help would be much appreciated. Note that the database and the user are both named 'limesurveytest'

The instance of SQL on volante is unamed.

I've tried every combination I can think of for the config and everything produces the same error.



Please Log in to join the conversation.

6 years 3 months ago #51270 by Scotbot
The issue here is that $databasetype should be set to MSSQL if the system is required to connect to an MSSQL server without using ODBC. This option isn't listed in the explanatory test within the config.php file and this is what threw me.

Hope this helps someone else in future.


Please Log in to join the conversation.

Imprint                   Privacy policy         General Terms & Conditions         Revocation information and revocation form