Problem with loading blob

Felix

Member²
I having a problem with loading a blob into a table using Borland C++ Builder 5. I am using Oracle 8.1.7

This is failing at the Loadit->Prepare() statement with the following message:

EOracleError with message 'ORA-01009: missing mandatory parameter'

Any idea what is wrong?

void __fastcall TForm1::Button1Click(TObject *Sender)
{
Graphics::TBitmap *tempbmp = new Graphics::TBitmap();
Oracle::TOracleDirectPathLoader *Loadit = new TOracleDirectPathLoader(this);
/*
CREATE TABLE dlr_area_ptrace (
2 session_id VARCHAR2(5),
3 system_id VARCHAR2(10),
4 ptrace BLOB
5 );
*/
long size;
OracleSession1->Connected = true;
tempbmp -> LoadFromFile("c:\\ptrace.bmp");

size = (tempbmp->Height * tempbmp->Width)/320;

Loadit->BufferSize = size * 1024;

ShowMessage(Loadit->BufferSize);

Loadit->TableName = "dlr_area_ptrace";
Loadit->Session = OracleSession1;
Loadit->GetDefaultColumns(true);

Loadit->Prepare();

char systemid[11];
char sessionid[6];

strcpy(systemid,"0000000234");
strcpy(sessionid,"1234");

Loadit->ColumnByName("session_id")->SetData(0,sessionid,4);
Loadit->ColumnByName("system_id")->SetData(0,systemid,10);
Loadit->ColumnByName("ptrace")->SetData(0,tempbmp,size);

Loadit->Load(0);
Loadit->Finish();
delete tempbmp;
delete Loadit;
OracleSession1->Connected = false;
}
//---------------------

------------------
Fair Bits...
Felix A. Hernandez
 
You need to define the maximum size of the BLOB, for example:

Loadit->GetDefaultColumns(true);
Loadit->ColumnsByName("ptrace")->DataSize := 4000;

------------------
Marco Kalter
Allround Automations
 
Loading into a long raw field instead of a blob, if we were going to load a
.bmp that is 680 X 342 pixels that is 697,734 bytes or 681 kb. What
settings would we use for the following?

1) BufferSize (let's add 20 characters for the other fields in addition to
the blob) (Loadit->BufferSize = ??; )
2) DataSize for the .bmp field (Loadit->ColumnByName("ptrace")->DataSize =
??
wink.gif

3) SetData size? (Loadit->ColumnByName("ptrace")->SetData(0,tempbmp,??)
wink.gif


I can't seem to find any information regarding the scale and/or settings for
these fields.

I tried loading a bitmap file into the LONG RAW column using the above method with different size values but when I export the bitmap using PL-SQL Developer it is not valid bitmap file. I have successfully loaded a bitmap into this column using PL-SQL Developer and was able to display the bitmap using a third party report writer.

Thanks
 
TOracleDirectPathLoader.BufferSize needs to be large enough to hold at least 1 row, but preferably more.

TDirectPathColumn.DataSize (for the LONG RAW column) needs to be large enough to contain the maximum size of the LONG RAW values (in your case, for example 700000).

The Size parameter of the TDirectPathColumn.SetData function needs to contain the exact size of the corresponding LONG RAW value.

------------------
Marco Kalter
Allround Automations
 
Back
Top