Displaying 20 results from an estimated 10000 matches similar to: "Connecting to multiple databases, mysql win32 gem problem"
2012 Mar 02
0
ConnectionNotEstablished when using connection on AR::Base abstract subclass
I''m using AR outside of Rails and calling establish_connection on an
ActiveRecord::Base abstract_class subclass (to protect my connection
in case anyone else is using AR). It was working just fine with AR
3.0.9, but I recently attempted to upgrade to AR 3.2.2. Now, when I
hit a "nested" query from a has_many, I get a
ActiveRecord::ConnectionNotEstablished. If I call
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 Jun 26
1
Separate Read and Write Database
Hello,
I need to access an mirrored database with one read and one write
cluster. Is there a way to tell a model to use two connections? So that
all updates etc go to the write database and all read from the read one?
This is a fixed set up I can not use MySQL 5.x stuff and additionally i
get a token on write, which can be checked on read (and wait for
replication) if new data is needed.
I
2006 May 04
1
Multiple database problem in rails 1.1 ?
Hi ...
We are constructing at rails GUI using two differant databases, and this
seems to work out nicely using a "establish_connection" per model, where
each model enherit directly from ActiveRecord::Base.
But ! I like to use a model where we can inherit from one parent class
that handles the connection exactly as descripted in this document :
2007 Oct 12
6
abstract_class... what exactly does it do
Hi,
Does anyone know much about abstract_class? Does it actually prevent
instances of the class from being created? Does it disable certain
methods? I already know what it''s for, but I want to know what setting
self.abstract_class=true actually does.
The reason I ask is that I want to use it for a slightly unorthodox
purpose. I want a class who''s only attributes are its
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 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 Mar 17
11
Refactoring module
Dear all
Please see the following module, In module SX3 SX4 and SX5 have similar
class Tasklist, but inherit from different class.
I will use the following code to connect to different data sources
RemoteSX3Model.establish_connection sx3_hash
RemoteSX4Model.establish_connection sx4_hash
RemoteSX5Model.establish_connection sx5_hash
How can I refactor my code in module to look simpler? Thank you
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
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 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,
2005 Dec 19
1
multiple databases
Hi,
I''m writing a translation plugin which takes the translations from a
database that is different than the application''s main database.
When in my plugin''s models I put this code:
ActiveRecord::Base.establish_connection(
RAILS_ENV+"-translations"
)
all my application''s models use the plugin''s database....
Why are my
2007 Nov 29
2
railroad-database problem
Hi all,
I am facing with a new type of problem with railroad, explained
below
1. I am using an oracle database in my application. In the database.yml
file, I am having different schema connections to the same database.like
development:
database: real_database
username: schema_name1
password: ************
adapter: oracle
abcd_development:
database: real_database
2003 Jan 21
2
[patch] Two problems in testsuite (POSIX, perms)
Hello,
Noticed a couple of problems with the rsync testsuite. I have included
a possible patch for each problem (attached & inlined.)
The first problem is that on OpenBSD when make test is run and tests
are skipped you see messages like this:
cat: "/tmp/rsync-2/rsync/testtmp.chown/whyskipped": No such file or directory
SKIP chown ()
After my patch, you get the appropriate
2006 Sep 07
1
gem mysql buggy on Win32
Hi,
Just running a simple unit test and trying to save an object gives me
this error.
test_validations(FriendTest):
NoMethodError: undefined method `each'' for #<Mysql:0x38f60d0>
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/connection_adapters/mysql_a
dapter.rb:292:in `columns''
....
....
Rails 1.1.6
mysql 5
mysql gem 2.71
After I
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
2006 Jan 18
1
Helps!!!!! Rails database connection guru needed!!!!!!!
Hi,
I really need help to understand what is happening
while Rails connect to a database, (we area actually
using postgresql, so my example will be with
postgresql) What I understand is Rails is able to
connect to different DB. Actually, this is what we
want, and we have made some tests, everything is juste
fine. However, all these tests lead us to some
important questions that we did find the
2006 Aug 01
7
MySQL binding problem on Max OS X 10.4
Hi all.
No matter what I do I can''t get rails to see my MySQL database. All
details are below. I really appreciate any assistance. Thanks!!!
DETAILS
-------
1. I''m using Rails 1.1.4 with Ruby 1.8.4 on Mac OS X 10.4.7. I have
installed the MySQL bindings following the instructions here: