Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Image files into BLOB

Hello,
I have a list of jpg files I need to put in BLOB fields.
The name of the file corresponds to the ID of the datas to which the images owned. So I need to get the name of the jpg file, to compare it to the ID in the database and then to set the jpg file contains for the ID in the database.
I have written this job, but I have the following error (see attached files).
I think it's coming from the settings 'File Name' of the tFileInputDelimited_3.
Is the way of my job correct or am I totally wrong?
How can I do that?
Thanks
I use TOS 3.0.4
Labels (2)
12 Replies
Anonymous
Not applicable
Author

I have some news :
I have to modify the file TOS-All-r24830-V3.1.1\plugins\org.talend.designer.components.localprovider_3.1.1.r24830\components\templates\db_output_bulk.skeleton around line 755 because it uses setBLOB which isnt valid
If try to just rename it to setBlob then the generated code is :
pstmt_tOracleOutput_1.setBlob(39,(oracle.sql.BLOB) dict_info.DICTFR_PIECE_JOINTE);

then i got this problem :
Exception in component tOracleOutput_1
java.lang.ClassCastException: ) dict_info.DICTFR_PIECE_JOINTE),((byte[])dict_info.DICTFR_PIECE_JOINTE).length);

and I got this error :
Exception in component tOracleOutput_1
java.sql.SQLException: Connexion interrompue
at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:70)
at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:133)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:199)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:263)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:271)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:445)
at oracle.jdbc.driver.PhysicalConnection.prepareStatement(PhysicalConnection.java:3127)
at oracle.jdbc.driver.PhysicalConnection.prepareStatement(PhysicalConnection.java:3042)
at dict.test_0_1.test.tFileList_1Process(test.java:3734)
at dict.test_0_1.test.tOracleConnection_1Process(test.java:369)
at dict.test_0_1.test.runJobInTOS(test.java:6458)
at dict.test_0_1.test.main(test.java:6359)

but this time the row is inserted in oracle and i'm able to get the pdf with oracle sqldevelopper.
Anonymous
Not applicable
Author

Hello
java.sql.SQLException: Connexion interrompue

The previous connection haven't been closed when you iterate the next file and create a new connection. Generally, you are required to use a tOracleCommit to close the connection after the job.
Add a tOracleCommit after tOracleOutput,
.........tOracleOutput--OnComponentOK-->tOracleCommit
Best regards

shong
Anonymous
Not applicable
Author

thx a lot, it now works !