Displaying 20 results from an estimated 70000 matches similar to: "Can different models use different databases?"
2007 Sep 26
0
activerecord multiple databases
So, I was looking for a setup that would allow me to easily query
multiple databases and not have to re-write my customer finder type
queries. Here is what I came up with and it seems to be working for
me in my very basic tests so I thought I''d share. Just posting it in
case this helps anyone else trying to do the same thing.
I''m using this with activerecord, but not rails, so
2006 Apr 18
2
Connecting to multiple databases with multiple database users
Hi everyone,
I was wondering what the common practice for handling multiple db
users with fine grained privileges on multiple databases is. Against
the often read guideline for rails users to keep with a single db as
"more dbs don''t really make sense anyway", my opinion is that it DOES
make sense to use more than one db schema for a number of reasons that
I won''t
2006 Mar 19
0
Oracle connection problems when connecting to multiple databases
I have a rails application that connects to two different databases. The
first (primary) database is MySQL and the second is Oracle. I have followed
the example in the Rails Recipes book and I have created a base class for
the models connecting to oracle like this:
class ConferenceBase < ActiveRecord::Base
establish_connection :conference
end
:conference is setup in the database.yml.
A
2006 Jun 14
0
Mssql Multiple Database Access Error
Hi All,
I am having a problem to access multiple databases with mssql
I am running Ruby 1.8.4 and Rails 1.1 on Windows 2000 Advanced Server.
I am simply trying to integrate the application I wrote before for
Oracle to Mssql. The application works perfectly with Oracle with the
installed driver OCI8. The app retrives data based on a search criteria
from those databases.
I followed the directions
2006 Nov 17
5
configure a rails app for multiple databases
Hello Rails community
I cannot seem to find via Google what I had hoped would be
a simple issue
On a single DB system (currently, postgres 8.1.4),
I have two databases, each containing multiple tables.
I would like to configure my app and database.yml to recognize
these two databases.
What is the corrrect config for the database.yml ?
Is it something like:
> production:
> adapter:
2006 Mar 16
5
Multiple databases + switching databases
Hello,
I have an application that access two different DBMS - Firebird
and Postgres. So far, that''s ok. The problem is, depending on the
customer logged, a different database (Firebird) must be selected.
To make the things clearer:
Postgres: 1 database shared by all customers with these tables:
- user
- vehicle
- driver
Firebird: several databases with different names and identical
2007 Apr 04
4
joining across databases in a find statement with include (legacy db)
Hi,
I have a legacy database ''old'' and a new database ''new'' which rails
uses. I set up models using old with establish_connection(old), and
this works well, except for include:
class OldModel < ActiveRecord::Base
establish_connection(old)
end
class NewModel < ActiveRecord::Base
has_one :old_model
end
a = OldModel.find :first
NewModel.find(:all,
2006 May 02
1
Tests just deleted my production Database!!!
Sorry, in my haste I forgot to modify the subject.
5/2/06, "Christian R. Garner" <olus@digitalapathy.net>wrote:
>
> All assumptions aside, "rectest" and "salt" are usernames not
> databases/schemas according to the pasted config. If they were in fact
> different databases/schemas, this problem could never have happened.
> While
>
2006 Jan 13
1
How to disconnect to a database????
Hi,
We have experienced some problems with
ActiveRecord::Base class of Ruby-Rails. We are
building a web-application based on the Ruby-rails
framework and the web-application needs to access to
difference databases, so we do not pre-define our
database accesses in the database.yml file. In fact,
we are using the
ActiveRecord::Base.establish_connection() to connect
to our database, the function
2006 Jan 06
1
ActiveRecord - Switching Databases
This is a question regarding ActiveRecord outside of Rails.
I have several databases that have absolutely identical table structure. I
have a
ActiveRecord::Base.establish_connection(
:adapter => "mysql",
:host => "localhost",
:username => "user",
:password => "password",
:database
2012 May 15
5
setting up the SQLite database
I know this isn''t Python, but I''d like to get a view on the ''one
obvious'' way to set up an SQLite (or other) database and its location
per-app. I''ve got a bit lost with the Camping 2 changes and various
code snippets I have kicking around.
1.
is it best to set up the DB creation/connection:
1.1
at the end of the app
2006 Feb 08
8
Strategies for Unit testing 2 databases
Hi,
My application spans 2 (or more) databases for some very specific
reasons... My models are working fine, even dynamically establishing
connections as needed at runtime, and spanning relationships across the
databases (which really impressed me). The problem is, I can''t seem to
force Units for these models (that use a secondary db) to load their
fixtures into and use the
2006 Sep 15
2
unable to figure out how to get backgroundrb.yml to be used when starting backgroundrb
i ran rake backgroundrb:setup and modified the default
config/backgroundrb.yml file as:
---
port: "22223"
timer_sleep: 60
load_rails: true
environment: production
host: localhost
database_yml: config/database.yml
acl:
deny: all
allow: localhost 127.0.0.1
order: deny,allow
and my database.yml
production:
adapter: mysql
database: chip2_production
username: xxxxx
password:
2012 Jul 17
6
Database connection parameters are tied to the filesystem
HI Guys,
I recently tried VERY hard to override the database configuration bassed on
ENV vars or actual API calls. This task is almost next to impossible.
I know that the database.yml file is parsed as ERB but that is sane for
simple ENV replacement if you want to actually change which database
adaptor it is (requires extra config/params) it becomes messy.
I found
2010 Apr 15
3
Same model over multiple databases problem
Hello,
I run many gameservers (about 10), each gameserver has a different
database and all gameserver''s databases has the table "players" which
is associated to the model Player. So every time I want to work with
the Player model I need connect to a different database depending on
which gameserver I am working on.
My problem is that I need to make rails choose which database
2006 Aug 18
0
Connecting to multiple databases, mysql win32 gem problem
I am trying to connect to multiple databases, and have setup an abstract class
with a call to establish_connection:
class TestBase < ActiveRecord::Base
self.abstract_class = true
end
TestBase.establish_connection(
:adapter => "mysql",
:host => "host",
:username => "user",
:password => "pass",
:database
2006 May 15
8
Databases... write master, multiple read-only slaves.. will this work?
Hi all -
I have a need to have my models write to one database and read from
another. From what I''ve read, Rails doesn''t do this out of the box. I
came up with something that does work, but I''m wondering if there is
something I''m missing in the code below that''s going to bite me, such as
establish_connection creating a huge number of objects as
2006 Jun 16
0
Mysql: establish_connection''...development database not conf
I have tried for several hour to get a mysql db connection to work, but
have failed so far:
This is a cpanel server running Mysql 4.1.19, fcgi with apache.
Here is the output from script/console
Loading development environment.
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:194:in
2009 Jul 21
1
synatx error while running migration
hello to all,
i am getting weird syntax error while running the rake db:migrate
syntax error, unexpected tSYMBEG, expecting kDO or ''{'' or ''(''
Apparently i am creating an engine in my main application using
''ruby script/generate plugin'' command in rails 2.3.0 with engine having
its own separate database define in database.yml of main
2004 Dec 24
1
Tutorial Steps Two & Three
Hey-
I ran into to some problems when trying to follow "A tutorial by
Rails'' users." When I reached Step Three and executed the controller
script as follows:
ruby script/generate controller Friends list display new edit
I got this error message:
C:\Inetpub\wwwroot\rails>ruby script/generate controller Friends list display ne
w edit