Two databases

If all you're using the MSSQL database for is a username and password, you ought to make the MySQL database the primary database. In database.yml, add configuration for your MSSQL server. It will look something like:

mssql_connection:   adapter: sqlserver   database: dbmydatabase   host:   username: user   password: secret

Then, generate a model in your project and insert code akin to:

class LoginInfo < ActiveRecord::Base   set_table_name "user_info"   establish_connection :mssql_connection

  def fetch_username     # code to get username here   end

  def fetch_password     # code to get password here   end end

Then you should be able to call UserInfo.fetch_username from within your app and the username will be returned.