Yii Framework Forum: MSSQL on IIS connection problem - Yii Framework Forum

Jump to content

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

MSSQL on IIS connection problem Rate Topic: -----

#1 User is offline   lorcan 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 7
  • Joined: 12-May 10

Posted 13 May 2010 - 04:03 AM

I use IIS bacause of many problems I had with apache and mssql express 2008

I use mssql.dll and sqlsrv.dll drivers
>> model cities
exception 'CDbException' with message 'CDbConnection failed to open the DB connection: could not find driver' in C:\Inetpub\wwwroot\yii-1.1.2\framework\db\CDbConnection.php:267

Have trouble enabling pdo_mssql.dll and probably it's lack generates this error

My main.php
'connectionString' => 'mssql:host=TEST-KOMP\SQLEXPRESS;dbname=mgr',
// or
//'connectionString' => 'sqlsrv:host=TEST-KOMP\SQLEXPRESS;dbname=mgr',
'emulatePrepare' => true,
'username' => 'sa',
'password' => '********',
'charset' => 'utf8',

What can I do?
0

#2 User is offline   soeperees 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 10
  • Joined: 26-October 09
  • Location:The Hague, The Netherlands

Posted 13 May 2010 - 04:36 AM

Are you able to connect with a plain php script?

mssql_connect('localhost,54320', 'user', 'pass')
				or die("Couldn't connect to SQL Server on localhost");


Because I've had a lot of trouble connecting to mssql because of a bad mssql.dll
0

#3 User is offline   lorcan 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 7
  • Joined: 12-May 10

Posted 13 May 2010 - 04:41 AM

mssql_connect('TEST-KOMP\SQLEXPRESS', 'sa', '********')

does the trick...
0

#4 User is offline   lorcan 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 7
  • Joined: 12-May 10

Posted 13 May 2010 - 04:53 AM

@soeperees

do you have pdo_mssql enabled in your phpinfo()?

if you do, could you mail me the dll?

(the ones I've found on the net did not work, that is why I tried the sqlsrv.dll)
0

#5 User is offline   lorcan 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 7
  • Joined: 12-May 10

Posted 14 May 2010 - 04:09 AM

still not working...
main.php
		'db'=>array(
			'class'=>'CDbConnection',
			'connectionString' => 'mssql:host=TEST-KOMP\SQLEXPRESS;dbname=mgr',
			//'emulatePrepare' => true,
			'username' => 'sa',
			'password' => '********',
			//'charset' => 'utf8',
		),

Error
>> model cities
exception 'CDbException' with message 'CDbConnection failed to open the DB connection: could not find driver' in C:\Inetpub\wwwroot\yii-1.1.2\framework\db\CDbConnection.php:267

line 267
	protected function open()
	{
		if($this->_pdo===null)
		{
			if(empty($this->connectionString))
				throw new CDbException(Yii::t('yii','CDbConnection.connectionString cannot be empty.'));
			try
			{
				Yii::trace('Opening DB connection','system.db.CDbConnection');
				$this->_pdo=$this->createPdoInstance();
				$this->initConnection($this->_pdo);
				$this->_active=true;
			}
			catch(PDOException $e)
			{
                                // line 267 //
				throw new CDbException(Yii::t('yii','CDbConnection failed to open the DB connection: {error}',
					array('{error}'=>$e->getMessage())));
			}
		}
	}

have mssql.dll and sqlsrv.dll drivers working
mssql_connect('TEST-KOMP\SQLEXPRESS', 'sa', '********')

Connects...

if anyone has time, idea what might be wrong, pleas let me know ;)
0

#6 User is offline   ItsYii 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 119
  • Joined: 24-January 12

Posted 10 March 2013 - 09:59 AM

I have the exact same problem, did you or anyone else find a solution.

I have been searching for 2 days now.
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