ActiveRecord::StatementInvalid in StoragesController#create
Mysql::Error: #22001 Data too long for column 'data' at row 1: INSERT
INTO `storages` (`content_type`, `name`, `updated_at`, `created_at`,
`data`) VALUES('image/jpeg', 'Add Task.JPG', '2008-06-25 18:32:13',
'2008-06-25 18:32:13',
x'ffd8ffe000
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract_adapter.rb:150:in
`log'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/mysql_adapter.rb:281:in
`execute'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract/database_statements.rb:156:in
`insert_sql'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/mysql_adapter.rb:291:in
`insert_sql'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract/database_statements.rb:44:in
`insert_without_query_dirty'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract/query_cache.rb:19:in
`insert'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/base.rb:2272:in
`create_without_callbacks'
c:/ruby/bin/mongrel_rails:19:in `load'
c:/ruby/bin/mongrel_rails:19
Request
Parameters:
{"commit"=>"Create",
"authenticity_token"=>"9cbcb635690f612dba93cfda5767036ed040ea1c",
"storage"=>{"dataf"=>#<File:C:/WINDOWS/TEMP/CGI.1888.5>}}
Show session dump
---
:user_id: 1
:expires_at: 2008-06-25 19:02:13.073000 -04:00
flash: !map:ActionController::Flash::FlashHash {}
:csrf_id: bd7cdb1ca1cd0f1236cac45fbc63424b
Response
Headers:
{"cookie"=>[],
"Cache-Control"=>"no-cache"}
Attachments:
http://www.ruby-forum.com/attachment/2252/error_ful.txt
--
Posted via http://www.ruby-forum.com/.
The longblob helps to some extent ... but then I got the following error
the size of the file I attempted to upload is 6948KB and the error I got
was
ActiveRecord::StatementInvalid in StoragesController#create
Mysql::Error: Lost connection to MySQL server during query: INSERT INTO
`storages` (`content_type`, `name`, `updated_at`, `created_at`, `data`)
VALUES('application/x-sdlc', 'PrintEngine_20060519_motomail_setup.exe',
'2008-07-07 14:43:37
In the console I get this error :
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/mysql_adapter.rb:471:
> [BUG] Segmentation fault
> ruby 1.8.6 (2007-09-24) [i386-mswin32]
Any idea what could be wrong?
Eric Kramer wrote:
> It looks like you might be using MySQL "BLOB" instead of "LONGBLOB"
> for your binary column. Try specifying a size (large enough for your
> data) in your migration using the :size => option. For more detail,
> see the resolution of this ticket:
> http://dev.rubyonrails.org/ticket/4164
>
> Good luck!
> - Eric Kramer, Nationwide Children's Hospital
>
> On Jun 25, 6:42 pm, Ather Shiraz <rails-mailing-l...@andreas-s.net>
--
Posted via http://www.ruby-forum.com/.
> The longblob helps to some extent ... but then I got the following error
> the size of the file I attempted to upload is 6948KB and the error I got
> was
> ActiveRecord::StatementInvalid in StoragesController#create
>
> Mysql::Error: Lost connection to MySQL server during query:
Check that 'max_allowed_packet' size in your MySQL config is
larger than your largest file.
HTH,
--
Hassan Schroeder ------------------------ hassan.s...@gmail.com
Where is this max_allowed_packet field in mysql config? I am using MYSQL
5.0 and there is my.ini file which does not have that field however
my-huge.ini under c:\program files\mysql\mysql server 5.0\my.ini
Look the /db/schema.rb file. Maybe your camp is defined as string.