inside the following script:
database.ps.setParameter = function (ps, sqlType, index, param) {
log.debug('Setting param, SQL Type: ' + sqlType + ', index: ' + index +
', type: ' + (typeof param) + ', value: ' + JSON.encode(param));
switch (sqlType) {
...
case java.sql.Types.INTEGER:
case java.sql.Types.SMALLINT:
ps.setInt(index, param); <-- Here is the error
break;
...
case java.sql.Types.CHAR:
case java.sql.Types.VARCHAR:
case java.sql.Types.LONGVARCHAR:
default:
ps.setString(index, param);
};
};
This is a function that I wrote to set parameters into a
java.sql.PreparedStatement but it is not working because I'm having this
problem converting 'param' that is a number to a java.lang.Integer, as
stated in the exception. The logging statement in the beginning of the
function outputs the following:
Setting param, SQL Type: 4, index: id, type: number, value: 32
Calling java methods with numbers worked in many different places, I don't
know why is not working here.
Any help would be appreciated.
Vinicius Isola
"Setting param, SQL Type: 4, index: id, type: number, value: 32 "
Your index should be an int instead of "id". setXXX() expects the
index to be 1-based index of the "?" in the sql string
----------------------------------------------------------
Mark Porter
Myna JavaScript Application Server
Easy web development with server-side JavaScript
http://www.mynajs.org
On Jun 1, 1:47 pm, Vinicius Isola <viniciusis...@gmail.com> wrote:
> I'm getting the following error:
> org.mozilla.javascript.EvaluatorException: Cannot convert id to
> java.lang.Integer (server_bootstrap_030.Database.js#163)
> at
> org.mozilla.javascript.DefaultErrorReporter.runtimeError(DefaultErrorReport er.java:109)
Thanks for your help.
Vinicius Isola
"Não podemos escolher as consequências, mas podemos escolher nossos atos."
> _______________________________________________
> dev-tech-js-engine-rhino mailing list
> dev-tech-js-...@lists.mozilla.org
> https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino
>