I am trying to upload a 432 KB exe file to a column in mysql that is
type blob . It can upload pdfs and rtfs and docs and but when I try to
upload even a jpg which is barely 184 kb it gives the error (data too
long) why is that? (detailed error in file) :
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/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
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...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>
wrote:> I am trying to upload a 432 KB exe file to a column in mysql that is
> type blob . It can upload pdfs and rtfs and docs and but when I try to
> upload even a jpg which is barely 184 kb it gives the error (data too
> long) why is that? (detailed error in file) :
>
> 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 viahttp://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
...Sorry, that should have been :limit => (not :size) On Jun 25, 6:42 pm, Ather Shiraz <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> I am trying to upload a 432 KB exe file to a column in mysql that is > type blob . It can upload pdfs and rtfs and docs and but when I try to > upload even a jpg which is barely 184 kb it gives the error (data too > long) why is that? (detailed error in file) : > > 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 viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Mr. Kramer,
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...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
On Mon, Jul 7, 2008 at 11:47 AM, Ather Shiraz <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> 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.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hassan Schroeder wrote:> On Mon, Jul 7, 2008 at 11:47 AM, Ather Shiraz > <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote: > >> 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.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.orgWhere 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 -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Ather Shiraz wrote:> I am trying to upload a 432 KB exe file to a column in mysql that is > type blob . It can upload pdfs and rtfs and docs and but when I try to > upload even a jpg which is barely 184 kb it gives the error (data too > long) why is that?Look the /db/schema.rb file. Maybe your camp is defined as string. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---