Welcome Guest, Not a member yet? Register   Sign In
Profiler - Database driver is not currently loaded

I have an application that is accessing two databases. I am loading the database within the model (no "default" database set in database.php). I am running a query and getting no errors but I am also getting no results (query in SQL Server Management Studio works fine). I profiled it and I am getting "Database driver is not currently loaded" for the queries.

First the code for the model method:

function getVendors(){
  $db = $this->load->database('barcode', true);
     "  FROM barcode.LOG_COMP_INVENTORY" .
  $query = $db->query($lcSQL);
  echo "<hr><br><br>";
  echo "<hr><br><br>";
  $return_array = $query->row_array();

Now, the var_dump for $db shows an object with the database parameters. I am *assuming* that everything is fine (i.e., it is connecting OK) because I get no errors.

My query also shows an object but the rows property is NULL so $return_array is also null.

This is CI 2.1.0

Any thoughts?

Just a few more thoughts on this:

1) Since this is SQL Server, I think I should show you the config so here it is:

$db['barcode']['hostname'] = 'DATASERV';
$db['barcode']['username'] = 'sa';
$db['barcode']['password'] = '**********';
$db['barcode']['database'] = 'BARCODE';
$db['barcode']['dbdriver'] = 'sqlsrv';
$db['barcode']['dbprefix'] = '';
$db['barcode']['pconnect'] = FALSE;
$db['barcode']['db_debug'] = TRUE;
$db['barcode']['cache_on'] = FALSE;
$db['barcode']['cachedir'] = '';
$db['barcode']['char_set'] = 'utf8';
$db['barcode']['dbcollat'] = 'utf8_general_ci';
$db['barcode']['swap_pre'] = '';
$db['barcode']['autoinit'] = TRUE;
$db['barcode']['stricton'] = FALSE;

2) On a hunch, I loaded the database class in the autoload (which loads the OTHER database, this database is for reference only). The name of the otherdatabase is INVENTORY. Now, when I run the query, it tells me that there are zero queries were queried against the INVENTORY database (this is SQL Server too).

So, I changed the default database ($active_group) to barcode and ran the query through $this->db. The query now shows up in the profiler but I STILL have no results...

As before, any suggestions welcome...

Theme © iAndrew 2016 - Forum software by © MyBB