No announcement yet.

error when reading from SqlServer table (DBMaxRetries)

  • Filter
  • Time
  • Show
Clear All
new posts

  • error when reading from SqlServer table (DBMaxRetries)

    I am using Mirth Connect Server 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;
    dbConn = DatabaseConnectionFactory.createDatabaseConnection ('net.sourceforge.jtds.jdbc.Driver','jdbc:jtds:sql server://***:***;InstanceName=***;DatabaseName=***','***',' ***');
    var results = executeCachedQuery('select * from [***].[dbo].[***]');
    return results;
    if (dbConn)

    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(
    at com.mirth.connect.connectors.jdbc.DatabaseReceiver .poll(
    at torJob.execute(
    at 13)
    at org.quartz.simpl.SimpleThreadPool$ (
    Caused by: com.mirth.connect.server.MirthJavascriptTransforme rException:
    CHANNEL: TestMedisOrders
    CONNECTOR: Source
    125: }
    127: function executeOperation(source, operation, expression, parameters) {
    128: var dbConn = getDBConnection(source);
    129: var attempts = 0;
    130: var maxAttempts = java.lang.Integer.parseInt($('DBMaxRetries'));
    132: while (attempts < maxAttempts) {
    133: attempts++;
    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(
    at com.mirth.connect.connectors.jdbc.DatabaseReceiver Script$SelectTask.doCall(DatabaseReceiverScript.ja va:168)
    at com.mirth.connect.server.util.javascript.JavaScrip
    at Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker( Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$ (Unknown Source)
    at 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.Interpreter.interpretLoop(I
    at org.mozilla.javascript.Interpreter.interpret(Inter
    at org.mozilla.javascript.ContextFactory.doTopCall(Co
    at org.mozilla.javascript.ScriptRuntime.doTopCall(Scr
    at org.mozilla.javascript.InterpretedFunction.exec(In
    at com.mirth.connect.server.util.javascript.JavaScrip tTask.executeScript(
    at com.mirth.connect.server.util.javascript.JavaScrip tUtil.executeScript(
    ... 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.


    • #3
      I didn't realize this one was double posted. Already solved here


      • #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.