Subscribe for automatic updates: RSS icon RSS

Login icon Sign in for full access | Help icon Help
Advanced search

Pages: [1]
  Reply  |  Print  
Author Topic: Mange PDF in Informix-Database SBLOB  (Read 9692 times)
Stefan S.
Posts: 90


« on: February 15, 2019, 01:16:51 pm »

Hello,

forour DMS we think about using SBLOB to storage the PDF (and jpg) in the Database.
Has anyone experience with it?

What about Performace, or display a PDF/jpg from direct from the Database to GDC.

Any tip is welcome

Have a nice weekend

Stefan.

Roland W.
Posts: 22


« Reply #1 on: February 18, 2019, 08:29:41 am »

Hi Stefan,

we've been using this for quite some time now and it works fine. We haven't noticed any performance problems. The only thing which is a bit annoying is the fact that you're not able to define a table which contains a (S)BLOB-datatype with the "record like" statement. The handling of this datatyes is a bit trickier as with "normal" datatypes.
Basically for reading BLOBs we use this kind of code:

Code
  1. define l_filename varchar(254)
  2.  
  3. select lotofile(table.data, l_filename || "!", "client")
  4. from table
  5.  

this one's fo insert

Code
  1. insert into table (data) values (filetoblob(l_filename, "client")

and this for update

Code
  1. update table set data = filetoblob(l_filename, "client")

after getting the BLOB from the table you can just use a
Code
  1. display by name l_filename
to a FFImage-Widget to show the contents of a PDF or JPEG-image.

For further documentation how to handle BLOBs in SQL see here: https://www.ibm.com/support/knowledgecenter/SSGU8G_12.1.0/com.ibm.sqls.doc/ids_sqs_1526.htm.

Please contact me if you still need more help or sample code snippets.

Regards
Roland
Snorri B.
Posts: 104


« Reply #2 on: March 08, 2019, 12:57:08 pm »

Stefan, Roland.

We have been doing this for a while as well and have the same  experience as Roland has.

However, we are questioning the advantages of using a Smart Blob rather than the legacy BYTE datatype. BYTE is supported in Genero directly and you can can define record like table variables.

Why not use BYTE? You don't need random access to the blobs, you can create them in blobspaces (or have them in the tablespace).

Best regards,
-Snorri
Roland W.
Posts: 22


« Reply #3 on: March 08, 2019, 04:08:27 pm »

Hi Snorri,

regardless of the fact that Smart Blobs offer some advantages as described here https://www.ibm.com/support/knowledgecenter/SSGU8G_12.1.0/com.ibm.admin.doc/ids_admin_0492.htm, I think the main reason for using Smart Blobs is, that you can easily access them via the FILETOBLOB or LOTOFILE statements https://www.ibm.com/support/knowledgecenter/SSGU8G_12.1.0/com.ibm.sqls.doc/ids_sqs_1525.htm. We use these functions not only within Genero but also in some shell scripts to unload the contents of PDF- and imagefiles into the server's filesystem.

From my understanding there have been also problems with IDS installations using replication as simple blobs were not fully supported when using logging as mentioned in this thread http://www.databaseteam.org/6-informix/edd9d4f78109041a.htm. In Post #6 Madison Prue states:
Quote
An explaination is in order....

As many of you know, blobspace blobs are not logged. But ER has always been able to replicate blobspace
blobs as long as the table containing the blobspace blob is logged.  What we do is to read the blobspace
blob directly when transmitting the row to the remote site.  So even though the blobspace blob is not
logged, we still can replicate it via ER.  However, HDR can only replicate blobs that are in a
tablespace.

So I think with Smart Blobs you're more flexible than with the TEXT/BYTE datatypes although they're not fully supported by Genero.

Kind regards
Roland
Sebastien F.
Four Js
Posts: 545


« Reply #4 on: March 08, 2019, 04:55:51 pm »

Hi all,

Genero uses Informix ESQL/C to connect to Informix DBs.

Informix ESQL/C is able to do simple data type conversions (you can fetch a VARCHAR column value representing a number into a DECIMAL, or insert a DECIMAL into a VARCHAR column)

If Informix ESQL/C would support the conversion of BLOB/CLOB to/from TEXT/BYTE locators (see locator.h ESQL/C header), then you could directly do this:

Code
  1. DEFINE b BYTE
  2. LOCATE b IN FILE "image.png"
  3. INSERT INTO tab (blob_col) VALUES (b)
  4. SELECT blob_col INTO b FROM ...
  5.  

CLOB/BLOB support in Genero is registered as FGL-3406 ...

Seb
Pages: [1]
  Reply  |  Print  
 
Jump to:  

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines