Hi,
I am trying to use a prepared statement with a DatabaseConnection object. I tried to use DatabaseConnection.executeUpdate(String sqlExpression, java.util.List params) API. When I try to pass in a javascript array like this:
I get the exception:
ERROR-406: JDBC Connector error
ERROR MESSAGE: Error writing to database:
org.mozilla.javascript.EvaluatorException: Cannot convert [email protected] to java.util.List (fff9cb5c-5920-499d-9383-eb395398ded0#22)
at org.mozilla.javascript.DefaultErrorReporter.runtim eError(DefaultErrorReporter.java:95)
at org.mozilla.javascript.Context.reportRuntimeError( Context.java:966)
at org.mozilla.javascript.Context.reportRuntimeError( Context.java:1022)
at org.mozilla.javascript.Context.reportRuntimeError2 (Context.java:992)
I understand why that is happening but couldn't figure out the solution. Anybody knows the correct way to use this API? Thanks for your help.
Post edited by: josemathews, at: 09/10/2007 12:17
I am trying to use a prepared statement with a DatabaseConnection object. I tried to use DatabaseConnection.executeUpdate(String sqlExpression, java.util.List params) API. When I try to pass in a javascript array like this:
Code:
var params = new Array(); params[0] = $('lastName'); params[1] = $('firstName'); params[2] = $('middleName'); var expression = "INSERT IGNORE INTO hl7_sample (patient_last_name, patient_first_name, patient_middle_initial) VALUES (?, ?, ?);" var result = dbConn.executeUpdate(expression, params);
I get the exception:
ERROR-406: JDBC Connector error
ERROR MESSAGE: Error writing to database:
org.mozilla.javascript.EvaluatorException: Cannot convert [email protected] to java.util.List (fff9cb5c-5920-499d-9383-eb395398ded0#22)
at org.mozilla.javascript.DefaultErrorReporter.runtim eError(DefaultErrorReporter.java:95)
at org.mozilla.javascript.Context.reportRuntimeError( Context.java:966)
at org.mozilla.javascript.Context.reportRuntimeError( Context.java:1022)
at org.mozilla.javascript.Context.reportRuntimeError2 (Context.java:992)
I understand why that is happening but couldn't figure out the solution. Anybody knows the correct way to use this API? Thanks for your help.
Post edited by: josemathews, at: 09/10/2007 12:17
Comment