web stats
Mirth Community - View Single Post - Best practices for managing DB connections and objects
View Single Post
  #9  
Old 05-12-2016, 04:13 AM
kirbykn2's Avatar
kirbykn2 kirbykn2 is offline
Mirth Guru
 
Join Date: Sep 2014
Location: Michigan
Posts: 615
kirbykn2 is on a distinguished road
Default Got it!

We need to use executeQuery instead of executeCachedQuery

var pds = globalMap.get("CernerPool");
var conn = pds.getConnection(); //java.sql.Connection
var sqlCommand = "SELECT person_id as t_person_id FROM person_alias WHERE person_id = 55555 AND person_alias_id = 666666";

var stmt = conn.createStatement();
var result = stmt.executeQuery(sqlCommand);

while(result.next())
{
logger.info("t_person_id " + result.getString('t_person_id'));
}

conn.close();
__________________
Best,

Kirby

Mirth Certified|Epic Bridges Certified|Cloverleaf Level 2 Certified

Appliance Version 3.11.4
Mirth Connect Version 3.8.0
Java Version 1.6.0_45-b06
Java (64 bit) Version 1.6.0_45-b06
Java 7 (64 bit) Version 1.7.0_151-b15
Java 8 (64 bit) Version 1.8.0_181-b13
PostgreSQL Version 9.6.8
Reply With Quote