From: Rohit Mehta Date: 2006-06-24T09:08:09+09:00 Subject: Re: mysql-ruby + ruby-mysql + activerecord == confusion Ok here it is documented that ruby-mysql does not work with mysql > 4.1 (although it appears to work fine with mysql 4.1.12 but fail with 5.x) http://wiki.rubyonrails.com/rails/pages/MySQL However when compiling the C mysql adaptor (mysql-ruby) on a machine with mysql 5.x installed and then trying to connect to a mysql 4.1.12 server, I get an out of memory error. Running the mysql client works fine though. I can still do something like: /usr/local/mysql5/bin/mysql -u X -p -h (mysql4.1.12 server). The Rails LiveCD looks very interesting. I will have to setup VMware Player and look at it... but I'm still stuck on MySQL. Rohit Alexandru Popescu wrote: > I have asked a similar question when reading the announcement about > Rails Live CD: > http://www.infoq.com/news/Rails-LiveCD-Announced#view_1059. > > ./alex > -- > .w( the_mindstorm )p. > --- > (http://themindstorms.blogspot.com) > > > On 6/24/06, Rohit Mehta wrote: > >> >> Hi guys, I am having some difficulties with mysql :) >> >> I have rails working and activerecord works, and I can create >> webapps that display and update databases just fine. >> >> However, I am not using rails. I just want to do some simple >> inserts to a database. >> >> So, I tried something like the following: >> >> require 'rubygems' >> require 'active_record/vendor/mysql' >> @db = Mysql.new(hostname, username, password, databasename) >> db.query("insert into sent mail (id, recip, subject,spam) >> values(12,'foo','foo','y')") >> Mysql::Error: Lost connection to MySQL server during query >> from >> /usr/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/vendor/mysql.rb:1092:in >> >> `read' >> from >> /usr/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/vendor/mysql.rb:499:in >> >> `read' >> from >> /usr/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/vendor/mysql.rb:381:in >> >> `read_query_result' >> from >> /usr/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/vendor/mysql.rb:180:in >> >> `real_query' >> from >> /usr/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/vendor/mysql.rb:307:in >> >> `query' >> >> I then tried downloading and installing mysql-ruby-2.7 >> >> I have mysql-client installed and I ran test.rb connecting to a mysql-4 >> server and got the following >> failures: >> >> 1) Failure: >> test_execute2(TC_MysqlStmt2) [test.rb:628]: >> <[123]> expected but was >> <[196864]>. >> >> 2) Error: >> test_execute3(TC_MysqlStmt2): >> Mysql::Error: Out of memory (Needed 2063600648 bytes) >> test.rb:637:in `execute' >> test.rb:637:in `test_execute3' >> >> 3) Failure: >> test_execute4(TC_MysqlStmt2) [test.rb:653]: >> <[nil, "hoge", #]> expected but was >> <[nil, "\001", #]>. >> >> 4) Failure: >> test_sqlstate(TC_MysqlStmt2) [test.rb:1288]: >> <""> expected but was >> <"00000">. >> >> So THEN, I tried ruby-mysql-0.2.6. This actually works just fine >> against my mysql 4 server, but >> when I run it against mysql 5, I get the following: >> connect............../mysql.rb:453:in `read': Client does not support >> authentication protocol requested by server; consider upgrading MySQL >> client (Mysql::Error) >> >> So I am out of luck if I want to use mysql 5. However my rails apps >> work with a mysql5 server. >> Anyone have any idea what I should be doing? >> >> >> I'd appreciate assistance as I am quite muddled after all of this... I >> haven't even looked at Ruby-DBI yet! >> >> :) >> >> Thanks, >> >> Rohit >> >> >> >