Problem writing long file to DB

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Venevtsev
Posts: 2
Joined: Mon 14 Jan 2008 12:36

Problem writing long file to DB

Post by Venevtsev » Mon 14 Jan 2008 13:19

Hello. I have problems with writing big files to DB.
In Delphi 2006 I have exception "Lost connection to MySQL server during query". Big files - files about 1 MB and bigger.
I use LongBlob field, lates MyDAC components, DB is installed on localhost.

eduardosic
Posts: 387
Joined: Fri 18 Nov 2005 00:26
Location: Brazil

Re: Problem writing long file to DB

Post by eduardosic » Mon 14 Jan 2008 19:30

Venevtsev wrote:Hello. I have problems with writing big files to DB.
In Delphi 2006 I have exception "Lost connection to MySQL server during query". Big files - files about 1 MB and bigger.
I use LongBlob field, lates MyDAC components, DB is installed on localhost.
Lost Connections have several causes,

check the MySQL variables in my.ini

max_allowed_packet << very important

and

connect_timeout
interactive_timeout
wait_timeout
net_read_timeout
net_write_timeout
slave_net_timeout
max_connections
max_user_connections

Reads help of mysql to know more on the variable's

Antaeus
Posts: 2098
Joined: Tue 14 Feb 2006 10:14

Post by Antaeus » Tue 15 Jan 2008 15:44

It looks like the problem with the max_allowed_packet parameter of MySQL.
Try to set max_allowed_packet to a value that is greater than size of your file.
Just add the following line to the [mysqld] section of my.ini and restart the server:

Code: Select all

  max_allowed_packet = 16M 

Venevtsev
Posts: 2
Joined: Mon 14 Jan 2008 12:36

Post by Venevtsev » Wed 16 Jan 2008 08:13

Thanks a lot!

Post Reply