Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7914929
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T14:17:09+00:00 2026-06-03T14:17:09+00:00

I am in the process of doing a data migration from OpenCart into Drupal

  • 0

I am in the process of doing a data migration from OpenCart into Drupal 7. I have my primary database which is setup specifically for Drupal 7. Drupal is installed. I have created a secondary database on the same server which is a copy of the OpenCart database that I will be migrating from.

I did this because there are a lot of overlapping tables and honestly I didn’t really want to merge the two databases together since I will be dumping the OpenCart one just as soon as the products and related info is migrated over.

Anyway, I am finding that even though Drupal 7 easily supports this it seems to crap out the second you try to execute any queries on the secondary DB. By crap out I mean “white screen of death” crap out. If I enable the db query logging of the devel module then it outputs a few unformatted lines of that info on the WSOD.

Below is a sample of the code that I am using to do this. As you can see, even a simple select statement bombs entirely. Does anyone have any idea why this might be happening?

I would really like to make this work and do it with the migrate module. But I am about to throw my hands up and just write a custom script to connect to the database and output all of the data as a giant XML file and then hope that the migrate module can handle that (or import the aggregated data into a temp table at some point).

$query = Database::getConnection('opencart', 'opencart')->query("SELECT * FROM product");

if ($query != NULL) {
  $row = $query->execute()->fetchObject();
  echo "<pre>" . print_r($row, true) . "</pre>";
  echo "<pre>" . print_r($query, true) . "</pre>";
}
else {
  echo "Query is NULL.";
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T14:17:11+00:00Added an answer on June 3, 2026 at 2:17 pm

    The way I’ve done this before is:

    1- Edit your active settings.php file to include the secondary db in your $databases array. So you’d have something like

    $databases = array(
      'default'=> array(...),
      'secondary' => array(...),
    );
    

    2- In your code, use db_set_active('secondary'); You can then execute db_query()s and possibly the likes of db_select(), etc.

    3- Make sure to switch your active database back to the default as soon as possible. Watch out for function calls you make before you switch back to the default database. Many calls, like t(), require the default database, and will crap out it’s not active.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm doing a data migration at the moment of a subset of data from
I have a batch process that imports large amounts of data. I am doing
We are doing an import process from a source database to a destination database.
I'm in the process of doing a large scale server migration, as such I
Hello I am in the process of doing a school project, where we have
I basically have a unix process running and it is doing some heavy processing
Something I keep doing is removing comments from a file as I process it.
I need to process lots of data in lists and so have been looking
Process the data handed to an html page from a form. This is my
I'm doing some work with the stackoverflow data set in Java and have a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.