F
Francis Hwang
I'm using DBI 0.0.23 on Slackware 10 and trying to connect to Mysql
running on another server. Here's the code I'm trying out:
require 'dbi'
dbh = DBI.connect(
'dbi:Mysql:dbname=my_db;host=dc2-mysql-01.kattare.com', 'username',
'password'
)
row = dbh.select_one 'select * from some_table'
And the error I get is
/usr/local/lib/ruby/site_ruby/1.8/DBD/Mysql/Mysql.rb:403:in `execute':
No database selected (DBI:atabaseError)
from /usr/local/lib/ruby/site_ruby/1.8/dbi/dbi.rb:1049:in
`execute'
from /usr/local/lib/ruby/site_ruby/1.8/dbi/dbi.rb:640:in
`execute'
from /usr/local/lib/ruby/site_ruby/1.8/dbi/dbi.rb:662:in
`select_one'
from test.rb:6
I also get errors using other DSNs, such as:
'dbi:Mysql:my_db;db.host.com' => "Can't connect to local MySQL server
through socket '/tmp/mysql.sock' (2)"
'dbi:Mysql:database=my_db;host=dc2-mysql-01.kattare.com' =>
"Segmentation fault" (happens during DBH#select_one)
Any ideas as to what else I should try?
Francis
running on another server. Here's the code I'm trying out:
require 'dbi'
dbh = DBI.connect(
'dbi:Mysql:dbname=my_db;host=dc2-mysql-01.kattare.com', 'username',
'password'
)
row = dbh.select_one 'select * from some_table'
And the error I get is
/usr/local/lib/ruby/site_ruby/1.8/DBD/Mysql/Mysql.rb:403:in `execute':
No database selected (DBI:atabaseError)
from /usr/local/lib/ruby/site_ruby/1.8/dbi/dbi.rb:1049:in
`execute'
from /usr/local/lib/ruby/site_ruby/1.8/dbi/dbi.rb:640:in
`execute'
from /usr/local/lib/ruby/site_ruby/1.8/dbi/dbi.rb:662:in
`select_one'
from test.rb:6
I also get errors using other DSNs, such as:
'dbi:Mysql:my_db;db.host.com' => "Can't connect to local MySQL server
through socket '/tmp/mysql.sock' (2)"
'dbi:Mysql:database=my_db;host=dc2-mysql-01.kattare.com' =>
"Segmentation fault" (happens during DBH#select_one)
Any ideas as to what else I should try?
Francis