• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
SOLVED: MSSQL odbc problem

#1
Hi

Trying to use CodeIgniter with odbc to a old MSSQL server.

When fetching the results some of the fields are truncated.

Ex. ["Frame9Val"]=> string(3) "13" --- should show 135
Ex. ["Frame1BVal"]=> string(3) "2�" --- should show 255

Any idea why this is happening?  Huh
It's working when using plain PDO outside CI

\B
Reply

#2
Looks like a charset problem? have you checked the database config (char_set, dbcollat)?

Reply

#3
(11-20-2014, 01:54 PM)Rufnex Wrote: Looks like a charset problem? have you checked the database config (char_set, dbcollat)?

Yes, tried different settings without any luck.
Reply

#4
Are you on windows or a unix server?

P.S. Your PM are off ^^.

Reply

#5
(11-20-2014, 03:27 PM)Rufnex Wrote: Are you on windows or a unix server?

CentOS linux using FreeTDS and unixODBC
Reply

#6
I use CI3 with the following settings and with FreeTDS without any problems:

PHP Code:
$db['default'] = array(
    
'dsn'    => '',
    
'hostname' => 'ip_or_name',
    
'username' => 'user',
    
'password' => 'password',
    
'database' => '',
    
'dbdriver' => 'mssql',
    
'dbprefix' => '',
    
'pconnect' => TRUE,
    
'db_debug' => TRUE,
    
'cache_on' => TRUE,
    
'cachedir' => 'application/cache',
    
'char_set' => 'utf8',
    
'dbcollat' => 'utf8_general_ci',
    
'swap_pre' => '',
    
'autoinit' => TRUE,
    
'encrypt' => FALSE,
    
'compress' => FALSE,
    
'stricton' => FALSE,
    
'failover' => array(),
    
'save_queries' => TRUE
); 

Reply

#7
Smile 
Thank you so much! This was the fix I needed

(11-21-2014, 04:57 AM)Rufnex Wrote: I use CI3 with the following settings and with FreeTDS without any problems:


PHP Code:
$db['default'] = array(
 
'dsn' => '',
 
'hostname' => 'ip_or_name',
 
'username' => 'user',
 
'password' => 'password',
 
'database' => '',
 
'dbdriver' => 'mssql',
 
'dbprefix' => '',
 
'pconnect' => TRUE,
 
'db_debug' => TRUE,
 
'cache_on' => TRUE,
 
'cachedir' => 'application/cache',
 
'char_set' => 'utf8',
 
'dbcollat' => 'utf8_general_ci',
 
'swap_pre' => '',
 
'autoinit' => TRUE,
 
'encrypt' => FALSE,
 
'compress' => FALSE,
 
'stricton' => FALSE,
 
'failover' => array(),
 
'save_queries' => TRUE
); 
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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