About the Author

Saturday, 23 March 2013

Database as storage for attachments


For those who want a secure and fast method to store attachment without creating an ftp server, db attachments will be a good option.

PeopleSoft allows you to store your attachments in database in a much efficient and faster manner. For those who are not exposed to db attachments, I can tell you that this is the easiest method you can try out for storing attachments. The advantage includes, the attachment will reside inside your database so when you are making a production copy of database for your support/testing team, you can retain the attachment without providing access to the ftp server or appserver file storage. The main disadvantage obliviously includes larger database size.

Let me explain how to create a db as file storage. First you need to create a record to store the attachments. When you create the record make sure that you include the sub record FILE_ATTDET_SBR. Make the record as db table type. You should never ever modify the FLIE_ATTDET_SBR. Now I can say you are almost done with the db storage creation. Now you only need to use the record as storage.

 


You can use it by providing the URL as record://RECORD_NAME where RECORD_NAME is the name of the record you have created earlier. With this you can do all the attachment functions, to store/retrieve/delete/copy attachments to/from database. PeopleSoft will internally take care of doing the attachments.

Eg:
/* The new record created is MY_ATTACHMENTS */
&retcode = AddAttachment(“record://MY_ATTACHMENTS”, ATTACHSYSFILENAME, "", ATTACHUSERFILE, 0);

Or

/* The URL MYFTP is configured with the URL record://MY_ATTACHMENTS */
&retcode = AddAttachment(URL.MYFTP, ATTACHSYSFILENAME, "", ATTACHUSERFILE, 0);


To re-iterate, the only two steps you need to do is creating a record with the delivered sub record and specifying the URL as mentioned above, where ever you 

3 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. Can you tell me the fields of the sub record. FILE_ATTDET_SBR. Problem is we dont have a ftp server and we dont want a ftp server. I want to get attachments from the teachers who are using the CMS. Please explain the fields of FILE_ATTDET_SBR. Thank you.

    ReplyDelete
    Replies
    1. The fields in the record store the file name in the system and actual file name

      Delete

Note: only a member of this blog may post a comment.