Welcome Guest, Not a member yet? Register   Sign In
ODBC Connection being extremely slow


I'm looking to use ODBC in order to connect to an MSSQL database, however, just including the 'database' library in the autoload.php file is causing issues. Pages are therefore taking ages to load which is a serious problem, i'm having to wait 10-20 seconds.

Now, I am not running any queries at this time, it's clearly just the connection. Therefore I was wandering if their was a problem with my database connection settings. Let me show you them:

PHP Code:
$active_group 'default';
$query_builder TRUE;

$db['default'] = array(
'dsn'    => '',
'hostname' => 'Driver={SQL Server};Server=MATTHEW;Database=db1;',
'username' => 'root',
'password' => 'root',
'database' => 'db1',
'dbdriver' => 'odbc',
'dbprefix' => '',
'pconnect' => FALSE,
'db_debug' => TRUE,
'cache_on' => FALSE,
'cachedir' => '',
'char_set' => 'utf8',
'dbcollat' => 'utf8_general_ci',
'swap_pre' => '',
'encrypt' => FALSE,
'compress' => FALSE,
'stricton' => FALSE,
'failover' => array(),
'save_queries' => TRUE

Is there a problem with what I'm doing? Is ODBC just slow with Codeigniter?

I've tried the same connection settings outside of Codeigniter and it runs smoothly but I would like my project to use Codeigniter so any help would be appreciated.

If possible, you may want to use the SQLSRV driver instead. http://php.net/manual/en/intro.sqlsrv.php

However, when you say you used the same connection settings outside of CodeIgniter, does that mean you've setup a simple PHP script to run
$connection = odbc_connect('Driver={SQL Server};Server=MATTHEW;Database=db1;', 'root', 'root');
and check the result?

Theme © iAndrew 2016 - Forum software by © MyBB