Announcement

Collapse
No announcement yet.

Javascript error attempting multiple insert to DB2

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Javascript error attempting multiple insert to DB2

    Hi

    I am able to successfully insert HL7 parsed data into a DB2 table using a basic SQL 'insert' statement from Mirth 1.7.1 but when I attempt to run multiple 'insert into' SQL statements to different tables using Javascript, I am not able to.

    SO, I tried just running one insert into statement with a basic javascript and I still can't seem to make javascript run. I am not sure at this point if this is a Mirth or a DB2 driver issue.

    Has anyone been able to successfully use Mirth's JavaScript tool to insert into DB2?

    Below is the simple javascript code I tested and failed and the error message I received.

    Thank you in advance,
    Nic




    ***** Javascript code in 'Destination' tab within Mirth *****

    var dbConn = DatabaseConnectionFactory.createDatabaseConnection ('com.ibm.db2.jcc.DB2Driver','jdbc:db2://127.0.0.1:5000/DB2DB','johndoe','johndoepasswd');

    var result = dbConn.executeUpdate("INSERT IGNORE INTO MYSCHEMA.MYTABLE (COLUMN1) VALUES ($('message.rawData'))");

    dbConn.close();

    ***** Below is the error message output I get from Mirth *****

    ERROR-406: JDBC Connector error
    ERROR MESSAGE: Error writing to database:
    org.mozilla.javascript.WrappedException: Wrapped com.ibm.db2.jcc.b.nm: DB2 SQL Error: SQLCODE=-440, SQLSTATE=42884, SQLERRMC=$;FUNCTION, DRIVER=3.50.152 (f73cba58-e0bc-43d4-8018-d10c4afef07c#3)
    at org.mozilla.javascript.Context.throwAsScriptRuntim eEx(Context.java:1693)
    at org.mozilla.javascript.MemberBox.invoke(MemberBox. java:157)
    at org.mozilla.javascript.NativeJavaMethod.call(Nativ eJavaMethod.java:201)
    at org.mozilla.javascript.optimizer.OptRuntime.call1( OptRuntime.java:64)
    at org.mozilla.javascript.gen.c58._c6(f73cba58-e0bc-43d4-8018-d10c4afef07c:3)
    at org.mozilla.javascript.gen.c58.call(f73cba58-e0bc-43d4-8018-d10c4afef07c)
    at org.mozilla.javascript.optimizer.OptRuntime.callNa me0(OptRuntime.java:106)
    at org.mozilla.javascript.gen.c58._c0(f73cba58-e0bc-43d4-8018-d10c4afef07c:8)
    at org.mozilla.javascript.gen.c58.call(f73cba58-e0bc-43d4-8018-d10c4afef07c)
    at org.mozilla.javascript.ContextFactory.doTopCall(Co ntextFactory.java:337)
    at org.mozilla.javascript.ScriptRuntime.doTopCall(Scr iptRuntime.java:2755)
    at org.mozilla.javascript.gen.c58.call(f73cba58-e0bc-43d4-8018-d10c4afef07c)
    at org.mozilla.javascript.gen.c58.exec(f73cba58-e0bc-43d4-8018-d10c4afef07c)
    at com.webreach.mirth.connectors.jdbc.JdbcMessageDisp atcher.doDispatch(JdbcMessageDispatcher.java:97)
    at com.webreach.mirth.connectors.jdbc.JdbcMessageDisp atcher.doSend(JdbcMessageDispatcher.java:157)
    at org.mule.providers.AbstractMessageDispatcher.send( AbstractMessageDispatcher.java:166)
    at org.mule.impl.MuleSession.sendEvent(MuleSession.ja va:191)
    at org.mule.impl.MuleSession.sendEvent(MuleSession.ja va:130)
    at org.mule.routing.outbound.AbstractOutboundRouter.s end(AbstractOutboundRouter.java:85)
    at org.mule.routing.outbound.FilteringMulticastingRou ter.route(FilteringMulticastingRouter.java:89)
    at org.mule.routing.outbound.OutboundMessageRouter$1. doInTransaction(OutboundMessageRouter.java:78)
    at org.mule.transaction.TransactionTemplate.execute(T ransactionTemplate.java:48)
    at org.mule.routing.outbound.OutboundMessageRouter.ro ute(OutboundMessageRouter.java:82)
    at org.mule.impl.model.DefaultMuleProxy.onCall(Defaul tMuleProxy.java:247)
    at org.mule.impl.model.seda.SedaComponent.doSend(Seda Component.java:209)
    at org.mule.impl.model.AbstractComponent.sendEvent(Ab stractComponent.java:277)
    at org.mule.impl.MuleSession.sendEvent(MuleSession.ja va:201)
    at org.mule.routing.inbound.InboundMessageRouter.send (InboundMessageRouter.java:161)
    at org.mule.routing.inbound.InboundMessageRouter.rout e(InboundMessageRouter.java:128)
    at org.mule.providers.AbstractMessageReceiver$Default InternalMessageListener.onMessage(AbstractMessageR eceiver.java:493)
    at org.mule.providers.AbstractMessageReceiver.routeMe ssage(AbstractMessageReceiver.java:272)
    at org.mule.providers.AbstractMessageReceiver.routeMe ssage(AbstractMessageReceiver.java:244)
    at com.webreach.mirth.connectors.mllp.MllpMessageRece iver$TcpWorker.processHL7Data(MllpMessageReceiver. java:440)
    at com.webreach.mirth.connectors.mllp.MllpMessageRece iver$TcpWorker.processData(MllpMessageReceiver.jav a:418)
    at com.webreach.mirth.connectors.mllp.MllpMessageRece iver$TcpWorker.run(MllpMessageReceiver.java:339)
    at org.mule.impl.work.WorkerContext.run(WorkerContext .java:290)
    at edu.emory.mathcs.backport.java.util.concurrent.Thr eadPoolExecutor$Worker.runTask(ThreadPoolExecutor. java:650)
    at edu.emory.mathcs.backport.java.util.concurrent.Thr eadPoolExecutor$Worker.run(ThreadPoolExecutor.java :675)
    at java.lang.Thread.run(Thread.java:619)
    Caused by: com.ibm.db2.jcc.b.nm: DB2 SQL Error: SQLCODE=-440, SQLSTATE=42884, SQLERRMC=$;FUNCTION, DRIVER=3.50.152
    at com.ibm.db2.jcc.b.wc.a(wc.java:579)
    at com.ibm.db2.jcc.b.wc.a(wc.java:57)
    at com.ibm.db2.jcc.b.wc.a(wc.java:126)
    at com.ibm.db2.jcc.b.tk.c(tk.java:1901)
    at com.ibm.db2.jcc.b.tk.d(tk.java:1889)
    at com.ibm.db2.jcc.b.tk.b(tk.java:1356)
    at com.ibm.db2.jcc.t4.db.h(db.java:219)
    at com.ibm.db2.jcc.t4.db.b(db.java:45)
    at com.ibm.db2.jcc.t4.t.b(t.java:38)
    at com.ibm.db2.jcc.t4.sb.g(sb.java:120)
    at com.ibm.db2.jcc.b.tk.M(tk.java:1351)
    at com.ibm.db2.jcc.b.tk.a(tk.java:2246)
    at com.ibm.db2.jcc.b.tk.e(tk.java:866)
    at com.ibm.db2.jcc.b.tk.execute(tk.java:850)
    at com.webreach.mirth.server.util.DatabaseConnection. executeUpdate(DatabaseConnection.java:138)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.mozilla.javascript.MemberBox.invoke(MemberBox. java:142)
    ... 37 more

    Post edited by: nictac, at: 05/06/2008 18:43
Working...
X