Call Database Stored Procedures via JDBC

With the Database Plugin (which provides JDBC-Classes for your scripting elements) you can execute Stored Procedures, using following Syntax:
var main = new JDBCConnection();
 var con;
 try  {
 con = main.getConnection( url, user, password );
 System.log( "Connection to database successful" );
 var cstmt = con.prepareCall("{call nameOfStoredProcedure(?,?)}");
 cstmt.setString(1,firstParameter);
 cstmt.setString(2, anotherParameter);
 var rs =  cstmt.executeQuery();
 //removed line, see comment
 //removed line, see above, and then the comment 🙂
 while ( rs.next() )  {
 //... Process results of the Stored Procedure, if necessary.
 }
 rs.close();
 cstmt.close();
 } catch( ex )  {
 throw "Exception during database action " + ex + ")";
 } finally {
 if (con) {
 con.close();
 }