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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T09:55:12+00:00 2026-05-18T09:55:12+00:00

I have a ‘legacy’ DB2 database that has many other applications and users. Trying

  • 0

I have a ‘legacy’ DB2 database that has many other applications and users. Trying to experiment with a rails app. Got everything working great with the ibm_db driver.

Problem is that I have some tables like schema1.products, schema1.sales and other tables like schema2.employees and schema2.payroll.

In the ibm_db adapter connection, I specify a schema, like schema1 or schema2, and I can work within that one schema, but I need to be able to easily (and transparently) reference both schemas basically interchangeably. I don’t want to break the other apps, and the SQL I would normally write against DB2 doesn’t have any of these restrictions (schemas can be mixed in SQL against DB2 without any trouble at all).

I would like to just specify table names as “schema1.products” for example and be done with it, but that doesn’t seem to jive with the “rails way” of going about it.

Suggestions?

  • 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-18T09:55:12+00:00Added an answer on May 18, 2026 at 9:55 am

    Schemas in DB2 are a very handy way to provide separate namespace to different applications. For example, you can separate all database objects for an application called “recruiting” from say application called “payroll”. You can have objects (tables, views, procedures etc.) with the same name reside in multiple schemas and not colide with one another. Having your application set a schema is a handy way for it to say “hey, I am a payroll and I only want to work with my objects”. So, what happens when you want to work with objects owned by another application? Well, in traditional procedural programming languages your application code would explicitly specify the schema when referencing an object in another schema or you would just do a SET CURRENT SCHEMA to switch to another schema. The problem with ORMs like ActiveRecord in Ruby on Rails is that you are not supposed to use SQL i.e. you don’t have a good “Rails way” to specify schema when referencing an object. You can use find_by_sql and qualify your objects in the SQL statement but this is not what RoR people will consider to be good Rails.
    You can fix things on the DB2 side. You can define a view per table in the “foreign” schema but you will have to take care to name the view so that it does not colide with what you already have in your primary schema. And, when you do that, you will undoubtedly create names that are not true Rails names.
    Rails people are very proud of the “Rails way”. It makes it very easy to create new applications. Rails is really awesome in this space. However, when it comes to integration with what is already out there Rails … how do we say it … sucks. I suggest you will have to accept to do things that are not the best examples of the Rails Way if you want to work with existing database structures.

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

Sidebar

Related Questions

Have a matrix report now that has Position, Hours and Wages for a location
Have some dates in my local Oracle 11g database that are in this format:
Have a rails app that is supposed to display a list of products/managers. After
Have a SomeLib.pro file that contains: CONFIG += debug TEMPLATE = lib TARGET =
Have searched the database but need to specifically sum(of hours flown or days off)in
Have a bunch of WCF REST services hosted on Azure that access a SQL
Have been following Rails Tutorial by Michael Hart rails version 3.0 on mac OS
I've got a string that has curly quotes in it. I'd like to replace
have been trying couple of hours now to make my iphone app universal. The
Have a look at one of my websites: moskah.com The problem is that it

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.