Announcement

Collapse
No announcement yet.

error when reading from SqlServer table (DBMaxRetries)

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

  • error when reading from SqlServer table (DBMaxRetries)

    Hello.
    I am using Mirth Connect Server 3.4.2.8129. I created a test channel, a very simple one which should just select the records from a table (SQL Server) and send them to a destination of type javascript writer.

    I defined a database reader source and I am trying to select the records of a table. I will paste the code below.

    The Javascript code I use in the Source is this (I replaced sensitive information with ***):


    var dbConn;
    try
    {
    dbConn = DatabaseConnectionFactory.createDatabaseConnection ('net.sourceforge.jtds.jdbc.Driver','jdbc:jtds:sql server://***:***;InstanceName=***;DatabaseName=***','***',' ***');
    var results = executeCachedQuery('select * from [***].[dbo].[***]');
    return results;
    }
    finally
    {
    if (dbConn)
    {
    dbConn.close();
    }
    }





    I get the following error:



    ERROR 2019-10-14 12:05:55,164 [Database Reader Polling Thread on TestMedisOrders (fba0f4c7-0a2d-47ec-b638-acb586925c92) < fba0f4c7-0a2d-47ec-b638-acb586925c92_Worker-1] com.mirth.connect.connectors.jdbc.DatabaseReceiver : Failed to poll for messages from the database in channel "TestMedisOrders"
    com.mirth.connect.connectors.jdbc.DatabaseReceiver Exception: Error executing script 2c6e99c0-0149-4cac-89ef-df08a7ea5b87.
    at com.mirth.connect.connectors.jdbc.DatabaseReceiver Script.poll(DatabaseReceiverScript.java:128)
    at com.mirth.connect.connectors.jdbc.DatabaseReceiver .poll(DatabaseReceiver.java:108)
    at com.mirth.connect.donkey.server.channel.PollConnec torJob.execute(PollConnectorJob.java:49)
    at org.quartz.core.JobRunShell.run(JobRunShell.java:2 13)
    at org.quartz.simpl.SimpleThreadPool$WorkerThread.run (SimpleThreadPool.java:557)
    Caused by: com.mirth.connect.server.MirthJavascriptTransforme rException:
    CHANNEL: TestMedisOrders
    CONNECTOR: Source
    SOURCE CODE:
    125: }
    126:
    127: function executeOperation(source, operation, expression, parameters) {
    128: var dbConn = getDBConnection(source);
    129: var attempts = 0;
    130: var maxAttempts = java.lang.Integer.parseInt($('DBMaxRetries'));
    131:
    132: while (attempts < maxAttempts) {
    133: attempts++;
    134:
    LINE NUMBER: 130
    DETAILS: Wrapped java.lang.NumberFormatException: For input string: ""
    at 2c6e99c0-0149-4cac-89ef-df08a7ea5b87:130 (executeOperation)
    at 2c6e99c0-0149-4cac-89ef-df08a7ea5b87:67 (executeCachedQuery)
    at 2c6e99c0-0149-4cac-89ef-df08a7ea5b87:249 (doScript)
    at 2c6e99c0-0149-4cac-89ef-df08a7ea5b87:259
    at com.mirth.connect.server.util.javascript.JavaScrip tUtil.executeScript(JavaScriptUtil.java:527)
    at com.mirth.connect.connectors.jdbc.DatabaseReceiver Script$SelectTask.doCall(DatabaseReceiverScript.ja va:168)
    at com.mirth.connect.server.util.javascript.JavaScrip tTask.call(JavaScriptTask.java:113)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker( Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run (Unknown Source)
    at java.lang.Thread.run(Unknown Source)
    Caused by: java.lang.NumberFormatException: For input string: ""
    at java.lang.NumberFormatException.forInputString(Unk nown Source)
    at java.lang.Integer.parseInt(Unknown Source)
    at java.lang.Integer.parseInt(Unknown Source)
    at sun.reflect.GeneratedMethodAccessor46.invoke(Unkno wn Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Un known Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.mozilla.javascript.MemberBox.invoke(MemberBox. java:126)
    at org.mozilla.javascript.NativeJavaMethod.call(Nativ eJavaMethod.java:225)
    at org.mozilla.javascript.Interpreter.interpretLoop(I nterpreter.java:1479)
    at org.mozilla.javascript.Interpreter.interpret(Inter preter.java:815)
    at org.mozilla.javascript.InterpretedFunction.call(In terpretedFunction.java:109)
    at org.mozilla.javascript.ContextFactory.doTopCall(Co ntextFactory.java:393)
    at org.mozilla.javascript.ScriptRuntime.doTopCall(Scr iptRuntime.java:3280)
    at org.mozilla.javascript.InterpretedFunction.exec(In terpretedFunction.java:120)
    at com.mirth.connect.server.util.javascript.JavaScrip tTask.executeScript(JavaScriptTask.java:142)
    at com.mirth.connect.server.util.javascript.JavaScrip tUtil.executeScript(JavaScriptUtil.java:522)
    ... 6 more


    I tried searching for a setting in all the configuration files in mirth installation folder, but I didn't find any file containing it. I also unarchived the SQL Server driver (jtds 1.3.1.jar) and searched there, too, but no. I did not find anything about a DBMaxRetries.

    Has anyone else face this?

    Thank you.

  • #2
    Can you post what you have in "# Retries on Error" in the reader? Or a screenshot. Seems to be complaining you have a bad value in there.
    Mirth 3.8.0 / PostgreSQL 11 / Ubuntu 18.04
    Diridium Technologies, Inc.
    https://diridium.com

    Comment


    • #3
      I didn't realize this one was double posted. Already solved here https://stackoverflow.com/a/58378693/10519543

      Comment


      • #4
        Hello. It was code from a code a code template. I inherited the whole mirth setup and the technology was new to me at that time, so I didn't know about code templates. Not finding anything in filters or transformers scripts, i assumed it was code from mirth internals. It was just a code from templates which was reading an inexistent setting.

        Comment

        Working...
        X