Mysql::Error: Data too long for column

R

rabarama

Pleas i need help:
I'm deploying a ror application in a win server (apache + mongrel + mysql).
A model has a binary field.

win2003 server
mysql 5.0.45 community ed
ruby 1.8.6

When i upload a file (very small) i obtain the "Data Too Long for column"
error.
The same code works perfectly with SQLite.
Where's the problem?
 
C

Charles Johnson

Pleas i need help:
I'm deploying a ror application in a win server (apache + mongrel +
mysql).
A model has a binary field.

win2003 server
mysql 5.0.45 community ed
ruby 1.8.6

When i upload a file (very small) i obtain the "Data Too Long for
column" error.
The same code works perfectly with SQLite.
Where's the problem?
Are you storing session information in the database? If so, one of the
columns (the data column IIRC) may not be large enough. This happens
with postgres.

Cheers--

Charles
 
H

Hassan Schroeder

I'm deploying a ror application in a win server (apache + mongrel + mysql).
A model has a binary field.
When i upload a file (very small) i obtain the "Data Too Long for column"
error.

So how big *exactly* is "very small" and what is the column definition?
 
H

Hassan Schroeder

"very small" is a 80Kb file, and the column is a "binary" field in the
schema that becames a BLOG column in mysql.

Last time I looked a MySQL BLOB field was 64k. Hmm. 80k, 64k --
you might want to take a look at that discrepancy :)
 
I

Iñaki Baz Castillo

El Mi=E9rcoles, 9 de Diciembre de 2009, Hassan Schroeder escribi=F3:
=20
Last time I looked a MySQL BLOB field was 64k. Hmm. 80k, 64k --
you might want to take a look at that discrepancy :)

Yes, better using MEDIUMBLOB.=20


=2D-=20
I=F1aki Baz Castillo <[email protected]>
 
M

Marnen Laibow-Koser

rabarama said:
probably, this is the problem, tomorrow I'll try with mediumblog.
Thanks a lot.

Better to use the filesystem. Sizable binaries in the DB are not a good
idea.

Best,
-- 
Marnen Laibow-Koser
http://www.marnen.org
(e-mail address removed)
 
S

Steve Wilhelm

Marnen said:
Better to use the filesystem. Sizable binaries in the DB are not a good
idea.

Best,
-- 
Marnen Laibow-Koser
http://www.marnen.org
(e-mail address removed)

I think its more accurate to say mixing meta and binary data in the same
MySQL table is not a good idea.

Storing binary data in a separate table (and even database) from meta
data minimizes the binary data's performance impact and allows one to
use MySQL to manage referential integrity across the meta and binary
data.
 
R

rabarama

I confirm!
That was the problem, now it works.
Thanks a lot for solution and suggestions.
 
M

Marnen Laibow-Koser

Steve said:
I think its more accurate to say mixing meta and binary data in the same
MySQL table is not a good idea.

Storing binary data in a separate table (and even database) from meta
data minimizes the binary data's performance impact and allows one to
use MySQL to manage referential integrity across the meta and binary
data.

As far as I can see, the only advantage of storing binarie in RB tables
is to be able to store them with their metadata. If you split them into
their own table, then you're just reinventing a filesystem on top of the
existing filesystem.

In other words, if you use binary fields, you will either have
performance problems or an abstraction inversion. Just don't.

Best,
-- 
Marnen Laibow-Koser
http://www.marnen.org
(e-mail address removed)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top