Gary Kindel Gary Kindel - 1 year ago 99
Java Question

Why is this string: javax.sql.rowset.serial.SerialClob being included in an output file instead of the actual value

I am using Mirth 3.1.0.x, to extract data from a Sql Server 2012 database and write the resultset to a flat file.

The code was working prior to a new column being added.

Here is the code in a transformer script for a Mirth Channel destination:

var dbConn = DatabaseConnectionFactory.createDatabaseConnection('net.sourceforge.jtds.jdbc.Driver','jdbc:jtds:sqlserver://','rRIS_California','rRIS_California');
var result1 = dbConn.executeCachedQuery("exec [z_SelectChannelData] 'AAI'");

tmp.row += <row>

In the file out, the last column is not being populated by the actual value but the following string:




Below, is the T-SQL for the last column:

CASE WHEN v.copay is null THEN '' WHEN v.copay =0 THEN '' ELSE cast(v.copay as varchar(max)) END as copay
FROM <table> as v

Answer Source

Found the answer thanks to Evan Knowles and kucing_terbang. I was chasing the wrong rabbit. Issue caused by data type of the copay column. I was using varchar(max) because I was unsure how large the field might be. Changed it to varchar(20). Getting the correct value in the flat file.

CASE WHEN v.copay is null THEN '' WHEN v.copay =0 THEN '' ELSE cast(v.copay as varchar(20)) END as copay
FROM <table> v
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download