MySQL Forums
Forum List  »  Delphi

Pass file to Blob param Stored Procedure
Posted by: sher khan
Date: July 26, 2010 02:00AM

Hi,
How do i rad a file like Jpg, some binary file and pass the data from delphi to mysql stored procedure?


I m using MySQLDAC to connect to database.

This is how my procedure looks like

CREATE PROCEDURE `testBlob`(IN `ID` VARCHAR(20), IN `photo` BLOB)
LANGUAGE SQL
NOT DETERMINISTIC
MODIFIES SQL DATA
SQL SECURITY DEFINER
COMMENT ''
BEGIN
INSERT INTO testProcBLOB values (ID, photo);
END

Delphi Code

try
if not mySQLDatabase1.Connected then
begin
ShowMessage('Please connect to database first!');
exit;
end;

if mySQLStoredProc3.Active then
mySQLStoredProc3.Close();

mySQLStoredProc3.Params.Clear;
mySQLStoredProc3.procedureName:='testBlob';
mySQLStoredProc3.ParamByName('ID').Value := '00000'+ TimeToStr(Now());
mySQLStoredProc3.ParamByName('photo').LoadFromFile(ExtractFilePath(ParamStr(0))+('NewImage.jpg'),ftBlob);
mySQLStoredProc3.ExecProc;

When i try to execute this program, i always get an error saying u have syntax error in ur mysql statement.

Thanks,
Ajay.

Options: ReplyQuote


Subject
Written By
Posted
Pass file to Blob param Stored Procedure
July 26, 2010 02:00AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.