1
Janks
Unable to connect to database in file class/database/databasefactory.php line 34
  • 2005/3/21 16:10

  • Janks

  • Just popping in

  • Posts: 2

  • Since: 2005/1/27


I hope I didn't do something very badly....

I wanted to install XOOPS on a sudomain (already got it installed and working on another domain).

When I installed the new Xoops, my old site gave this error:

Quote:
This page cannot be displayed due to an internal error.

If you are the administrator of this site, please visit the XOOPS Troubleshooting Page for assistance.

Error [Xoops]: Unable to connect to database in file class/database/databasefactory.php line 34


This is the Script its about:

Quote:
class XoopsDatabaseFactory
{

function XoopsDatabaseFactory()
{
}

/**
* Get a reference to the only instance of database class and connects to DB
*
* if the class has not been instantiated yet, this will also take
* care of that
*
* @static
* @staticvar object The only instance of database class
* @return object Reference to the only instance of database class
*/
function &getDatabaseConnection()
{
static $instance;
if (!isset($instance)) {
$file = XOOPS_ROOT_PATH.'/class/database/'.XOOPS_DB_TYPE.'database.php';
require_once $file;
if (!defined('XOOPS_DB_PROXY')) {
$class = 'Xoops'.ucfirst(XOOPS_DB_TYPE).'DatabaseSafe';
} else {
$class = 'Xoops'.ucfirst(XOOPS_DB_TYPE).'DatabaseProxy';
}
$instance =& new $class();
$instance->setLogger(XoopsLogger::instance());
$instance->setPrefix(XOOPS_DB_PREFIX);
if (!$instance->connect()) {
trigger_error("Unable to connect to database", E_USER_ERROR);
}
}
return $instance;
}

/**
* Gets a reference to the only instance of database class. Currently
* only being used within the installer.
*
* @static
* @staticvar object The only instance of database class
* @return object Reference to the only instance of database class
*/
function &getDatabase()
{
static $database;
if (!isset($database)) {
$file = XOOPS_ROOT_PATH.'/class/database/'.XOOPS_DB_TYPE.'database.php';
require_once $file;
if (!defined('XOOPS_DB_PROXY')) {
$class = 'Xoops'.ucfirst(XOOPS_DB_TYPE).'DatabaseSafe';
} else {
$class = 'Xoops'.ucfirst(XOOPS_DB_TYPE).'DatabaseProxy';
}
$database =& new $class();
}
return $database;
}


}
?>


I thought there could be a conflict with these two systems (though they were both installed on different domains on the same server) So I de-installed the newest XOOPS version, but still got this bug in the oldest one.

Now I am not a real smart one whith bugs like this. Ok, maybe a really dumbass...

Could anyone please help me?

2
Mithrandir
Re: Unable to connect to database in file class/database/databasefactory.php line 34


3
flukles
Re: Unable to connect to database in file class/database/databasefactory.php line 34
  • 2005/3/29 1:36

  • flukles

  • Just popping in

  • Posts: 2

  • Since: 2005/3/29


Hello. I am experiencing a similar problem. I tired to install another XOOPS on a subdomain. I believe I am receiving this error because my host accidentally changed the password to the database, and now XOOPS cannot connect. I am just starting to learn XOOPS and php, so I would appreciate if someone could give me an easy to follow answer.

I would like to know if there is any way to tell update the password in the XOOPS configurations files, so that it can reconnect to the database?

Thanks

P.S. I looked through the FAQ's and other forums, but I couldn't seem to find an answer so that's why I'm posting here.

4
m0nty
Re: Unable to connect to database in file class/database/databasefactory.php line 34
  • 2005/3/29 1:46

  • m0nty

  • XOOPS is my life!

  • Posts: 3337

  • Since: 2003/10/24


mainfile.php contains all your db info.. check in there to see if the info is correct..

5
flukles
Re: Unable to connect to database in file class/database/databasefactory.php line 34
  • 2005/3/29 5:10

  • flukles

  • Just popping in

  • Posts: 2

  • Since: 2005/3/29


Quote:

m0nty wrote:
mainfile.php contains all your db info.. check in there to see if the info is correct..


Sweet.. All fixed. Thanks for your input.

6
tjesch
Re: Unable to connect to database in file class/database/databasefactory.php line 34
  • 2005/5/8 0:59

  • tjesch

  • Just popping in

  • Posts: 1

  • Since: 2004/12/18


I accidentally removed two databases from MySQL eg. MySQL and test. By recovering (remove/reinstall mysql-server) the two databases were back and the connection to the XOOPS database was restored.

Login

Who's Online

278 user(s) are online (137 user(s) are browsing Support Forums)


Members: 0


Guests: 278


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits