我试图连接到使用笨的SQL服务器。如果我使用SQLSRV驱动程序 - 我得到一个致命的错误消息,如果我使用ODBC驱动程序 - 我得到一个“无法使用所提供的设定错误的信息连接到数据库服务器。有谁知道如何解决这个问题???我不介意怎么样,我只想笨连接到SQL Server数据库。
这是数据库配置文件
$db['otherdb']['hostname'] = '195.234.10.55\SQLEXPRESS';
$db['otherdb']['username'] = 'username';
$db['otherdb']['password'] = 'password';
$db['otherdb']['database'] = 'ONEDB';
$db['otherdb']['dbdriver'] = 'odbc'; // Done this in both ODBC and SQLSRV
$db['otherdb']['dbprefix'] = '';
$db['otherdb']['pconnect'] = TRUE;
$db['otherdb']['db_debug'] = TRUE;
$db['otherdb']['cache_on'] = FALSE;
$db['otherdb']['cachedir'] = '';
$db['otherdb']['char_set'] = 'utf8';
$db['otherdb']['dbcollat'] = 'utf8_general_ci';
$db['otherdb']['swap_pre'] = '';
$db['otherdb']['autoinit'] = TRUE;
$db['otherdb']['stricton'] = FALSE;
谢谢
(不要吝啬复活旧的文章,但以防万一别人都在寻找答案,因为这个帖子我的搜索过程中想出了...)
短一步一步的指导,使用本机驱动程序从笨3连接到SQL_SERVER:
extension = php_sqlsrv_55_ts.dll
<?php
// native-driver connection
$db['default'] = array(
'dsn' => '',
'hostname' => 'SERVER\SQLEXPRESS',
'username' => 'test_user',
'password' => 'test_password',
'database' => 'test01',
'dbdriver' => 'sqlsrv',
'dbprefix' => '',
'pconnect' => FALSE,
'db_debug' => TRUE,
'cache_on' => FALSE,
'cachedir' => 'application/cache',
'char_set' => 'utf8',
'dbcollat' => 'utf8_general_ci',
'swap_pre' => '',
'autoinit' => TRUE,
'encrypt' => FALSE,
'compress' => FALSE,
'stricton' => FALSE,
'failover' => array(),
'save_queries' => TRUE
);
从笨3.0.1上SQL_SERVER 2008 R2和SQL_SERVER 2014次特快测试。