MySQL Conector use data

 

I'm using this code to take data from the database but does not work, I could help solve this problem of pulling data from the database and display it in a table please. I urgently as I have to implement it in my project and this delayed me a lot.

import java.sql.ResultSet;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Statement;

Connection con = DriverManager.getConnection("jdbc:mysql://200.0.113.167:3306/calidadenergia", "opc", "opc");
Statement stmt = con.createStatement(
    ResultSet.TYPE_SCROLL_INSENSITIVE,
    ResultSet.CONCUR_UPDATABLE);
ResultSet rs = stmt.executeQuery("SELECT Zona FROM subestacion");
return rs;

1 Like

Hi jhosimar8806,

Is your question about BonitaStudio? If so I don't understand how you want to use this piece of source code (which seems to be a 'pure' java code).

If not, may be your post is in the wrong forum.

Can you please give us more details?

Jérôme

If it comes on pretty studio, the code you want to use to put it after connecting to the database and I take the display information in a table but does not take any data, that I'm wrong or I could give an example of code to use in order to extract the information from the database and display it on a table to urge me porke'm doing a very ambitious project

Hi jhosimar8806,

I still have trouble understanding your needs in details. However, here is one of my company tutorials.

https://www.dropbox.com/s/w8e6r61mywsa2wp/BOS6.04%20-%20java%20code%20-%20table%20widget.pdf

The scenario:

  • We want to build a list of 'Items' using data stored in a MySQL DB then present this list in a BOS table widget

In this tutorial, the following topics are adressed:

  • Implementing a (simple) java classes in Eclipse
  • Import the java classes into BOS
  • Define the BOS DB connector
  • Transform the outcome of the DB query into a BOS table widget compatible format (using a groovy script)
  • Design the page (including the table widget)

 Prerequisites:

  • Basic (very basic) knowledge in Java/groovy coding language.
  • Basic knowledge in BOS 6x

Pityfuly, I can't publish the BOS/BAR file since it is an actual business application.

Since this doc is in a draft mode, should you (or anybody else) have constructive comments and suggestions, please let me know.

Regards,

Gé-

Hi Jhosimar,

I dont know exactly why you want to use that piece of code instead of a standard jdbc connector or vendor specific one, anyway I think that your problem is related to the return.

ResultSet doesnt implement Serializable, so you cant use it into your process as data. You have to convert to an Serializable Object like List.

 

i guess it helps you

If it comes on pretty studio, the code you want to use to put it after connecting to the database and I take the display information in a table but does not take any data, that I'm wrong or I could give an example of code to use in order to extract the information from the database and display it on a table to urge me porke'm doing a very ambitious project 

Thanks for the manual but I served because I’m, when I run the test connector tells me that if you connect to the database but will not let me extract information from it and urged me to extract information from the database for my project that used the above code but do not probe and everything and I still need your help urgently please. That resultset code I can use to extract and to show the information extracted from the database?

I am using this code:
List result = new ArrayList();
List subest = new ArrayList();

while(resultset.next()){
subest = new ArrayList();
subesta = resultset.getString(“IdSubestacion”);

}
return result;

but I get this error:

java.lang.reflect.InvocationTargetException
org.bonitasoft.engine.bpm.connector.ConnectorExecutionException: org.bonitasoft.engine.expression.exception.SInvalidExpressionException: Evaluation of expressions of type VARIABLE is forbidden at process definition level

what I have to do?