Forum: Ruby on Rails using multiple mysql databases

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
kevin y. kim (Guest)
on 2007-05-23 01:45
(Received via mailing list)
Hi,

I've got an app that talks to two databases on a given MySQL server.
When I run in development mode, pointing to the MySQL server running
on localhost (127.0.0.1),
I am able to access both databases without any problem.  The relevant
yaml looks like this:
(names have been changed to protect the innocent)

development:
  adapter: mysql
  database: dev
  username: username
  password: password
  hostname: 127.0.0.1

dev2:
  adapter: mysql
  database: dev2
  username: username
  password: password
  hostname: 127.0.0.1


When I change the environment to "production", I am unable to access
the database that is *not* named "production".  I get an error that
reads "Mysql::Error: Unknown database 'prod2'".  The production part
of the yaml looks like:

production:
  adapter: mysql
  database: prod
  username: username
  password: password
  hostname: db.prod.mycompany.com

prod2:
  adapter: mysql
  database: prod2
  username: username
  password: password
  hostname: db.prod.mycompany.com


When I change the "development" and "dev2" to point to the production
server and tables, I get the same error.

This leads me to believe that the dev and prod mysql servers are
configured differently, but I wanted to double check and see if anyone
has seen this problem before (and that it might be rails).

Anyone?

Thanks,
-kevin
This topic is locked and can not be replied to.