From: Bryan Richardson Date: 2008-09-05T05:51:27+09:00 Subject: How to save Ruby object as a blob in MySQL Hello all, I'm using Ruby and Sequel on Windows to talk to a database on a Linux machine. The Sequel-to-MySQL connection is working fine -- I can save and query for data no problems. However, I'm trying to save a Ruby object (an Array at this point) as a blob in the MySQL database and when I do I get some crazy stuff going on. The code I am running is below: require 'rubygems' require 'sequel' DB = Sequel.connect 'mysql://test:test@172.16.234.1/sequel' DB.create_table :items do column :name, :text column :stuff, :blob end test = Array.new test << 145.0 test << 231.56 b = Marshal.dump(test) items = DB[:items] items << { :name => 'Test', :stuff => b } When I run this I get no errors at all. However, when I move over to my Linux machine where the MySQL server is running and do a 'select * from items' query it looks like the blob data is overflowing out of the table and my command line gets all jacked up (see the attachment). The command line stays jacked up even after I exit out of the mysql client console. Any ideas on why this is happening and more importantly how I can successfully marshal a Ruby object to my database?! -- Thanks! Bryan Attachments: http://www.ruby-forum.com/attachment/2649/ss.png -- Posted via http://www.ruby-forum.com/.