Dbi/mysql

I’m using mysql 4.0+, perhaps that is the problem - i insisted on it -
trying to get past the intermittant “Mysql has gone away” befuddling error.

and, interestingly, conn.select_one and conn.select_all simply kills the
whole process - nothing is output not even headers and conn.do
works(such as an insert).

mysql works - i mean ruby-mysql with require ‘mysql’ so i think it has
something to do with dbi

So close but so freakin far…if there is some info that i’m not
including that might help please let me know

clueless me

···

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

hello #{r[0]} 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

If you’re only looking to provide a connection to mysql, then you should
seriously consider the ruby-mysql module. It just plain works - and on mysql
4.1.0+

-Rich

···

----- Original Message -----
From: “Paul Vudmaska” paul@vudmaska.com
To: “ruby-talk ML” ruby-talk@ruby-lang.org
Sent: Saturday, May 22, 2004 12:17 AM
Subject: dbi/mysql

I’m using mysql 4.0+, perhaps that is the problem - i insisted on it -
trying to get past the intermittant “Mysql has gone away” befuddling
error.

and, interestingly, conn.select_one and conn.select_all simply kills the
whole process - nothing is output not even headers and conn.do
works(such as an insert).

mysql works - i mean ruby-mysql with require ‘mysql’ so i think it has
something to do with dbi

So close but so freakin far…if there is some info that i’m not
including that might help please let me know

clueless me


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

hello #{r[0]} 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

Paul Vudmaska wrote:
[Problems with dbi/mysql]

Which version?

···


http://www.mikrocontroller.net - Das Mikrocontroller-Forum