Displaying 20 results from an estimated 9000 matches similar to: "Proper way for deploying many applications sharing a common user database"
2006 Jan 19
4
multiple database in the same actions?
Hi,
I read the example in
http://wiki.rubyonrails.com/rails/pages/HowtoUseMultipleDatabases,
it show us how to connect to other database, each time
we start a new action, however, this doesn''t work
while you try to connect to two different database
within the same action.
SO I wonder is it possible to bind to two or more
database within the same action????
Thanks you very much
Saiho
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 Oct 12
2
Too Many Mysql connections
In my app, for three models: foo,bar and baz, the database connection
is made to a different database and hence in model code:
class Foo < ActiveRecord::Base
establish_connection :diff_database
end
class Bar < ActiveRecord::Base
establish_connection :diff_database
end
class Baz < ActiveRecord::Base
establish_connection :diff_database
end
Now, the problem is, if is use the above
2006 Feb 27
5
Database connections...so many connections!
Hello all.
I am currently running a very simple ruby app. It connects to an Oracle
server using the OCI8 adapter.
I have two controllers, each one connects to a different schema on the
server, I looked at the WIKI that had details of multiple database
connections
(http://wiki.rubyonrails.com/rails/pages/HowtoUseMultipleDatabases), I
moved the code from the application controller into each
2006 Jul 22
3
Connection refused - connect(2)
Dear all,
Please help me in this regards,
I am using models to access LegacySchemas using
set_table_name and set_primary_key...
[code for model]
class CdDetails < ActiveRecord::Base
def self.find_data
set_table_name ''cd_details''
set_primary_key ''cd_label''
find (:first,
:select => "cd_label")
end
2007 Jan 11
12
Rails not properly handling Oracle db connections/sesions in dev mode
We are running edge rails with oracle. After a few hundred requests
all available sesions are used up. It seems prior connections are
being left open. When this happens no one using the installation of
Oracle can create a new session until you kill your mongrel/webrick
server.
Patch #6928 addresses this problem, and i applied it to my vendor rails
and it worked.
I think, if possible, this
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
2010 Jun 15
2
ActiveRecordConnection from jobs script
Hi,
I make a cron jobs and I would like to use ActiveRecord. but I have this
error:
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:326:in
`retrieve_connection'': ActiveRecord::ConnectionNotEstablished
(ActiveRecord::ConnectionNotEstablished)
Do I have to require
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
2009 Jun 08
2
Connecting to SQLServer
New to rails. Installed rails on my XP desktop, and setup my first app
that will use an existing SQLServer database. I am able to connect to
SQLServer using odbc with following code.
require ''rubygems''
require ''ActiveRecord''
ActiveRecord::Base.establish_connection(
:adapter => ''sqlserver'',
:mode => ''odbc'',
:dsn
2006 Aug 13
1
establish_connection method
I''m digging into rails source code.
But I''ve got a problem in undestading actionrecord::base source code
which is connection_specification.rb.
In the body of establish_connection method,
def self.establish_connection(spec = nil)
case spec
when nil
raise AdapterNotSpecified unless defined? RAILS_ENV
establish_connection(RAILS_ENV)
2011 May 19
2
unicorn doesn't restart properly after cap deploy (not using Bundler)
Hey guys,
I''m sending USR2 to unicorn after cap deploy, and the old master is
getting replaced by a new master that doesn''t work.
Here are some similar threads I found ...
http://rubyforge.org/pipermail/mongrel-unicorn/2010-October/000733.html
http://rubyforge.org/pipermail/mongrel-unicorn/2010-October/000717.html
I''m not using Bundler, and I have working_directory
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
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,
2012 Feb 26
15
ActiveRecord::ConnectionNotEstablished
Hi,
I am trying the tutorial in:
http://guides.rubyonrails.org/getting_started.html
when I try to navigate to http://localhost:3000 after the 4.3 change
I get the error : ActiveRecord::ConnectionNotEstablished
and I don''t know how to solve it
the database.yml file is:
adapter => mysql
host => 127.0.0.1
database => blog
username => root
password => *****
my
2006 Oct 02
1
Problems Deploying a Camping app on TxD
So I''ve been trying all day to get a small camping app I wrote up on
Textdrive to no avail.
Right now I''m getting a 500 error when I go to the site, and it spits this
out (from lightty after i restart it and make a request to the app):
(eval):13:in `initialize'': undefined method `to_hash'' for
#<FCGI::Stream:0x83a35d8> (NoMethodError)
from
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
2006 Jan 24
4
Parse request URL.
Hello all.
Due to the mistakes of the company before I joined ;) I am stuck with a
multiple database setup. I am planning on parsing the REQUEST_URL to
decide which controller is being accessed and basing the
establish_connection on that. Before I go messing around with regexps I
was wondering if rails has a built in function for parsing URLS. I have
googled around a bit and seen net/http
2012 May 16
7
Rails 3.1.0 cannot connect to sqlite database on Mac Lion
I''m running Rails 3.2.3 on Mac Lion with sqlite 3.7.7 and ruby 1.9.3p125. I need to back down rails to 3.1.0 for a project but when I do that a simple index page give me a
ActiveRecord::ConnectionNotEstablished
error.
Rails 3.2.3 works, 3.1.0 not. Any ideas?
Just to show you it''s nothing fancy....
Gem file is only:
source ''https://rubygems.org''
gem
2009 Jan 13
2
Connect multiple DB in rails project using AR
Dear all
I have a rails project which database connection is defined in
database.yml. There is a table call "servers" which have about 40
records, which is a collection of database setting (i.e. Server.name,
Server.port, Server.host)
I know the way to establish multiple connection as below...
class A < ActiveRecord::Base
end
A.establish_connection(a) # a is the database config