• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Can't select database after calling stored procedure.

#1
[eluser]browntown[/eluser]
I have recently stumbled onto an issue with stored procedures in CodeIgniter. I've used stored procedures with CodeIgniter projects before...never had a problem...until now.

I am able to call a stored procedure once...then I get an error stating:

Code:
A Database Error Occurred

Unable to select the specified database: databasename

Filename: C:\Apache2.2\htdocs\databasename\bonfire\codeigniter\database\DB_driver.php

Line Number: 140

Once this happens I have to restart Apache before I can hit the site again.

I'm using the mysqli driver and a persistent database connection.

I'm calling the stored procedure from the following code in my model:

Code:
$this->db->reconnect();
  $sql = "call getProgram($id)";
  $query = $this->db->query($sql);
  $result = $query->result_array();
  
  
  return $result[0];

Does anyone have any ideas? Thanks.

#2
[eluser]browntown[/eluser]
Two things: 1) I'm an idiot 2) I really needed to get some sleep.

Once I had time to sleep, shower, and eat breakfast I realized what my issue was. My app is using CI Bonfire. CI Bonfire puts the database config in a "development" sub directory when you're developing your app. I had changed the wrong database config to use the mysqli driver. I updated the correct config file and everything is working fine.



Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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