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

  • Home
  • SEARCH
  • 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 6721963
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T09:23:28+00:00 2026-05-26T09:23:28+00:00

Good morning, I am currently working on a project that utilises Codeigniter and the

  • 0

Good morning,

I am currently working on a project that utilises Codeigniter and the Datamapper Library (http://datamapper.wanwizard.eu). The project uses a central database for user data (called “base”) and a seperate database for the application data (“crm”). This is so that in the future, we may build other applications that use the user directory without being tied to a single server.

I have a problem in that I need to use the built in Datamapper relationships but across the two databases. Here is my setup so far:

Person Model

class person extends DataMapper {

    var $db_params = 'base';
    var $prefix = 'base_';

    var $has_many = array(
        'initiated_event' => array('class' => 'event','other_field' => 'initiator')
    )

}

Event Model

class event extends DataMapper {

    var $db_params = 'crm';
    var $prefix = 'crm_';

    var $has_one = array(
        'initiator' => array('class' => 'person','other_field' => 'initiated_event')
    )

}

The Problem

When I attempt to use $events->initiator->get(), I get the following error:

Error Number: 1146
Table 'circle_base.crm_events' doesn't exist
SELECT `base_persons`.* FROM (`base_persons`) LEFT OUTER JOIN `crm_events` initiated_event_crm_events ON `base_persons`.`id` = `initiated_event_crm_events`.`initiator_id` WHERE `initiated_event_crm_events`.`id` = 1
Filename: C:\xampp\htdocs\circle\crm\system\database\DB_driver.php
Line Number: 330

Could anybody shed some light on the matter? Does DataMapper actually support cross-database joins. If not, is there any way that I can achieve this?

  • 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-26T09:23:28+00:00Added an answer on May 26, 2026 at 9:23 am

    You can’t do this across databases, you can even see from your SQL that it is trying to query 1 single database (lack of . notation for database even). I am assuming both your databases are in the same server? In which case you could try writing a custom SQL query (not sure on your DBs) but in the query define the database.table relationship, and try with a simple statement.

    Otherwise you will need to solve this conundrum programmatically via objects / arrays / etc;

    References:
    http://nathan.rambeck.org/blog/2-joining-mysql-tables-across-multiple-databases

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

Sidebar

Related Questions

Good morning, I am currently working on a project in which I need to
A very good morning, i am currently working on a simple php project, the
Good morning, I am working on a C# winform application that is using validation
Good morning, I am currently writing a python library. At the moment, modules and
Good morning, I am the developer of a medium sized PDA application that will
Good Morning everyone I'm currently facing a segfault at random on a little piece
Good morning. I currently have this little rule in my .htaccess RewriteEngine On RewriteBase
Good Morning All, I have loaded over 1,300 blurbs into my client's database with
Spent the good part of this morning working through this, but still…. apologies if
Good morning everyone, I'm running into an issue using a SharePoint workflow project (C#,

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.