web stats
error when reading from SqlServer table (DBMaxRetries) - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Thread Tools Display Modes
Old 10-14-2019, 01:48 AM
common_user common_user is offline
Mirth Newb
Join Date: Oct 2019
Posts: 6
common_user is on a distinguished road
Default 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(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
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++;
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.
Reply With Quote
Old 10-17-2019, 11:57 AM
pacmano pacmano is offline
OBX.3 Kenobi
Join Date: Oct 2009
Location: Texas
Posts: 117
pacmano is on a distinguished road

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.
Reply With Quote
Old 10-17-2019, 12:03 PM
agermano agermano is offline
Mirth Guru
Join Date: Apr 2017
Location: Indiana, USA
Posts: 1,159
agermano is on a distinguished road

I didn't realize this one was double posted. Already solved here https://stackoverflow.com/a/58378693/10519543
Reply With Quote
Old 10-20-2019, 08:33 AM
common_user common_user is offline
Mirth Newb
Join Date: Oct 2019
Posts: 6
common_user is on a distinguished road

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.
Reply With Quote

database reader, source connector, sqlserver

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT -8. The time now is 03:59 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2020, vBulletin Solutions, Inc.
Mirth Corporation