• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

#1
[eluser]Unknown[/eluser]
Hi all.

I am using CI 2.1.1 under Windows 2k3 IIS 6.0, PHP 5.2.1, SQL Server 10.50.

Here is my connection string config:
Code:
$db['sqlserver']['hostname'] = 'Driver={SQL Server Native Client 10.0};Server=192.168.10.160;Database=<DB>;MultipleActiveResultSets=true;';
$db['sqlserver_160']['username'] = 'sa';
$db['sqlserver_160']['password'] = <pwd>;
$db['sqlserver_160']['database'] = <DB>;
$db['sqlserver_160']['dbdriver'] = 'odbc';
$db['sqlserver_160']['dbprefix'] = '';
$db['sqlserver_160']['pconnect'] = FALSE;
$db['sqlserver_160']['db_debug'] = TRUE;
$db['sqlserver_160']['cache_on'] = FALSE;
$db['sqlserver_160']['cachedir'] = '';
$db['sqlserver_160']['char_set'] = 'utf8';
$db['sqlserver_160']['dbcollat'] = 'utf8_unicode_ci';
$db['sqlserver_160']['swap_pre'] = '';
$db['sqlserver_160']['autoinit'] = TRUE;
$db['sqlserver_160']['stricton'] = FALSE;

I am using this config locally (localhost) and it connects to the SQL Server successfully.

When I deploy it to another test server, which is the 2K3 server I mentioned above, using the same connection config, I got this error:

Code:
[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

This 2K3 server has ODBC enabled, I can see it in phpinfo().

In PHP.ini (2K3 server), I have this enabled: extension=php_pdo_odbc.dll

If I login to 2k3 server and ping the SQL Server, it responses correctly.

But I still cannot access the server, can anyone please give some advice on that?

Thank you.

#2
[eluser]Unknown[/eluser]
I solve this problem myself.

If I change 'hostname' from:

Code:
$db['sqlserver']['hostname'] = 'Driver={SQL Server Native Client 10.0};Server=192.168.10.160;Database=<DB>;MultipleActiveResultSets=true;';

to

Code:
$db['sqlserver']['hostname'] = 'Driver={SQL Server};Server=192.168.10.160;Database=<DB>;MultipleActiveResultSets=true;';

It works again.

Very weird. For reference to those who are struggling in this problem.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.