There is an insert code in the database:

procedure TQueryThread.Execute; begin FMyConn := TMyConnection.Create(nil); FMyConn.Server := IniParams.pServer; FMyConn.Port := StrToInt(IniParams.pPort); FMyConn.Database := IniParams.pDatabase; FMyConn.Username := 'address'; FMyConn.Password := 'xxx'; FMyConn.Connected := true; qFileBlob := TMyQuery.Create(nil); qFileBlob.Connection := FMyConn; qFileBlob.SQL.Clear; qFileBlob.SQL.Add('INSERT INTO attachment (address_id,file_blob,create_date,file_name,file_extension,description) values (:pAddressID,:pFileBlob,:pCreateDate,:pFileName,:pFileExtension,:pDescription)'); qFileBlob.ParamByName('pAddressID').AsInteger := FAddressID; qFileBlob.ParamByName('pFileBlob').LoadFromFile(FName, ftBlob); qFileBlob.ParamByName('pCreateDate').AsDate := FCreateDate; qFileBlob.ParamByName('pFileName').AsString := ExtractFileName(FName); qFileBlob.ParamByName('pFileExtension').AsString := ExtractFileExt(FName); qFileBlob.ParamByName('pDescription').AsString := FDescription; qFileBlob.Execute; Synchronize(DisplayMessage); end; 

The bottom line is that when you try to insert more than 16MB files into the database outside the local network, we get the error:

Error inserting MySQL fields into Blob table

This error is absent when inserting Blob fields within the local network, regardless of the size of the inserted file.

At the time of the error we have:

  SHOW VARIABLES LIKE 'max_allowed_packet' mysql> show variables like "max_allowed_pa -> ; +--------------------+-----------+ | Variable_name | Value | +--------------------+-----------+ | max_allowed_packet | 524288000 | +--------------------+-----------+ 

What could be the problem?

    1 answer 1

    Your problem is in the max_allowed_packet option which, in your case, is set to 16 MB. If you need to insert larger blobs, change the server settings:

     [mysqld] max_allowed_packet=64M 

    The upper limit is 1GB.

      Protected by a community spirit ♦ Feb 6 'at 6:46 .

      Thank you for your interest in this issue. Since he collected a large number of low-quality and spam responses, which had to be deleted, now it’s necessary to have 10 reputation points on the site (the bonus for account association is not counted ).

      Maybe you want to answer one of the unanswered questions ?