I am trying to test the database connection from a new Mirth server. I would like to find a way of testing a database connection that does not require writing an output file.
//javascript
try
{
var dbConn = DatabaseConnectionFactory.createDatabaseConnection('net.sourceforge.jtds.jdbc.Driver','jdbc:jtds:sqlserver://<Server IP:Port>>/rRIS_California','<user name>','<password>');
var result = dbConn.executeCachedQuery('SELECT TOP 1 * FROM <Table Name>');
dbConn.close();
return 1;
}
catch(e)
{
throw(e)
return 0;
}
logger.debug('string') is a great way to test out channels in development. you can change the channel's verbosity later so you don't even have to edit out the debug statements in case it starts acting up again.