One Star

Extract Blob from Oracle

Hello,
i work in an oracle database and i want to extract pictures of client. This pics was encoded in Blob field.
I try to export in tfiledelimited, but it doesn't work because i have 275 clients.
I would like to know how i can create 275 jpg files and if it's possible rename pic with the id_cli (primary key)

regards
Dams
23 REPLIES
Seventeen Stars

Re: Extract Blob from Oracle

I am working on a tLOBDownload component. This component will accept a record set made by the tOracleRow component. In the tLOBDownload component you have to configure the columns you need for download the BLOB/CLOB and identify the LOBs (e.g. key fields or file names in the database).
You have to define the file name for the LOBs by the help of these fields.
The component iterates through the record set (actually a Java ResultSet) and writes all LOBs into files (one LOB has its own file).
Does this solution would fit also to your needs?
One Star

Re: Extract Blob from Oracle

hello,
thanks for your answer. That's exacltly that i would!
Seventeen Stars

Re: Extract Blob from Oracle

I have published this component. It would be great if you try it and provide feedback for it. If you experience any problems please contact me or post it in this forum. This component is tested only by me as developer and is only in usage in one project so far.
http://www.talendforge.org/exchange/index.php?eid=1135&product=tos&action=view&nav=1,1,1
One Star

Re: Extract Blob from Oracle

Jan,
it's working fine.
Thanks a lot
One Star

Re: Extract Blob from Oracle

Is this just for Oracle? or can it be used for MSSQL?

Re: Extract Blob from Oracle

please help to install complent in talend 5.5.1, don´t apear in pallete
Seventeen Stars

Re: Extract Blob from Oracle

Seventeen Stars

Re: Extract Blob from Oracle

The component tLOBDownload:
http://www.talendforge.org/exchange/index.php?eid=1277&product=tos&action=view
does not depend on Oracle. It works with every database which provides objects with the java.sql.Clob or java.sql.Blob interface.
One Star

Re: Extract Blob from Oracle

sorry, the component doesn't work for me...
context.pathWORKSPACE1 is the directory where I want to save the files
tjavarow_1  shows information only
no error, no files.... What happen? I'm running 5.4.1 on ubuntu linux.
thanks for your help.
-- 
One Star

Re: Extract Blob from Oracle

Ok, now works. It was my fault with the schema.
sorry about that.
Seventeen Stars

Re: Extract Blob from Oracle

Great to hear ;-)
Six Stars

Re: Extract Blob from Oracle

Hello,
I just downloaded this tLobdownload component and tried to use it.
I have a problem. I am wondering what data type I should put for the blob column. See the attached image. Thanks!
Seventeen Stars

Re: Extract Blob from Oracle

No please use as type Object. If you let the studio decide the type in this case it does not work.
Six Stars

Re: Extract Blob from Oracle

Thanks! It works fine now.
Seventeen Stars

Re: Extract Blob from Oracle

Great! Have a lot of fun... (This was for a couple of years ago the standard greeting of SuSE Linux ;-) 
Six Stars

Re: Extract Blob from Oracle

sorry, the component doesn't work for me...
context.pathWORKSPACE1 is the directory where I want to save the files
tjavarow_1  shows information only
no error, no files.... What happen? I'm running 5.4.1 on ubuntu linux.
thanks for your help.

logarda,
After I added a javarow in bewteen dbinput and tLOBDownload components, I got nothing saved in my output. No error. May I know how you solved the problem?
Thanks!
Seventeen Stars

Re: Extract Blob from Oracle

The tJavaRow does not connect the flows automatically. You have to synchronise the schema and click on Generate Code to get the Java code to transfer the values. After this you can add you own code or tweak the existing one.  
Six Stars

Re: Extract Blob from Oracle

Exactly! Thanks, jlolling!
Six Stars

Re: Extract Blob from Oracle

Hi jlolling,
If I want to process the output file from stream instead of saving it to a file, do you know if there is a way?
The workflow is like this: DBInput - tJavaRow - tFileInputExcel.
It is work fine if save the blob into a file and let tFileInputExcel read from a file. I am wondering if we can let tFileInputExcel directly read from stream.
Thanks!
Seventeen Stars

Re: Extract Blob from Oracle

The tLOBDownload component currently does not provide the access to the to stream directly. Normally LOBs are to large to process them directly in the job so I decided to save them to a file. For sure it would be possible to change this behaviour but this will take a bit time, I am heavy busy at the moment - sorry. 
Six Stars

Re: Extract Blob from Oracle

That is not a problem. Thanks, jlolling. It is really a good component.

Re: Extract Blob from Oracle

Hi jlolling,
I'm having below issue with the component :
Exception in component tLOBDownload_1
java.lang.Exception: Given object is not a Blob. It is of type:[B
at de.cimt.talendcomp.lob.download.LOBDownload.downloadLob(LOBDownload.java:136)

I'm using MySQL database with Talend Open Studio 6.1.1.
I crosschecked MySQL schema and column is a BLOB. I don't understand the issue.

Thanks for your feedback,
Mike

30MAR2016 # Solution found : issue come from that object returned is a byte array not a blob. I don't know why but I convert my byte array to a blob and it works.
One Star

Re: Extract Blob from Oracle

Hi jlolling,
I'm having below issue with the component :

Exception in component tLOBDownload_1
java.lang.Exception: Given object is not a Blob. It is of type:[B
Please help.