web stats
Mirth 3.6.0: Javascript Writer and JDBC driver not suitable - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 06-12-2018, 02:36 AM
dobunzli dobunzli is offline
OBX.1 Kenobi
 
Join Date: Jun 2010
Posts: 48
dobunzli is on a distinguished road
Default [SOLVED] Mirth 3.6.0: Javascript Writer and JDBC driver not suitable

Hello,

I have a JDBC driver to connect Mirth with my Filemaker Database. It sends lab pdf files. Under Mirth connect 3.2 everything was working fine. I just upgraded to Mirth Connect 3.6.0 on Mac OS 10.13.4 with java 1.8.

Since then, I receive this error when I deploy the channel

Quote:
ERROR (com.mirth.connect.connectors.js.JavaScriptDispatc her:193): Error evaluating JavaScript Writer (JavaScript Writer "Destination 1" on channel 8151cbdd-52b7-485a-8721-b14e63f420c9).
com.mirth.connect.server.MirthJavascriptTransforme rException: CHANNEL:
Dianalab PDF to FilemakerCONNECTOR:
Destination 1SCRIPT SOURCE:
JavaScript WriterSOURCE CODE:
100: importPackage(java.io);101: 102: // database connexion information103: 104: new com.filemaker.jdbc.Driver();105: var dbConn = DriverManager.getConnection('jdbc:filemaker://localhost/M_mydatabase','xxxx','yyyy');106: 107: // The pdf is transformed by Mirth Connect into a base64 String108: // Here we transform the base64 String as byte array. 109: LINE NUMBER:
105DETAILS:
Wrapped java.sql.SQLException: No suitable driver found for jdbc:filemaker://localhost/M_mydatabase
Looks like the javascript code is not working anymore (see below). The driver is installed into the custom-lib folder.

What changes do I have to made so that it works again ?

Thanks in advance.


Code:
new com.filemaker.jdbc.Driver();
var dbConn = DriverManager.getConnection('jdbc:filemaker://localhost/M_mydatabase','xxxx','yyyy');

// The pdf is transformed by Mirth Connect into a base64 String
// Here we transform the base64 String as byte array. 

var pdfBytes = org.apache.commons.codec.binary.Base64.decodeBase64(connectorMessage.getRawData().replaceAll('[^A-Za-z0-9\\+\\/\\=]',''));

// original filename is used as id for the pdf file
// original filename with extension


var filenameFull = $('originalFilename');

// filename without extension

var fileName = filenameFull.substr(0,filenameFull.lastIndexOf("."));

// filename for blob

var filenameBlob = "labo_" + filenameFull


// creates the sql command to insert the binary file and the filename, we use the filemaker JDBC AS function to insert the filename (see FM doc)

var ps = dbConn.prepareStatement("insert into Laboratoire_Incoming (labin_labodossier_id, labin_blob, labin_processed, labin_errored) values (?,? AS '" + filenameBlob + "',?,? ) ");


// parameter 1

ps.setString(1,fileName);

// parameter 2

ps.setBytes(2,pdfBytes);

// parameter 3 (labin_processed)

ps.setString(3,"0");

// parameter 4 (labin_errored)

ps.setString(4,"0");


// do it

ps.executeUpdate();

// close

ps.close();
dbConn.close();

Last edited by dobunzli; 06-12-2018 at 07:57 AM.
Reply With Quote
  #2  
Old 06-12-2018, 06:36 AM
narupley's Avatar
narupley narupley is online now
Mirth Employee
 
Join Date: Oct 2010
Posts: 7,038
narupley is on a distinguished road
Default

Go to the Settings -> Resources tab, and add a new Directory resource. Put your custom JAR(s) in a separate, isolated folder, and point the resource to that folder.

Then in your channel (or any channel), go to the Summary tab -> Set Dependencies -> Library Resources and check the box next to your newly created resource, for whatever contexts you need it in (in this case, the destination connector).

Then redeploy your channel, and it should be able to pick up that driver.
__________________
Step 1: JAVA CACHE...DID YOU CLEAR

Nicholas Rupley
Work: 949-237-6069
Always include what Mirth Connect version you're working with. Also include (if applicable) the code you're using and full stacktraces for errors (use CODE tags). Posting your entire channel is helpful as well; make sure to scrub any PHI/passwords first.


- How do I foo?
- You just bar.
Reply With Quote
  #3  
Old 06-12-2018, 07:47 AM
dobunzli dobunzli is offline
OBX.1 Kenobi
 
Join Date: Jun 2010
Posts: 48
dobunzli is on a distinguished road
Default

Hello narupley,

Thanks for your help. I just managed to solve the problem before seeing your answer (but I will keep it in mind).

In the upgrade process my "dbdrivers.xml" file was overwritten and was missing the reference for the Filemaker JDBC driver.

After adding the line:
<driver class="com.filemaker.jdbc.Driver" name="Filemaker JDBC" template="jdbc:filemaker://filemakerhostip/dbname" selectLimit="" />

and restarting the computer, it works as before.

Thanks again.


Quote:
Originally Posted by narupley View Post
Go to the Settings -> Resources tab, and add a new Directory resource. Put your custom JAR(s) in a separate, isolated folder, and point the resource to that folder.

Then in your channel (or any channel), go to the Summary tab -> Set Dependencies -> Library Resources and check the box next to your newly created resource, for whatever contexts you need it in (in this case, the destination connector).

Then redeploy your channel, and it should be able to pick up that driver.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 02:13 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2018, vBulletin Solutions, Inc.
Mirth Corporation