Hi thanks for looking! I have a custom module that uses an additional database and I have recently attempted to upgrade it from D5 to D6 using Deadwood.

Deadwood worked ok, and now the module at least loads, but it has a database error. I have carefully defined the database in my settings.php file:

$db_url['default'] = 'mysqli://user1:pass1@localhost/drupal6';
$db_url['antidegrad'] = 'mysqli://user2:pass2@localhost/antidegrad';

In my module several times I switch back between the default and the antidegrad database like so:

db_set_active($name = 'antidegrad');
db_set_active($name = 'default'); 

However, the module doesn't seem to be able to access the additional database, and furthermore claims that I am trying to access the database with user "apache" and NO password, which I am not trying to do.

Error:

warning: mysql_query() [function.mysql-query]: Access denied for user 'apache'@'localhost' (using password: NO) in /var/www/drupal/sites/all/modules/antidegradation/antidegradation.module on line 355.
warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /var/www/drupal/sites/all/modules/antidegradation/antidegradation.module on line 355.
warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource in /var/www/drupal/sites/all/modules/antidegradation/antidegradation.module on line 357.

There must be some kind of simple configuration error, can you help me debug this? Thanks!

Comments

stoob’s picture

Deadwood did not change instances of mysql_query and mysql_fetch_array in my D5 module to db_query and db_fetch_array which are D6 requirements. As a result none of my queries were working.

I made the change manually and now it works fine.

Deadwood also made a couple of other errors by replacing text inside of queries, causing the queries to be nonfunctional.

I fixed these and now it works.