Right, DI does not support blobs at this time.
You have another solution for doing that:
First of all you need such procedure onto your Oracle Schema :
–BEGIN–
/---------------------------------------/
/* Read a blob from a file, and write /
/ it to the database. /
/---------------------------------------*/
create or replace directory image_dir as ‘/apps/temp/images’ ;
create or replace procedure proc_imp_jpg
(fname1 in varchar2, image_id1 in numeric) is
file1 bfile ;
lblob blob ;
len int ;
e_blob blob ;
begin
file1 := bfilename(‘IMAGE_DIR’,fname1);
e_blob := empty_blob();
insert into image_test (image_id, image_data)
values (image_id1, e_blob )
returning image_data into lblob ;
dbms_lob.fileopen(file1);
len := dbms_lob.getlength(file1) ;
dbms_lob.loadfromfile(lblob,file1,len);
dbms_lob.filecloseall();
commit;
exception
when others then
begin
dbms_output.put_line(sqlerrm);
dbms_lob.filecloseall();
commit;
end;
end ;
/
–END–
The it will depend on your OS platform:
You need to list all files that are present in the import directory:
So, do something like $DI_VARIABLE = exec(‘cat’, ‘/var/pdfimport/’, 4); if you’re on Unix or exec(‘cmd.exe’, ‘dir C:\temp\pdfimport’, 4); on Windows.
The you’ll have a variable containing the list of the files from your directory (not all, just what can fit in your variable size) (separated by spaces, unfortunatly) [I solved this using a perl] [You can also do using bat : FOR %i IN C:\temp\pdfimport\ ECHO %i ;]
You put that line at top of your DI job in a Script object;
Then a While where condition is that $DI_VARIABLE length() is > 0.
Inside the while you extract first file name getting position of the first delimiter etc.
You put this file in a $CURRENT_FILE variable and use it in a dummy datatflow placed inside the while.
Row Generation : 1 Row,
Query that maps generated column to a DUMMY field that will be mapped as sql(‘MyDATASTORE’, ‘call proc_imp_jpg(’’ || $CURRENT_FILE || ‘’,101)’),
that all to a dummy file format for closing the flow.
That’s up to me the most DI usage you can do in such processing.
I suggest you to just use DI Scheduler to run PL/SQL procedure that will list, iterate and load your files.
Hope can help,
Hervé.
dataintegrator.net (BOB member since 2006-01-12)