Get information from a SQL Data Base and insert it into Bonita h2 DataBase automatically

1
0
-1

Hi everyone, what i need to do is to get information from an external Data base in SQL and with an atuomatic Task, get that info and insert it in bonita h2 data base.

This is what i have:

SQL EXPRESS 2008 Data Base:
Table Imports

Id int
Description varchar(50)
Status int

Bonita h2
ImportsBO

Id INTEGER
Description STRING
Status INTEGER

I create an automatic task that runs a connector to the SQL getting the information and insterting it in a ProcessVariable of type ImportsBO, but when i run a query to ImportsBO, it comes empty.

Any idea?

Many Thanks!!

Comments

Submitted by Sean McP on Sat, 02/27/2016 - 15:50

No because you've not shown us any code...it might just help a little... :)

regards
Seán

Submitted by pabloal257 on Mon, 02/29/2016 - 16:15

There is no Code. The only thing that i have is an automatic task that access to an SQL Data Base using a connector. This connector, fills a Process Variable. And now, i want to save that information into the Bonita Data Base.
The problem here is that i know how to do it using a Human task, cause you use the contracts, but with an automatic Task, i cant use contracts.

I dont know how to do this. :/

2 answers

1
+1
-1
This one is the BEST answer!

I think what you need is:

On the SQL Connector in the dialog box "Output Operations" select Scripting Mode.

Click Next
Click the Pencil
Select Script
Change the return type to Boolean // just because

add a piece of Groovy to do something like the following (not complete, not tested):

import myBDM;

while(resultset.next()){

myBDM newBDO = new myBDM();
newBDO.setId = resultset.getInt("Id");
newBDO.setDescription = resultset.getString("Description");
newBDO.setStatus = resultset.getint("Status");

}

return true;

regards
Seán

PS: If this reply answers your question, please mark a resolved

1
0
-1

Where to get the resultSet?
Can we write the query in script editor? How to execute that query?

P.S: can't write at this moment

Notifications