how to insert blob data into oracle xe from delphi 7 (ado component)
2 Answers
Check these samples using a TAdoQuery component.
loading the data directly from a file
ADOQuery1.Parameters.AddParameter.Name:='Param1';
ADOQuery1.Parameters.ParamByName('Param1').LoadFromFile('yourfilename',ftBlob);
ADOQuery1.SQL.Add('INSERT INTO TableName (FieldName) VALUES (:Param1)');
ADoQuery1.ExecSQL;
using a Stream to load the data
ADOQuery1.Parameters.AddParameter.Name:='Param1';
ADOQuery1.Parameters.ParamByName('Param1').LoadFromStream(AStream,ftBlob);
ADOQuery1.SQL.Add('INSERT INTO TableName (FieldName) VALUES (:Param1)');
ADoQuery1.ExecSQL;
you must be aware which the Microsoft Oracle oledb driver is not compatible with blob fields try instead using the Oracle OLEDB provider.
As final advice if you can, try using another components to connect to ORACLE like dbexpress, ANYDAC or the ODAC components
Comments
Be aware that Oracle has a peculiar way to handle LOBs. It uses "LOB locators" (a sort of handles) to perform operations on LOBs. An INSERT returns a LOB locator that is then used to fill the LOB, for example. That operation could be performed "behind the scenes" by the driver/library used to access Oracle, or may require some coding.