dbTalk Databases Forums  

BLOB FILES ERRORS

mailing.database.myodbc mailing.database.myodbc


Discuss BLOB FILES ERRORS in the mailing.database.myodbc forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
jose nuno neto
 
Posts: n/a

Default BLOB FILES ERRORS - 08-11-2005 , 04:56 AM






Hi,

I'm trying to use MySQL Blob columns to store files (docs,gifs,pdf.....) but
I'm getting corrupted files from the DB.

the applications runs php, loading file content with addslashes but in order
to spot the error i've tried it with mysql only like this:
column file is a MEDIUMBLOB
INSERT INTO XXXXXX SET file=LOAD_FILE("/tmp/teste.pdf");
and them
SELECT file INTO OUTFILE "/tmp/teste_frommysql.pdf" FROM XXXXXX WHERE id=12;

and teste_frommysql.pdf cant be loaded
ls -l shoes that the sizes are different:
270713 Aug 2 11:28 /tmp/teste.pdf (ORIGINAL)
277405 Aug 10 17:21 /tmp/teste_frommysql.pdf

I've made a test with a text file and noticed that the file from MySQL has a
added LineBreak at the end.Is thta the problem? how can I fix this?

This is my config:
Linux 2.6.11-1.1369_FC4
mysql-server-4.1.11-2
mysql-4.1.11-2

cat /etc/my.cnf
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock

[mysql.server]
user=mysql
basedir=/var/lib

[safe_mysqld]
err-log=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

key_buffer_size=64M
table_cache=256
sort_buffer_size=4M
read_buffer_size=1M

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=m...ie.nctu.edu.tw


Reply With Quote
  #2  
Old   
Gleb Paharenko
 
Posts: n/a

Default Re: BLOB FILES ERRORS - 08-11-2005 , 06:50 AM






Hello.

Use DUMPFILE instead of OUTFILE. See:
http://dev.mysql.com/doc/mysql/en/select.html


jose nuno neto <jose.neto (AT) liber4e (DOT) com> wrote:
Quote:
Hi,

I'm trying to use MySQL Blob columns to store files (docs,gifs,pdf.....) but
I'm getting corrupted files from the DB.

the applications runs php, loading file content with addslashes but in order
to spot the error i've tried it with mysql only like this:
column file is a MEDIUMBLOB
INSERT INTO XXXXXX SET file=LOAD_FILE("/tmp/teste.pdf");
and them
SELECT file INTO OUTFILE "/tmp/teste_frommysql.pdf" FROM XXXXXX WHERE id=12;

and teste_frommysql.pdf cant be loaded
ls -l shoes that the sizes are different:
270713 Aug 2 11:28 /tmp/teste.pdf (ORIGINAL)
277405 Aug 10 17:21 /tmp/teste_frommysql.pdf

I've made a test with a text file and noticed that the file from MySQL has a
added LineBreak at the end.Is thta the problem? how can I fix this?

This is my config:
Linux 2.6.11-1.1369_FC4
mysql-server-4.1.11-2
mysql-4.1.11-2

cat /etc/my.cnf
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock

[mysql.server]
user=mysql
basedir=/var/lib

[safe_mysqld]
err-log=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

key_buffer_size=64M
table_cache=256
sort_buffer_size=4M
read_buffer_size=1M


--
For technical support contracts, goto https://order.mysql.com/?ref=ensita
This email is sponsored by Ensita.NET http://www.ensita.net/
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Gleb Paharenko
/ /|_/ / // /\ \/ /_/ / /__ Gleb.Paharenko (AT) ensita (DOT) net
/_/ /_/\_, /___/\___\_\___/ MySQL AB / Ensita.NET
<___/ www.mysql.com




--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=m...ie.nctu.edu.tw



Reply With Quote
  #3  
Old   
Kemin Zhou
 
Posts: n/a

Default Re: BLOB FILES ERRORS - 08-11-2005 , 04:48 PM



--------------010701030804030106030809
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

Hi,
I remembered something when playing wiht BLOB. It looks that the select
statement does not
work well with BLOB. It always add or modify the BLOB a little bit.
Later I found out that
the client programming interfaces, perl,C++ etc tend to do well on BLOB
and files.

Kemin


Gleb Paharenko wrote:

Quote:
Hello.

Use DUMPFILE instead of OUTFILE. See:
http://dev.mysql.com/doc/mysql/en/select.html


jose nuno neto <jose.neto (AT) liber4e (DOT) com> wrote:


Hi,

I'm trying to use MySQL Blob columns to store files (docs,gifs,pdf.....) but
I'm getting corrupted files from the DB.

the applications runs php, loading file content with addslashes but in order
to spot the error i've tried it with mysql only like this:
column file is a MEDIUMBLOB
INSERT INTO XXXXXX SET file=LOAD_FILE("/tmp/teste.pdf");
and them
SELECT file INTO OUTFILE "/tmp/teste_frommysql.pdf" FROM XXXXXX WHERE id=12;

and teste_frommysql.pdf cant be loaded
ls -l shoes that the sizes are different:
270713 Aug 2 11:28 /tmp/teste.pdf (ORIGINAL)
277405 Aug 10 17:21 /tmp/teste_frommysql.pdf

I've made a test with a text file and noticed that the file from MySQL has a
added LineBreak at the end.Is thta the problem? how can I fix this?

This is my config:
Linux 2.6.11-1.1369_FC4
mysql-server-4.1.11-2
mysql-4.1.11-2

cat /etc/my.cnf
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock

[mysql.server]
user=mysql
basedir=/var/lib

[safe_mysqld]
err-log=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

key_buffer_size=64M
table_cache=256
sort_buffer_size=4M
read_buffer_size=1M







--------------010701030804030106030809--



Reply With Quote
  #4  
Old   
jose nuno neto
 
Posts: n/a

Default Re: BLOB FILES ERRORS - 08-12-2005 , 11:55 AM



Hi,
I've made it work with DUMPFILE but its a BIG workaround for my php
aplication:
To insert I have to read the file received from the browser $_FILES[tmp_name]
placed it in a directory for MySQL to read it, and them insert it into MySQL
table with LOAD_FILE

To extract I have to use DUMPFILE and the read the file back in to a php var
and them send it to the browser

It works but it does not ugly......

On Thursday 11 August 2005 22:47, Kemin Zhou wrote:
::: Hi,
::: I remembered something when playing wiht BLOB. It looks that the select
::: statement does not
::: work well with BLOB. It always add or modify the BLOB a little bit.
::: Later I found out that
::: the client programming interfaces, perl,C++ etc tend to do well on BLOB
::: and files.
:::
::: Kemin
:::
::: Gleb Paharenko wrote:
::: >Hello.
::: >
::: >Use DUMPFILE instead of OUTFILE. See:
::: > http://dev.mysql.com/doc/mysql/en/select.html
::: >
::: >jose nuno neto <jose.neto (AT) liber4e (DOT) com> wrote:
::: >>Hi,
::: >>
::: >>I'm trying to use MySQL Blob columns to store files
::: >> (docs,gifs,pdf.....) but I'm getting corrupted files from the DB.
::: >>
::: >>the applications runs php, loading file content with addslashes but in
::: >> order to spot the error i've tried it with mysql only like this:
::: >>column file is a MEDIUMBLOB
::: >>INSERT INTO XXXXXX SET file=LOAD_FILE("/tmp/teste.pdf");
::: >>and them
::: >>SELECT file INTO OUTFILE "/tmp/teste_frommysql.pdf" FROM XXXXXX WHERE
::: >> id=12;
::: >>
::: >>and teste_frommysql.pdf cant be loaded
::: >>ls -l shoes that the sizes are different:
::: >>270713 Aug 2 11:28 /tmp/teste.pdf (ORIGINAL)
::: >>277405 Aug 10 17:21 /tmp/teste_frommysql.pdf
::: >>
::: >>I've made a test with a text file and noticed that the file from MySQL
::: >> has a added LineBreak at the end.Is thta the problem? how can I fix
::: >> this?
::: >>
::: >>This is my config:
::: >>Linux 2.6.11-1.1369_FC4
::: >>mysql-server-4.1.11-2
::: >>mysql-4.1.11-2
::: >>
::: >>cat /etc/my.cnf
::: >>[mysqld]
::: >>datadir=/var/lib/mysql
::: >>socket=/var/lib/mysql/mysql.sock
::: >>
::: >>[mysql.server]
::: >>user=mysql
::: >>basedir=/var/lib
::: >>
::: >>[safe_mysqld]
::: >>err-log=/var/log/mysqld.log
::: >>pid-file=/var/run/mysqld/mysqld.pid
::: >>
::: >>key_buffer_size=64M
::: >>table_cache=256
::: >>sort_buffer_size=4M
::: >>read_buffer_size=1M

--

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=m...ie.nctu.edu.tw


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.