dbi :mysql

P

Paul Vudmaska

Setting up ruby,mod_ruby on a host we've got everything flying except
mysql with dbi.

[webmaster@iis webmaster]$ ruby -v
ruby 1.8.1 (2003-12-25) [i686-linux]
[webmaster@iis webmaster]$ ruby -e "p require 'mysql';require 'dbi'"
-e:1: warning: parenthesize argument(s) for future version
true

We've installed the latest and greatest of both dbi and mysql.

In a simple script, we can open the connection but as soon as i run sql
it dies - i mean i hangs or something....not even headers are being sent
back to the browser. Like so:

begin

require 'cgi'
cgi = CGI.new
cgi.header('content-type'=>'text/html')

require 'dbi'

puts 'before connect'

conn = DBI.connect("dbi:Mysql:dev:localhost",'name','pwd')
puts 'after connect'

#dies here - i've tried other sql as well with same result
r = conn.select_one('select version()')
#we never see this - or anything else
puts 'after sql'

puts <<-EoS
<html>
<body>
hello #{r[0]}
</body>
</html>
EoS

rescue Exception

puts $!


ensure
conn.disconnect if conn

end

No errors or nothing. No headers. IE, funky enough, gives me a dns
error. Anyone have a clue what I might be doing wrong?

Thanks for any help,
Paul
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,062
Latest member
OrderKetozenseACV

Latest Threads

Top