Trouble connecting to MS SQL Server 2000 |
[eluser]HDuqueC[/eluser]
Hi to all, I'm doing something wrong but I can't realize what it is!. I have a simple PHP script like this, that runs fine: <?php $myServer = "mysrvr"; $myUser = "myuser"; $myPass = "mypass"; $myDB = "mydatabase"; $conn = new COM ("ADODB.Connection") or die("Cannot start ADO"); $connStr = "PROVIDER=SQLOLEDB;SERVER=".$myServer.";UID=".$myUser.";PWD=".$myPass.";DATABASE=".$myDB; $conn->open($connStr); ...etc...etc... ?> I'm trying to connect using CI but always fails: In my database.php : $db['default']['hostname'] = "mysrvr"; $db['default']['username'] = "myuser"; $db['default']['password'] = "mypass"; $db['default']['database'] = "mydatabase"; $db['default']['dbdriver'] = "mssql"; $db['default']['dbprefix'] = ""; $db['default']['pconnect'] = TRUE; $db['default']['db_debug'] = TRUE; $db['default']['cache_on'] = FALSE; $db['default']['cachedir'] = ""; $db['default']['char_set'] = "utf8"; $db['default']['dbcollat'] = "utf8_general_ci"; But in my controller the line $this->load->database(); Raises connection fails. What am I doing wrong? Any help will be appreciated. Nando.
[eluser]cwt137[/eluser]
Codeigniter uses the mssql extension. Make sure you have the mssql PHP extension installed. You can check this by looking at the output of phpinfo().
[eluser]HDuqueC[/eluser]
Thank you for your post. [quote author="cwt137" date="1241208412"]Codeigniter uses the mssql extension. Make sure you have the mssql PHP extension installed. You can check this by looking at the output of phpinfo().[/quote] Runing phpinfo() I found mssql running with theese parameters: Library version : 7.0 mssql.allow_persistent: On mssql.batchsize: 0 mssql.compatability_mode: Off mssql.connect_timeout: 5 mssql.datetimeconvert: On mssql.max_links: Unlimited mssql.max_persistent: Unlimited mssql.max_procs: Unlimited mssql.min_error_severity: 10 mssql.min_message_severity: 10 mssql.secure_connection: Off mssql.textlimit: Server default mssql.textsize: Server default mssql.timeout: 60 Maybe should I change any parameter?
[eluser]cwt137[/eluser]
The default settings should be ok. How about creating a simple script like this one, http://us.php.net/manual/en/function.mssql-query.php , to see if the mssql module works. If it works, then you know it is something wrong with the way you setup CI. Also, for the server name, use a real host name or the IP address of the database server.
[eluser]HDuqueC[/eluser]
Thank you for your help. I already solved the question and I'll like to share this link http://www.akamarketing.com/blog/99-php-...erver.html with anyone who read this thread. Nando. |
Welcome Guest, Not a member yet? Register Sign In |