473,378 Members | 1,500 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

How to use 2 schema at a same time?

I want to use two schema in single rails application, for that how to specify the schema name in model. Tried with following, it was not working.
set_table_name "schemaname.tablename"

schema names:

1. addressbook
2. schedule

Need to fetch the details from addressboook schema and have to get some data from user and need to store it in a 'schedule' schema with all details.
Oct 22 '10 #1
2 1826
improvcornartist
303 Expert 100+
set_table_name "schemaname.tablename" doesn't work because the application is connected to one default schema. It expects whatever you pass to set_table_name to be a table name within the model's schema.

You should be able to get the application to work by setting up a second ActiveRecord connection for whichever is not the default (Base).

Expand|Select|Wrap|Line Numbers
  1. # This is the default connection
  2. ActiveRecord::Base.establish_connection(
  3. :adapter => ?mysql?,
  4. :host => ?localhost?,
  5. :username => ?user?,
  6. :password => ?pw?,
  7. :database => db_name
  8. )
  9. # This is the second connection
  10. ActiveRecord::Schedule.establish_connection(
  11. :adapter => ?mysql?,
  12. :host => ?localhost?,
  13. :username => ?user?,
  14. :password => ?pw?,
  15. :database => db_name
  16. )
  17.  
Oct 22 '10 #2
It was not working as per expected. I have used database.yml file with specifying 2 schemas.
Dec 23 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: C. M. Sperberg-McQueen | last post by:
wooks (wookiz@hotmail.com) wrote: > <?xml version='1.0'?> > <userlogin xmlns="urn:faster:userlogin" > xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'> > <login>mick</login> > ...
4
by: Andrew | last post by:
Antony (4:26 PM) : Hello all ! I have a problem with XML schema. My XML document which I need to be validated can be one of the following two types: 1st type is
2
by: Zombie | last post by:
Hi all, I wish to create a namespace other than the default one. Let's say, the Schema looks like: ----------------------------------------------------------------------- <?xml version="1.0"...
0
by: David | last post by:
Hi. My company is using iPlanet's LDAP directory. I developed a web service that authenticates users against ldap and returns certain attributes back. I am using directory services library for...
2
by: PeterW | last post by:
I have an xml file from which I want to generate an xsd schema and at a later stage a cs class. The xml file has a mix of defined namespaces and also an empty namespace. These are defined as...
10
by: Al Christoph | last post by:
Please forgive me if this is the wrong place to post this. The last place I posted got me a fairly rude response. I guess vb.db people just don't want to think about XML as database. At any rate,...
7
by: greatcanyon | last post by:
Hi, When I create a new user in DB2, can I set the default schema to an existing schema? The reason I want to do this is that I want to later connect to db2 as this user and access tables...
3
by: Chris Lieb | last post by:
I am new to XML Schema and am running into a bit of a snag. I have defined an XML-based scripting language for an updater program that I am working on. I would like to make a schema for this...
3
by: Michael | last post by:
If I come up with an XML Schema, do I own the intellectual propertyrights for that schema? Can I legally restrict others from using that schema? I'm in the UK if that makes any difference...
3
by: JMD | last post by:
A set of xsd files has been working fine for us at this site, but now it gives *intermittent* errors for someone at a different cite (who is consuming the code we are producing). Most of the time...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.