Announcement

Collapse
No announcement yet.

java.sql.SQLException: Invalid column count. Cannot be less or equal to zero

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

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

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

    Comment


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

      Comment


      • #4
        How are you calling that from mirth? database writer in sql mode? javascript?

        Comment


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

          Comment


          • #6
            Try changing to a parameterized array?

            -= Jack Haines : Founder/CEO of Healthcare Integrations, LLC
            -= [email protected]
            -= 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

            Comment


            • #7
              dbconn.executeCachedQuery returns a CachedRowSet. I think you want dbconn.executeUpdate instead. That returns an int of the affected row count.

              Comment

              Working...
              X