• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Codeignter querying mssql through odbc

#1
[eluser]flaky[/eluser]
Hi guys. I'm having this little issue

I'm connecting to mssql using odbc.
Code:
$db['default']['hostname'] = "Driver={SQL Server Native Client 10.0};Server=FLAKRON-PC\SQL2008;Database=test;";
$db['default']['username'] = "sa";
$db['default']['password'] = "sa";
$db['default']['database'] = "test";
$db['default']['dbdriver'] = "odbc";
$db['default']['dbprefix'] = "";
$db['default']['pconnect'] = FALSE;
$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = "";
$db['default']['char_set'] = "utf8";
$db['default']['dbcollat'] = "utf8_general_ci";

it's connecting without problems. The issue is when I query a table e.g tbl_user.
Active record is querying it with this sql
Code:
SELECT * FROM (tbl_user)
which is wrong, the sql syntax will fail, how can I remove the brackets around the table name?

cheers

#2
[eluser]kikz4life[/eluser]
hi there flaky,

i too is trying to connect my ci app to ms sql but with no luck. What server are you using? Im using xampp 1.7.1 and enabled the php-mssql in php.ini but still i cant connect to MS SQL 2005. May i know your set up?

thanks

#3
[eluser]flaky[/eluser]
I'm using xampp 1.7.3.
The only setup I've done is in the database.php same as in my last post.

#4
[eluser]flaky[/eluser]
I solved it
Enabled mssql extension in php.ini
and changed the database.php to this

Code:
$db['default']['hostname'] = "FLAKRON-PC\\SQL2008";
$db['default']['username'] = "sa";
$db['default']['password'] = "sa";
$db['default']['database'] = "test";
$db['default']['dbdriver'] = "mssql";
$db['default']['dbprefix'] = "";
$db['default']['pconnect'] = FALSE;
$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = "";
$db['default']['char_set'] = "utf8";
$db['default']['dbcollat'] = "utf8_general_ci";

#5
[eluser]kikz4life[/eluser]
nice, so your using MS SQL 2008? hmm.. i'll try upgrade my server to 1.7.3. Wish it will work though. What OS are you using?

Thanks

#6
[eluser]flaky[/eluser]
Windows 7 Ultimate

#7
[eluser]kikz4life[/eluser]
gudevening flaky.

we have both same set up except im using xampp 1.7.1. And using this version of xampp i cant connect to ms sql. But if i used xampp 1.7.2 and 1.7.3 i can connect to my ms sql 2008. The only problem is if i used either of the two version my CI application crash.,

Code:
A PHP Error was encountered

Severity: 8192
Message: Assigning the return value of new by reference is deprecated
Filename: libraries/Loader.php
Line Number: 414
and this

Code:
A PHP Error was encountered

Severity: Warning
Message: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\comunionasdad\system\application\libraries\Loader.php:414)
Filename: codeigniter/Common.php
Line Number: 360


Hmm., have you ever tried using xampp 1.7.1 and successfully connect to ms sql 2008?

I badly need help here.

#8
[eluser]flaky[/eluser]
Which version of codeigniter are you using?

#9
[eluser]kikz4life[/eluser]
im using CI 1.7.2.

#10
[eluser]flaky[/eluser]
can you send a sample of the controller where is this happening


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2017 MyBB Group.