BOS 6.2.2 unable to serialize output from Progress Database

1
0
-1

I'm trying to connect a BOS 6.2. installation on a Windows 2008 R2 server via JDBC to Progress database using the following configuration

Driver: com.ddtek.jdbc.openedge.OpenEdgeDriver

URL: jdbc:datadirect:openedge://lwsv03dev02:30050;databasename=pinsys

Username: report

Password: ******

Query: SELECT TOP 10 "tran-code","td-stddescrn","rep-code","td-alias" FROM PUB.transdescrn

I was able to successfully connect and fetch data from Progrss databse using BOS 5.10.1. However, with BOS 6.2.2, it thows the following exception:

java.lang.reflect.InvocationTargetException

org.bonitasoft.engine.exception.BonitaRuntimeException: java.lang.ClassCastException: com.ddtek.jdbc.openedgebase.BaseResultSet40 cannot be cast to java.io.Serializable

I found similar issue discussed at http://community.bonitasoft.com/groups/installation-6x/problem-using-bos... and tried the script

// Use a List in order to be able to use it for dropdown list widget

List result = new ArrayList();

while(resultset.next()) {

int intValue = resultset.getInt(1);

result.add(String.valueOf(intValue));

}

return result;

so that BOS can serialize the output. However, the script retruned an error

java.lang.reflect.InvocationTargetException

org.bonitasoft.engine.bpm.connector.ConnectorExecutionException: org.bonitasoft.engine.core.operation.exception.SOperationExecutionException: org.bonitasoft.engine.expression.exception.SExpressionEvaluationException: Script throws an exceptionSExpressionImpl

I understand the connectivity is fine but seralizing output from Prgoress database is an issue in BOS 6.2.2. Can anyone please be able to provide with some help here?

Sumesh

Comments

Submitted by yhon.acurio on Wed, 02/26/2014 - 19:27

Hi, did you try by using Bonita-Tools library? You can transform your database connector using one of the methods.

Don't hesitate to suggest new methods.

Here the link: https://github.com/Bonitasoft-Community/Bonita-Tools

Cheers

1 answer

1
+2
-1

Hey,

Try to do something like this, adapt it:

My table:

Var1 Integer / var2 Char
1 a
2 b

Connector query : SELECT "var1", "var2" FROM "public"."tabletest"

Output script:

List result = new ArrayList();
while(resultset.next()) {

List sousListe = new ArrayList();
sousListe.add(resultset.getInt(1));
sousListe.add(resultset.getString(2));
result.add(sousListe)
}
return result;

The output when you test : [[1,a],[2,b]]

-----------------------------------------------------------------------------------------------------------------------------------------------------

You can use the tool provide by my collegue on the forum awnser : https://github.com/Bonitasoft-Community/Bonita-Tools in the build folder.
Import the new jar in the studio and attach it to your process and finaly use this methode in the output of the connector:
  • How to get a list of elements ready to use into a SELECT or LIST widget?

    List listElements = BonitaDBTools.toList(resultSet, "column name to be considerated as displayed LABEL")

or select StringValue1 from yourtable
List result = new ArrayList();
while(resultset.next()) {
List sousListe = new ArrayList();
sousListe.add(resultset.getString(1));
result.add(sousListe);
}
return result;
Or if you wouldlike to display in the dropdown box the StringValue1 and save the StringValue2 then you need to have something like or use the tool:
select StringValue1,StringValue2 from yourtable
  • How to get a map of elements ready to use into a SELECT widget?

    Map mapElements = BonitaDBTools.toKeyValueMap(resultSet, "column name to be considerated as KEY", "column name to be considerated as displayed LABEL")

or this script:
Map result = new HashMap();
while(resultset.next()) {
result.put(resultset.getString(1), resultset.getString(2));
//if it's not the right element who is display put the 2 in the first position and the 1 on the second position :result.put(resultset.getString(2), resultset.getString(1));
}

return result;
Be careful these scripts are specifics, the tool work everytime.

Comments

Submitted by sumeshkp on Wed, 02/26/2014 - 09:14

Hi Coucy,

Thanks for your response but the script thorws an error:

java.lang.reflect.InvocationTargetException org.bonitasoft.engine.bpm.connector.ConnectorExecutionException: org.bonitasoft.engine.core.operation.exception.SOperationExecutionException: org.bonitasoft.engine.expression.exception.SExpressionEvaluationException: Script throws an exceptionSExpressionImpl [name=convertedResult, content=// Use a List in order to be able to use it for dropdown list widget

//List result = new ArrayList();

List result = new ArrayList();

while(resultset.next()) {

List sousListe = new ArrayList();
sousListe.add(resultset.getInt(1));
sousListe.add(resultset.getString(2));
result.add(sousListe);

}

return result;, returnType=java.util.List, dependencies=[SExpressionImpl [name=resultset, content=resultset, returnType=java.sql.ResultSet, dependencies=[], expressionKind=ExpressionKind [interpreter=NONE, type=TYPE_INPUT]]], expressionKind=ExpressionKind [interpreter=GROOVY, type=TYPE_READ_ONLY_SCRIPT]]

Am I missing something here? I'm using Bonitasoft 6.2.2 Performance edition with TomCat Webserver and H2 DB on a 64-bit Windows 2007 Enterprise edition. I'm using openedge JDBC driver to connect to Progress database

Sumesh

Submitted by sumeshkp on Fri, 02/28/2014 - 09:11

Many thanks for your answers yhon and COUCY. I've resolved the issue using the following script

List result = new ArrayList(); while(resultset.next()) {

List sousListe = new ArrayList();
sousListe.add(resultset.getString(1));
sousListe.add(resultset.getString(2));
sousListe.add(resultset.getString(3));
sousListe.add(resultset.getString(4));
result.add(sousListe);

} return result;

My SQL query was SELECT TOP 10 "tran-code","td-stddescrn","rep-code","td-alias" FROM PUB.transdescrn and I had to convert all parameters to List.

And thanks to pointing out to the API. I've not tried them as yet.

Sumesh

Notifications