You're right. I'm sorry I didn't see that.

Thanks for your help.
Vinicius Isola
"Não podemos escolher as consequências, mas podemos escolher nossos atos."


On Thu, Jun 3, 2010 at 1:21 PM, Mark Porter <[email protected]> wrote:

> This isn't a rhino problem. The hint is here:
>
> "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 <[email protected]> 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)
> >     at
> org.mozilla.javascript.Context.reportRuntimeError(Context.java:938)
> >     at
> org.mozilla.javascript.Context.reportRuntimeError(Context.java:994)
> >     ....
> >
> > 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
>
> _______________________________________________
> dev-tech-js-engine-rhino mailing list
> [email protected]
> https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino
>
_______________________________________________
dev-tech-js-engine-rhino mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino

Reply via email to