Discussion
WELLSFARGO
Last activity: 29 Jun 2017 12:13 EDT
Retrieval of clob data into prpc
How to retrieve data from a CLOB column in external table into PRPC variable.I have used to_char(clob column), this is retrieving but if the data is greater than 4000, I am getting errors.
-
Like (0)
-
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
Updated: 23 Apr 2015 15:19 EDT
Pegasystems Inc.
US
Although CLOBs are not supported by PRPC, notes and the associated articles from the PRPC Help System:
SQL connectors cannot process columns of data type ARRAY
, IMAGE
, or CLOB
(Character Large Object).
Although CLOBs are not supported by PRPC, notes and the associated articles from the PRPC Help System:
SQL connectors cannot process columns of data type ARRAY
, IMAGE
, or CLOB
(Character Large Object).
https://pdn.pega.com/sites/pdn.pega.com/files/help_v62/procomhelpmain.htm#rule-/rule-connect-/rule-connect-sql/related.htm
https://pdn.pega.com/sites/pdn.pega.com/files/help_v62/procomhelpmain.htm#rule-/rule-connect-/rule-connect-sql/sqlguidelineshtm.htm
I was able to search the Support Portal and found this and thought it might prove helpful:
The following is a workaround that uses the java code (invoked from an activity) to retrieve the clob data and gets past the 4K limitation. The database ( Data-Admin-DB-Name ) is configured to connect using a JDBC url.
try
{
HashStringMap keysMap = new HashStringMap();
keysMap.put("pyRWDatabase","PMLandingTable");
keysMap.put("pxObjClass","Data-Admin-DB-Name");
ClipboardPage dbPage = tools.getDatabase().open(keysMap,false);
java.sql.Connection Conn = java.sql.DriverManager.getConnection(dbPage.getString("pyDatabaseURL"),dbPage.getString("pyDBUser"),dbPage.getString("pyDBPassword"));
java.sql.PreparedStatement cs= Conn.prepareStatement("select RECORD_UID, CUST_INC_STMNT from SERVICE_RECORD_LANDING_FINAL where RECORD_UID = 1038");
java.sql.ResultSet result = cs.executeQuery();
if (result.next()) {
String id = result.getString(1); // the uid
java.sql.Clob clb = result.getClob(2); // the blob
int clobLength = (int) clb.length();
StringBuilder sb = new StringBuilder();
java.io.Reader reader = clb.getCharacterStream();
java.io.BufferedReader br = new java.io.BufferedReader(reader);
String clobData;
while(null != (clobData = br.readLine())) {
sb.append(clobData);
}
String prntString = sb.toString();
br.close();
clb.free();
}
else
{
oLog.error("No Id found ");
}
//Cleanup DB resourses
result.close();
cs.close();
Conn.close();
} catch (Exception e){
oLog.error("Exception encountered" + e);
e.printStackTrace();
}
Hope this helps,
Sean
Pega Academy
WELLSFARGO
Thank You Sean!!! I will give a try with this code and I will let you know whether I am able to acheive or not.
WELLSFARGO
The code is working perfectly if i am hardcoding the connection details, In our application we don't have the Database instance defined.The connection is established through configuration preferences defined in the prconfig file like java:comp/env/jdbc/PegaRULES.Could you please help me out, how to establish the connection through pega which returns the java object,so that i can make use of this object to prepare the statement and execute the query.Thanks for your help!!!
.
Pegasystems Inc.
US
I am glad that the code is working out however don't know if I understand your question. I haven't had the opportunity to work with Java Objects in Pega. Perhaps you might submit a service request using the My Support Portal. Hope they will be able to better assist you.
Regards,
Sean
Pega Academy
WELLSFARGO
Thank You Sean..I was able to establish the connection through datasource defined in prconfig file.Once again Thanks for your help!!!
Wipro Ltd
AU
Hi All,
I am using Pega 7 and did not faced any issues while retrieving of clob data into prpc (using Obj-Open-By-Handle) where data is greater than 4000 characters.
seems like the issue is fixed in Pega 7
Maantic Inc
US
are you able get more than 4k data?
Cisco Systems
IN
I have an external table A with few CLOB columns. I wanted to created a database table rule that maps the class containing these properties to this table.Unfortunately the properties are of type text and the columns are CLOB. So when i do test connectivity it gives an error saying that CLOB is unsupportable. In the same scenario, i am not sure how BIX framework works?. In order to avoid the bix we wanted to use direct obj- save for an external table. The class as all the necessary keys defined.