Announcement

Collapse

Mirth Connect 3.12.0 Released!

Mirth Connect 3.12.0 is now available as an appliance update and on our GitHub page. This release includes database performance improvements, improves visual HL7 representation, message pruning, keystore handling, PDF generation, community contributions, and fixes several security vulnerabilities. This release also contains many improvements to commercial extensions. See the release notes for the list of fixes and updates.

Download | See What's New | Upgrade Guide | Release Notes

For discussion on this release, see this thread.
See more
See less

Derby truncation error

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

  • Derby truncation error

    I'm having issues writing a CLOB to Oracle using Mirth 1.7.1. I was previously able to do this using an older version
    http://www.mirthproject.org/index.ph...6&catid=2#3766

    My channel is attached, the sample message is at the bottom of this post.

    The attached channel uses a simple insert; when I was using JavaScript the channel would die on the line tempClobWriter.write(messageObject.getTransformedD ata());

    I have tried using this simple SQL insert with static values (I insert just a few characters for each column, for example,B) 'foo') but this fails with the same error as the stored procedure using javascript. It doesn't seem to matter what I attempt to write to the DB, I always get the following error about truncation to length 40 (not sure where this magic length comes from as my table does not have any varchar(40) columns, the smallest column is 50 and the others are larger...):

    Code:
    [2008-08-06 23:40:18,346]  ERROR (com.webreach.mirth.server.controllers.MessageObjectController:216): could not log message: id=94ea0c2b-37e8-4170-b001-6093cedc247c
    com.ibatis.common.jdbc.exception.NestedSQLException:   
    --- The error occurred in derby/derby-message.xml.  
    --- The error occurred while applying a parameter map.  
    --- Check the Message.insert-message-param.  
    --- Check the statement (update failed).  
    --- Cause: java.sql.SQLException: A truncation error was encountered trying to shrink VARCHAR '/><XTN.8/><XTN.9/></SCH.13><SCH.14><XAD.1><SAD.1/><SAD.2/><S&' to length 40.
    Caused by: java.sql.SQLException: A truncation error was encountered trying to shrink VARCHAR '/><XTN.8/><XTN.9/></SCH.13><SCH.14><XAD.1><SAD.1/><SAD.2/><S&' to length 40.
    	at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeUpdate(GeneralStatement.java:91)
    	at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.insert(SqlMapExecutorDelegate.java:447)
    	at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.insert(SqlMapSessionImpl.java:82)
    	at com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.insert(SqlMapClientImpl.java:59)
    	at com.webreach.mirth.server.controllers.MessageObjectController.writeMessageToDatabase(MessageObjectController.java:212)
    	at com.webreach.mirth.server.controllers.MessageObjectController.updateMessage(MessageObjectController.java:184)
    	at com.webreach.mirth.server.controllers.MessageObjectController.setStatus(MessageObjectController.java:570)
    	at com.webreach.mirth.server.controllers.MessageObjectController.setError(MessageObjectController.java:536)
    	at com.webreach.mirth.connectors.jdbc.JdbcMessageDispatcher.doDispatch(JdbcMessageDispatcher.java:148)
    	at org.mule.providers.AbstractMessageDispatcher$Worker.run(AbstractMessageDispatcher.java:257)
    	at org.mule.impl.work.WorkerContext.run(WorkerContext.java:290)
    	at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
    	at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
    	at java.lang.Thread.run(Thread.java:595)Caused by: java.sql.SQLException: A truncation error was encountered trying to shrink VARCHAR '/><XTN.8/><XTN.9/></SCH.13><SCH.14><XAD.1><SAD.1/><SAD.2/><S&' to length 40.
    	at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
    	at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown Source)
    	at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown Source)
    	at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown Source)
    	at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown Source)
    	at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown Source)
    	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(Unknown Source)
    	at org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(Unknown Source)
    	at org.apache.derby.impl.jdbc.EmbedPreparedStatement.execute(Unknown Source)
    	at com.ibatis.sqlmap.engine.execution.SqlExecutor.executeUpdate(SqlExecutor.java:81)
    	at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.sqlExecuteUpdate(GeneralStatement.java:200)
    	at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeUpdate(GeneralStatement.java:78)
    	... 13 more
    Caused by: ERROR 22001: A truncation error was encountered trying to shrink VARCHAR '/><XTN.8/><XTN.9/></SCH.13><SCH.14><XAD.1><SAD.1/><SAD.2/><S&' to length 40.
    	at org.apache.derby.iapi.error.StandardException.newException(Unknown Source)
    	at org.apache.derby.iapi.types.SQLChar.hasNonBlankChars(Unknown Source)
    	at org.apache.derby.iapi.types.SQLVarchar.normalize(Unknown Source)
    	at org.apache.derby.iapi.types.SQLVarchar.normalize(Unknown Source)
    	at org.apache.derby.iapi.types.DataTypeDescriptor.normalize(Unknown Source)
    	at org.apache.derby.impl.sql.execute.NormalizeResultSet.normalizeRow(Unknown Source)
    	at org.apache.derby.impl.sql.execute.NormalizeResultSet.getNextRowCore(Unknown Source)
    	at org.apache.derby.impl.sql.execute.DMLWriteResultSet.getNextRowCore(Unknown Source)
    	at org.apache.derby.impl.sql.execute.InsertResultSet.open(Unknown Source)
    	at org.apache.derby.impl.sql.GenericPreparedStatement.execute(Unknown Source)
    	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(Unknown Source)
    	at org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(Unknown Source)
    	at org.apache.derby.impl.jdbc.EmbedPreparedStatement.execute(Unknown Source)
    	at com.ibatis.sqlmap.engine.execution.SqlExecutor.executeUpdate(SqlExecutor.java:81)
    	at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.sqlExecuteUpdate(GeneralStatement.java:200)
    	at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeUpdate(GeneralStatement.java:78)
    	at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.insert(SqlMapExecutorDelegate.java:447)
    	at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.insert(SqlMapSessionImpl.java:82)
    	at com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.insert(SqlMapClientImpl.java:59)
    	at com.webreach.mirth.server.controllers.MessageObjectController.writeMessageToDatabase(MessageObjectController.java:212)
    	at com.webreach.mirth.server.controllers.MessageObjectController.updateMessage(MessageObjectController.java:184)
    	at com.webreach.mirth.server.controllers.MessageObjectController.setStatus(MessageObjectController.java:570)
    	at com.webreach.mirth.server.controllers.MessageObjectController.setError(MessageObjectController.java:536)
    	at com.webreach.mirth.connectors.jdbc.JdbcMessageDispatcher.doDispatch(JdbcMessageDispatcher.java:148)
    	at org.mule.providers.AbstractMessageDispatcher$Worker.run(AbstractMessageDispatcher.java:257)
    	at org.mule.impl.work.WorkerContext.run(WorkerContext.java:290)
    	at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
    	at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
    	at java.lang.Thread.run(Thread.java:595)

    Code:
    MSH|^~\&|PDCIS1||DCRIS1||200807221350||SIU^S12|PDCIS1080722135048271|D|2.3||
    SCH|2008072212275^PDCIS1||||||OFV|02^RETURN VISIT|015|MIN|^^^200807221430|||||PDCPTWEB||||PDCPTWEB|
    NTE|||V:12275~A:┬ź┬╗Scheduled via HealthView~C:HealthView Sick-sore throat~S:|
    PID||6701385^^^PDCIS1|FOO6555||DOE^JANE^^^^||19601101|F||W|4000 FOO RD^^FOO^NC^27705-3824^US^M~^^^^^^R|032|(8
    88)555-5555||||||999999999|||D||||||
    PV1||O||||||254627^REFERRAL^SELF^^^^^|||||||||||||||||||||||||||||||||||||||||||
    RGS|1|A|
    AIL|1|A|PCFR|SPDC||200807221430|
    AIP|1|A|272010^O'DOE^JOHN^HARRY|APPT MD|FAM|200807221430|
    FeedInsertXML.xml (3266 bytes)

  • #2
    Reerby truncation error

    I talked to jbartels on IRC and did some more investigation. I changed the destination to be an email sender and the message goes through fine.

    I switched back to Database writer/Oracle and I get the same error (or multiple errors actually) as before.

    I think Derby is saving the messages differently somehow with the database writer. I turned off message storage in the channel and now I get a different error. At least there is only one error per message now I'll report back how I resolve this. Tried the Query listed below in sqlplus and it succeeds, so not sure what's up there...

    Code:
    [2008-08-07 18:00:50,565]  ERROR (org.mule.impl.DefaultComponentExceptionStrategy:95): Caught exception in Exception Strategy for: 1780f152-b8d9-4662-8982-4bd1b814d8db: java.sql.SQLException: ORA-00911: invalid character
     Query: INSERT IGNORE INTO FEED_STAGING (FEED_STAGINGID, FEED_SITE, FEED_TYPE, FEED_XML, PROCESSING_PROCEDURE, FEED_INSERTDATE, FEED_INSERTUSER, FEED_LASTUPDATEDATE, FEED_LASTUPDATEUSER)
    VALUES(FEED_STAGINGID.NEXTVAL, 'foo', 'foo', '', 'foo', SYSDATE, 'foo', SYSDATE, 'foo'); Parameters: []
    java.sql.SQLException: ORA-00911: invalid character
     Query: INSERT IGNORE INTO FEED_STAGING (FEED_STAGINGID, FEED_SITE, FEED_TYPE, FEED_XML, PROCESSING_PROCEDURE, FEED_INSERTDATE, FEED_INSERTUSER, FEED_LASTUPDATEDATE, FEED_LASTUPDATEUSER)
    VALUES(FEED_STAGINGID.NEXTVAL, 'Polyester', 'Poo', '', 'none', SYSDATE, 'polyester', SYSDATE, 'polyester'); Parameters: []
    	at org.apache.commons.dbutils.QueryRunner.rethrow(QueryRunner.java:359)
    	at org.apache.commons.dbutils.QueryRunner.update(QueryRunner.java:428)
    	at com.webreach.mirth.connectors.jdbc.JdbcMessageDispatcher.doDispatch(JdbcMessageDispatcher.java:130)
    	at org.mule.providers.AbstractMessageDispatcher$Worker.run(AbstractMessageDispatcher.java:257)
    	at org.mule.impl.work.WorkerContext.run(WorkerContext.java:290)
    	at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
    	at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
    	at java.lang.Thread.run(Thread.java:595)

    Comment


    • #3
      Reerby truncation error

      The invalid character error was due to having a semicolon at the end of the line. Problem solved.


      There still remains the problem of why Derby errors out on the Database Writer if messages are stored, but not the email sender.

      Comment

      Working...
      X