我需要訪問我的vbulletin論壇數據庫而不是我的rails應用程序。 我創建了database.yml
使用rails連接到外部數據庫
vbulletin:
adapter: mysql2
encoding: latin2
database: db_name
username: username
password: password
host: forum.hostname.pl
port: 3306
vbulletin
條目,創建簡單的模型vbuser.rb
class Vbuser < ActiveRecord::Base
establish_connection(:vbulletin)
self.table_name = 'user'
end
現在,我試圖運行Vbuser.last
在控制檯卻得到: Mysql2::Error: Can't connect to MySQL server on 'forum.hostname.pl' (110)
可以採取什麼問題?
使用管理控制檯,您可以使用database.yml中的詳細信息連接到數據庫嗎? – DaveStephens 2013-03-07 13:24:22