2009年4月14日星期二

Re: [fw-db] MsSQL connection via DBLIB driver

On Tue, Apr 14, 2009 at 12:24 PM, nee00nee <kolbasoid@mail.ru> wrote:
> Hi! The case is under os x and zend framework. I've got quiete a trouble
> here. define('APPLICATION_PATH', realpath(dirname(__FILE__) .
> '/../application/')); set_include_path(APPLICATION_PATH . '/../library' .
> PATH_SEPARATOR . get_include_path()); require_once "Zend/Loader.php";
> Zend_Loader::registerAutoload(); try { $config = array( 'host' =>
> '192.168.0.1', 'username' => 'one', 'password' => '123', 'dbname' => 'one',
> 'pdoType' => 'dblib' ); //one part not working $db =
> Zend_Db::factory('Pdo_Mssql', $config)->getConnection(); $q =
> $db->fetchAll('SELECT @@VERSION'); print_r($q); //working part $server =
> '192.168.0.1'; $link = mssql_connect($server, 'one', '123');
> if(!$link){die('Something went wrong while connecting to MSSQL');}
> mssql_select_db('one',$link); mssql_query('SET QUOTED_IDENTIFIER ON'); $q =
> mssql_query('SELECT @@VERSION'); while($row = mssql_fetch_array($q)){
> print_r($row); } } catch (Zend_Db_Adapter_Exception $e){
> die($e->getMessage()); } First part while connecting via factory i get "The
> dblib driver is not currently installed" but usual connection via mssql
> works fine Tried pdoType = sybase, dblib, fretds, mssql Any ideas? By the
> way - all including roots are all right.

PDO is not mssql. You need pdo_mssql. Make a phpinfo() and double
check which PDO drivers are loaded. I'm guessing dblib is not one of
them.

Till

没有评论: