Reputation: 3659
I need to have access to my vbulletin forum database on other server than my rails app.
I created vbulletin
entry in database.yml
vbulletin:
adapter: mysql2
encoding: latin2
database: db_name
username: username
password: password
host: forum.hostname.pl
port: 3306
And created simple model vbuser.rb
class Vbuser < ActiveRecord::Base
establish_connection(:vbulletin)
self.table_name = 'user'
end
Now, I'm trying run Vbuser.last
in console but get :
Mysql2::Error: Can't connect to MySQL server on 'forum.hostname.pl' (110)
What can be the problem?
Upvotes: 0
Views: 2597
Reputation: 2694
Two reasons I can think of -:Either you have supplied incorrect details, or the host does not allow you to directly connect. Don't think it's a Rails specific issue. Can you do a quick check on some other language (php etc) and see if you are able to connect? Your syntax seems fine to me.
To quickly check create a connect.php file on localhost.
In that file
<?php
$link=mysqli_connect('host','user','pwd','database') or die("can't connect");
if ($link)
echo "Working";
mysqli_close($link);
?>
What do you get?
Upvotes: 1