0

Can anyone post a sample soci code-cut to Insert and Fetch BLOB to a table in db2 with version 11.1 ?

The following Statement working fine in DB2 v10.5 through soci, but not in DB2 v11.1.

statement Stmt = (sql->prepare<<"INSERT INTO TABLE_BLOB (COL1) VALUES (BLOB(:host_variable)), use(host_variable)) ;

where host_variable is a local variable of unsigned char type and COL1 is a column in table TABLE_BLOB of blob datatype.

Error that I am getting in DB2 v11.1 is:

Statement execution error SQLMESSAGE: [IBM][CLI Driver][DB2/LINUXX8664] SQL0440N No authorized routine named "BLOB" of type "FUNCTION" having compatible arguments was found. SQLSTATE=42884

SOCI Version : 3.2.2 Linux : RHEL 7.3 (64 Bit)

MWiesner
  • 8,868
  • 11
  • 36
  • 70
Yusuf
  • 11
  • 1
  • The `BLOB()` function expects a string (character or binary) data type; I guess SOCI data type mapping produces something else. You could try `...VALUES ( BLOB ( CAST (:host_var AS VARCHAR(xxx) FOR BIT DATA ) ) )` – mustaccio Jun 08 '17 at 14:47
  • My doubt is, how it is working in db2 version 10.5 ? I didnt find any difference between 11.1 and 10.5 blob function in IBM docs. – Yusuf Jun 08 '17 at 16:00

0 Answers0