1

I would like to model a simple "name->blob" structure to be used from Java using jt400.jar (essentially to store large, unchanging files inside the database instead of in the IFS) which is easily done with a

CREATE TABLE TRATEST/X (NAME VARCHAR (256 ) NOT NULL WITH
DEFAULT, BLOB BLOB NOT NULL WITH DEFAULT, BLOBPART INT NOT NULL 
WITH DEFAULT)                                                   

(verbosity due to F4 usage) which creates a file X looking like I want it to.

Now for logistic reasons I would like to have several members (like A, B and C) in X, each modelling its own file set, but I cannot run ADDPFM as I get the error that there are more members than maximum allowed, and I cannot run CFGPF FILE(tratest/x) MAXMBRS(*nomax) as it reports the value not to be valid. Some further reading on CPD3213 indicates that this is because the file was created as a SQL table.

Is there a way to get what I want - a file with a blob field and several (EDIT: specifically named) members which I can access from Java?

Thorbjørn Ravn Andersen
  • 73,784
  • 33
  • 194
  • 347
  • What reason makes you think you should use members? – WarrenT Dec 03 '12 at 11:50
  • Logistical reasons and easy usage from CL. I want to group all blobs for a single deployment in a single member. – Thorbjørn Ravn Andersen Dec 03 '12 at 11:55
  • Easy to use from CL, maybe, but a pain to deal with in SQL - at minimum, you have to use dynamic SQL to access them (to create the `ALIAS`), and you have to know which one to go after to begin with (which means you'd need a lookup table, implicit or explicit). And unless you want to create the `ALIAS`es permanently, you don't want concurrent processes stomping on each other, which generally means `QTEMP` - but I'm not sure how the driver would react to that (if it would consider the connection 'closed', and clear out the folder). – Clockwork-Muse Dec 03 '12 at 17:18
  • @Clockwork-Muse When set up this will only be used from CL and Java, where I will have 100% control over the SQL generated. Another approach might be to go through /QSYS... Question is whether I _can_ have members in a file with a blob? – Thorbjørn Ravn Andersen Dec 03 '12 at 18:30

1 Answers1

2

SQL tables do not support physical file members in the normal sense but partitioning is an option.

Alternately you could create the file using DDS and still access it via SQL. However you will not be able to add SQL specific field types, including BLOB, to the file.

It's probably more efficient to store the path to the stream files in a table, store the actual blobs as stream files in the IFS, and access them with the integrated file system classes.

Stephen C
  • 698,415
  • 94
  • 811
  • 1,216
James Allman
  • 40,573
  • 11
  • 57
  • 70