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 766545
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T17:03:51+00:00 2026-05-14T17:03:51+00:00

The situation: Using a off-the-shelf PHP application, I have to add in a new

  • 0

The situation: Using a off-the-shelf PHP application, I have to add in a new module for extra functionality. Today, it is made known that eventually four different instances of the application are to be deployed, but the data from the new functionality is to be shared among those 4 instances. Each instance should still have their own database for users, content and etc.

So the data for the new functionality goes into a ‘shared’ database.
The data for the application (user login, content, uploads) go into a ‘local’ database

To make things more complex, the new module I am writing will fetch data from the local DB and the shared DB at the same time.

A re-write of the base application will take too long. I only have control over the new module which I am writing.

The ideal solution: Is there a way to encapsulate 2 databases into one name using MySQL? I do not wish to switch DB connections or specifically name the DB to query from inside my SQL statements.

The application uses a DB wrapper, so I am able to change it somehow so I can invisibly attempt to read/write to two different DB.

  • 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-05-14T17:03:52+00:00Added an answer on May 14, 2026 at 5:03 pm

    I do not wish to switch DB connections or specifically name the DB to query from inside my SQL statements.

    What’s wrong with that? If the application DB wrapper is “object-oriented” (meaning it keeps the connection handle and you could have two or more independent instances of the DB wrapper, even if that means two connections) it seems to me that the easiest and most straight forward solution is just to have two DB wrapper instances. Use the “default” one for the local database that the application knows and uses and another instance for your shared database. Adding the extra database parameter when doing queries also looks ok to me.

    How would you encapsulate two databases into one? How would the hypothetical middle-layer know which queries should go to which database? Even if you modify the DB wrapper, how do you imagine it will figure which database is the right one? Like, having a list of tables names to query for db1 and a list of tables to query db2… Nah, introducing some arcane rules will get messy soon.

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

Sidebar

Related Questions

First off, here is the situation. I'm using a guild hosting site that allows
I have a situation where I will be using a repository pattern and pulling
I am in the process of making a PHP web application. I have a
My current situation: I currently have a Mule ESB application with three flows which
I'm using NHibernate currently. I have a situation where I need to save a
I have the following situation: I am using a third party .net library which
The situation is as follows (I am using Rails 3.1). I have the following
My situation is Using .NET 3.5 Using SDL.NET Need to make a friendly installer
I got myself in a situation where using the System.Attribute class seemed (at first
I came across with a curious situation when using jamod to write to modbus.

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.