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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T04:57:30+00:00 2026-06-12T04:57:30+00:00

In my rails app i need to use more than one db in app.

  • 0

In my rails app i need to use more than one db in app. But how can i told rails, that this table must be from this db, another – from another. I’m using mysql.
now config looks like this:

development:
  adapter: mysql2
  encoding: utf8
  reconnect: false
  database: Mycorp_development
  pool: 5
  username: root
  password: root
  socket: /var/run/mysqld/mysqld.sock

and one of model (i know that is not in rails-way, but db is non-my)

class Article < ActiveRecord::Base
  attr_accessible :ART_ID, :ART_ARTICLE_NR,  :ART_SUP_ID,  :ART_DES_ID,  :ART_COMPLETE_DES_ID, :ART_CTM, :ART_PACK_SELFSERVICE,  :ART_MATERIAL_MARK, :ART_REPLACEMENT, :ART_ACCESSORY, :ART_BATCH_SIZE1, :ART_BATCH_SIZE2, :QUANTITYM, :PRICEM
  set_table_name "ARTICLES"
  set_primary_key :ART_ID
end
  • 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-12T04:57:32+00:00Added an answer on June 12, 2026 at 4:57 am

    ActiveRecord hasn’t been made to communicate to two different databases.

    Sure https://github.com/cherring/connection_ninja seems to provide a workaround, I haven’t tested it but I’d very careful using this.

    You’re putting yourself in a case that wasn’t planned by the developers, meaning you could hit some walls and having to dig into AR internals to understand what’s going on.

    Given you really need to handle two databases, I strongly suggest considering these two alternatives that both support multiple databases out of the box :

    • Sequel : http://sequel.rubyforge.org/documentation.html
    • DataMapper : http://datamapper.org/

    They work nicely with Rails 3.

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

Sidebar

Related Questions

So I need to access this service from my rails app. I'm using soap4r
I have a Rails app that does everything I need it to do via
I need to produce somewhat complicated PDFs from a Rails app - tables with
I need to start a copy of a Rails app from within Java. I
We have the rails app, content served from the database. Now we need to
I have a rails-app (2.3.2) that I need to install on a server on
I have a rails app that I enjoy developing on a sever much more
I need a 6 character alphanumeric ID for use in my rails app, which
We need to use a legacy mysql db in a rails app. I already
I'm trying to use Minitest for an existing Rails app (3.2), but not having

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.