There are certain situations where anyone would like to store images, audio or other multimedia objects in database, then it could be stored in DB using BLOB data type. Or can store data in Character Large Object (CLOB) data type that is a collection of character data in a database management system, usually stored in a separate location that is referenced in the table itself.
Adeptia supports CLOB/BLOB data and by the help of this forum post one can use BLOB/CLOB data type at Source/Target end.
CLOB data type will be automatically handled in Data mapping you just need to use those fields in the Schema hierarchy.
BLOB data type (images,videos,music file etc.) will be handled using the methods defined in the Utility classes.
BLOB as Source:
If we are taking Database as Source and Text as File Target then we can handle the BLOB data by using the "decodeFileAsBase64()" method of Base64Utility class. If it is not present in Global Methods then method can be added by uploading the custom class by following the below steps.
This method will take two parameters, first parameter for 'File Location' and second parameter for incoming 'Data' from DB Source.
Steps to upload Decode class file
- Download attached Base64Utility.class.
- Place this file inside ".\AdeptiaServer\ServerKernel\customClasses".
- Restart Adeptia Services and Reopen the Data Mapper Applet.
BLOB as Target:
If we are using Excel as File Source and Database as Target then we can convert the incoming data from Source to Base 64 by using the "encodeFileAsBase64()" method under MapperUtilityClass in the Data mapping. This method will take one parameter where the 'File Location' have to be defined. We can use the Context variable in the Process flow to pass the Source file path as defined below in the screen shots.
Note: In the Context variable properties we have used the attached Sample.xls and gave the .\Solutions location of the file, Client can change the filePath as per this requirement.