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

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!!

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

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

No because you’ve not shown us any code…it might just help a little… :slight_smile:

regards
Seán

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. :confused: