MySQL Forums
Forum List  »  PHP

Not able to select database
Posted by: shaily goel
Date: May 03, 2011 10:51PM

Hi,

i am facing a error but i am not able to know the exact cause of it.
I have developed a web application using WAMP environment which is currently used by more then 1000 people. It works perfectly fine, but there are times, when we see application crashed resulting in in error: “unable to select specified database :database name”. We are unable to understand why this error is thrown by application sometimes.
We are using following technologies
1. Codeignitor - persistent connection
2. PHP
3. mysql
4. Windows server
In order to work-around with this issue for time being: I have modified the DB_driver.php in database folder .For that i have commented that area(marked in red)and there i have written connection string then it is working fine.
I have done something like this:-
// Select the DB… assuming a database name is specified in the config file
if ($this->database != ‘’)
{
if ( ! $this->db_select())
{
log_message(‘error’, ‘Unable to select database: ‘.$this->database);
/*if ($this->db_debug)
{
$this->display_error(‘db_unable_to_select’, $this->database);
}
*/
$conn=mysql_connect(“localhost”,“root”,”“) or die(“unable to connect localhost”.mysql_error());
$this->conn_id = $conn;
$db=mysql_select_db(“egoalsheet”,$conn) or die(“unable to select egoalsheet”);
return TRUE;
}
We have already probed into the fact of too many connections , sleep connections in mysql and hence restarted WAMP last nite. The server was up and running for say 3 hours and then again application went down with the same error midnight.
Please let us know the probable root cause of this issue which happens occassionaly. This is the critical and major issue and we are unable to debug it. Few things which we are doing right now, is setting the persistent connection property in codeignitor to False. But we are not sure, if persistent connection is major culprit out or something else.
Let us know your advice on how to go about on solving the above issue

Options: ReplyQuote


Subject
Written By
Posted
Not able to select database
May 03, 2011 10:51PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.