web stats
java.sql.SQLException: Invalid column count. Cannot be less or equal to zero - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 10-25-2019, 07:42 AM
cory_cole cory_cole is offline
Mirth Guru
 
Join Date: Mar 2012
Posts: 1,310
cory_cole is on a distinguished road
Default java.sql.SQLException: Invalid column count. Cannot be less or equal to zero

Has anybody seen this error. I am doing an update on a table. It does throw the error every time and even when it does, the update still happens. I can throw I try catch around it but I want to find what the cause is.
Reply With Quote
  #2  
Old 10-28-2019, 06:19 AM
agermano agermano is offline
Mirth Guru
 
Join Date: Apr 2017
Location: Indiana, USA
Posts: 1,029
agermano is on a distinguished road
Default

What kind of db and what does the code look like? Normally I would expect a column count with a resultSet, but updates don't typically return a resultSet.
Reply With Quote
  #3  
Old 10-28-2019, 07:39 AM
cory_cole cory_cole is offline
Mirth Guru
 
Join Date: Mar 2012
Posts: 1,310
cory_cole is on a distinguished road
Default

Oracle database

UPDATE METHODIST_META SET SOURCEID = 'CERNER', DOCUMENTTYPE = 'DYNDOC', PATIENTID = '573265', ENCOUNTERID = '8882047', PROVIDERID = '3604' WHERE FILENAME = 'Q3343039338T4215270019_1.xml'

And when I cut and paste this line into Oracle it works.
Reply With Quote
  #4  
Old 10-28-2019, 12:13 PM
agermano agermano is offline
Mirth Guru
 
Join Date: Apr 2017
Location: Indiana, USA
Posts: 1,029
agermano is on a distinguished road
Default

How are you calling that from mirth? database writer in sql mode? javascript?
Reply With Quote
  #5  
Old 10-28-2019, 12:36 PM
cory_cole cory_cole is offline
Mirth Guru
 
Join Date: Mar 2012
Posts: 1,310
cory_cole is on a distinguished road
Default

javaScript...


var meta_update = 'UPDATE METHODIST_META SET SOURCEID = \'CERNER\', DOCUMENTTYPE = \'DYNDOC\', PATIENTID = \'' + syn_pid +
'\', ENCOUNTERID = \'' + syn_fin + '\', PROVIDERID = \'' + syn_phy + '\' WHERE FILENAME = \'' + sourceMap.get('originalFilename') + '\'';
logger.info(meta_update);
var meta_results = dbConn.executeCachedQuery(meta_update);


The thing of it is, is that the command succeeds.
Reply With Quote
  #6  
Old 10-28-2019, 12:49 PM
jackwhaines jackwhaines is online now
 
Join Date: May 2011
Location: Kansas City, Missouri
Posts: 246
jackwhaines is on a distinguished road
Send a message via Skype™ to jackwhaines
Default

Try changing to a parameterized array?
__________________

-= Jack Haines : Founder/CEO of Healthcare Integrations, LLC
-= jack.haines@HealthcareIntegrations.com
-= Mirth Connect (Advanced)-certified
-= Gold member of HL7.org
-= Available for Mirth Connect channel development and consultation! Schedule a FREE call with me at https://calendly.com/jackhaines
Reply With Quote
  #7  
Old 10-28-2019, 01:31 PM
agermano agermano is offline
Mirth Guru
 
Join Date: Apr 2017
Location: Indiana, USA
Posts: 1,029
agermano is on a distinguished road
Default

dbconn.executeCachedQuery returns a CachedRowSet. I think you want dbconn.executeUpdate instead. That returns an int of the affected row count.
Reply With Quote
Reply

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 09:51 AM.


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