phpcodeigniterodbccodeigniter-3sqlanywhere

Connect codeigniter 3 by ODBC to SQL anywhere


I want to connect to a SQL database anywhere through an odbc but it marks me this error

A PHP Error was encountered

Severity: Warning

Message: odbc_connect(): SQL error: [Microsoft] [ODBC Driver Manager] The architecture of the specified DSN does not match between the driver and the application., SQL IM014 status in SQLConnect

I have my configuration as follows

$active_group = 'default';
$query_builder = TRUE;

$db['default'] = array(
  'dsn'    => 'mydsn',  
  'hostname' => 'localhost',
  'username' => 'myusername',
  'password' => 'mypassword',
  'database' => '',
  'dbdriver' => 'odbc',
  'dbprefix' => '',
  'pconnect' => FALSE,
  'db_debug' => (ENVIRONMENT !== 'production'),
  'cache_on' => FALSE,
  'cachedir' => '',
  'char_set' => 'utf8',
  'dbcollat' => 'utf8_general_ci',
  'swap_pre' => '',
  'encrypt' => FALSE,
  'compress' => FALSE,
  'stricton' => FALSE,
  'failover' => array(),
  'save_queries' => TRUE
);

I have a 32 bit obdc installed and reading I found that it is possible that the driver is pointing to a 64 bits library I do not know if someone knows more about this and can help me


Solution

  • Check that your PHP architecture is the same than your ODBC connection, example if your ODBC is x64, your PHP should use x64 (PHP 7) by the other hand, if your ODBC is x86 you should use PHP 5.6.