I have an xsjs sertvice that is filling some tables with data from another table. after sometime running, the service gives the following error: InternalError: dberror(Connection.prepareStatement): 608 - exceed maximum number of prepared statements: the number of prepared statements per connection cannot exceed the max statements
I'm opening a $.db.getConnection() at the beginning and only closing at the end, with a prepareStatement statement on a for loop. (there are several loops like the one bellow for other tables)
var aSQL = "select field from table";
var conn = $.hdb.getConnection(); var connInsert = $.db.getConnection();
var rsLevel1 = conn.executeQuery(aSQL);
var s = {};
var loc_descr_group = [];
var row = {};
for (i = 0; i < rsLevel1.length; i++) {
var entry = rsLevel1[i].field;
var split = entry.split(",");
for (var j = 0; j<split.length; j++){
if (loc_descr_group.indexOf(split[j]) == -1){
loc_descr_group.push(split[j]);
var value = split[j].replace(/'/g,"''");
sSQL = "insert into another_table "
+ " values ('"+value+"')";
pstmt = connInsert.prepareStatement(sSQL);
pstmt.execute();
connInsert.commit();
}
}
}
connInsert.close();
conn.close();
I couldn't find any information about the max number of prepareStatement used on xsjs. Is there one?
Thank you.