Yii Framework Forum: Yii and MS-SQL - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Yii and MS-SQL Rate Topic: -----

#1 User is offline   scheelga 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 06-September 10

Posted 10 September 2010 - 10:11 AM

Hello All,

I Am using Yii 1.1.4 and trying to connect to a MS SQL 2000 server. This is supposedly a supported DB server which is what first brought me to try yii. Most frameworks don't support SQL Server 2000 because it is so old, but it is nevertheless what I am stuck working with for the time being.

I am using yii on Gentoo linux and working through the Agile Development with Yii book. It connects to the local MySQL server just fine and I can connect to the MS-SQL with a regular PHP script using mssql_connect(). I have searched these forums and not found anything that solves my issue.

My db array from protected/config/main.php looks like:

'db'=>array(
#'connectionString' => 'mysql:host=localhost;dbname=trackstar_dev',
'connectionString' => 'mssql:host=10.166.250.3;port=1433;dbname=RMA',
'emulatePrepare' => true,
'username' => 'MyLogin',
'password' => 'MyPassword',
'charset' => 'utf8',
),

Including the commented out MySQL connection string which works. I have tried using both the IP and the hostname of the server, either work with mssql_connect(), but no luck so far. When I try to run the unit test I get:


[glen@alhazred tests]$ phpunit unit/DbTest.php
PHPUnit 3.4.15 by Sebastian Bergmann.

E

Time: 1 second, Memory: 5.25Mb

There was 1 error:

1) DbTest::testConnection
CDbException: CDbConnection failed to open the DB connection.

/var/www/localhost/htdocs/yii/framework/db/CDbConnection.php:275
/var/www/localhost/htdocs/yii/framework/db/CDbConnection.php:242
/var/www/localhost/htdocs/yii/framework/db/CDbConnection.php:221
/var/www/localhost/htdocs/yii/framework/base/CModule.php:363
/var/www/localhost/htdocs/yii/framework/base/CModule.php:86
/var/www/localhost/htdocs/trackstar/protected/tests/unit/DbTest.php:6

FAILURES!
Tests: 1, Assertions: 0, Errors: 1.


Anyone have any ideas?

Thanks in advance. I apologize if this was covered elsewhere.

Glen
0

#2 User is offline   scheelga 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 06-September 10

Posted 10 September 2010 - 10:21 AM

My PHP configuration is:

'./configure' '--prefix=/usr' '--build=i686-pc-linux-gnu' '--host=i686-pc-linux-gnu' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--datadir=/usr/share' '--sysconfdir=/etc' '--localstatedir=/var/lib' '--prefix=/usr/lib/php5' '--mandir=/usr/lib/php5/man' '--infodir=/usr/lib/php5/info' '--libdir=/usr/lib/php5/lib' '--with-libdir=lib' '--without-pear' '--disable-maintainer-zts' '--disable-bcmath' '--with-bz2' '--disable-calendar' '--without-curl' '--without-curlwrappers' '--disable-dbase' '--disable-exif' '--without-fbsql' '--without-fdftk' '--enable-ftp' '--with-gettext' '--without-gmp' '--without-kerberos' '--enable-mbstring' '--with-mcrypt' '--without-mhash' '--without-msql' '--with-mssql' '--with-ncurses' '--with-openssl' '--with-openssl-dir=/usr' '--disable-pcntl' '--with-pgsql' '--without-pspell' '--without-recode' '--disable-shmop' '--without-snmp' '--enable-soap' '--disable-sockets' '--without-sybase-ct' '--disable-sysvmsg' '--disable-sysvsem' '--disable-sysvshm' '--without-tidy' '--disable-wddx' '--without-xmlrpc' '--without-xsl' '--enable-zip' '--with-zlib' '--disable-debug' '--enable-dba' '--without-cdb' '--with-db4' '--disable-flatfile' '--without-gdbm' '--disable-inifile' '--with-qdbm' '--with-freetype-dir=/usr' '--with-t1lib=/usr' '--disable-gd-jis-conv' '--with-jpeg-dir=/usr' '--with-png-dir=/usr' '--without-xpm-dir' '--with-gd' '--without-interbase' '--with-mysql=/usr' '--with-mysql-sock=/var/run/mysqld/mysqld.sock' '--with-mysqli=/usr/bin/mysql_config' '--with-unixODBC=/usr' '--without-adabas' '--without-birdstep' '--without-dbmaker' '--without-empress' '--without-esoob' '--without-ibm-db2' '--without-sapdb' '--without-solid' '--with-iodbc=/usr' '--without-oci8' '--with-pdo-dblib' '--with-pdo-mysql=/usr' '--with-pdo-pgsql' '--with-pdo-sqlite=/usr' '--with-pdo-odbc=unixODBC,/usr' '--with-readline' '--without-libedit' '--without-mm' '--with-sqlite=/usr' '--enable-sqlite-utf8' '--with-pcre-regex=/usr' '--with-pcre-dir=/usr' '--with-config-file-path=/etc/php/apache2-php5' '--with-config-file-scan-dir=/etc/php/apache2-php5/ext-active' '--disable-cli' '--disable-cgi' '--disable-embed' '--with-apxs2=/usr/sbin/apxs'
0

#3 User is offline   Klim 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 02-November 10

Posted 02 November 2010 - 02:59 AM

Look for PDO section in phpinfo() results. You need pdo_mssql module to be enabled in php.ini to use mssql in Yii.

Also read this http://www.yiiframew...dblib#entry4438
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users