web stats
acessing databases - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 05-17-2017, 06:26 AM
Stikarty Stikarty is offline
What's HL7?
 
Join Date: May 2017
Location: Portugal
Posts: 3
Stikarty is on a distinguished road
Unhappy acessing databases

im new with the program but because of the school i need to use it and basicaly i can't get the databases in the sources, and i don't know why, and i already read so much and still without understand how to do it, i would apreciate some help.
Reply With Quote
  #2  
Old 05-19-2017, 05:09 AM
AlexNeiva AlexNeiva is offline
Mirth Guru
 
Join Date: Oct 2013
Location: Portugal
Posts: 277
AlexNeiva is on a distinguished road
Default

Can you please provide more detailed information?
What you pretend?
Reply With Quote
  #3  
Old 05-19-2017, 05:40 AM
Stikarty Stikarty is offline
What's HL7?
 
Join Date: May 2017
Location: Portugal
Posts: 3
Stikarty is on a distinguished road
Default more detail

Im working on a project for an hospital where i have to use mirth to connect and to transfer information from databases between 2 pc's, but i've never used mirth.so i dont know what to do.
Reply With Quote
  #4  
Old 05-19-2017, 06:25 AM
narupley's Avatar
narupley narupley is online now
Mirth Employee
 
Join Date: Oct 2010
Posts: 7,123
narupley is on a distinguished road
Default

Quote:
Originally Posted by Stikarty View Post
Im working on a project for an hospital where i have to use mirth to connect and to transfer information from databases between 2 pc's, but i've never used mirth.so i dont know what to do.
Sounds like you will want to look at the Database Reader and Database Writer connectors.
__________________
Step 1: JAVA CACHE...DID YOU CLEAR ...wait, ding dong the witch is dead?

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
  #5  
Old 05-19-2017, 06:39 AM
appsbyaaron's Avatar
appsbyaaron appsbyaaron is offline
Mirth Guru
 
Join Date: Nov 2011
Location: Florida, USA
Posts: 377
appsbyaaron is on a distinguished road
Default

Here is the basic format that I use to connect to databases within Mirth Connect. This code is used in a JavaScript Transformer. I use it a lot in the source transformer. I currently have a Channel with a Database reader to get basic information then have this code within the source transformer to use the channel results to run additional queries including updating other tables. Very dynamic.

You'll need to edit to work in your environment, obviously, like using correct driver and address.



PHP Code:
//DB Query skeleon

var dbConn;
var 
result;
var 
driver 'net.sourceforge.jtds.jdbc.Driver';
var 
address 'jdbc:jtds:sqlserver://servername:1433/DBname';
var 
username 'username';
var 
password 'password';

try {
    
dbConn DatabaseConnectionFactory.createDatabaseConnection(driveraddressusernamepassword);    //Connection 
    
var sql 'select stuff';    //The select statement
    
result dbConn.executeCachedQuery(sql);    //Run the query and get the results
    
var cnt result.size();    //get the number of rows returned in the query
    
for (0cnti++) {     //loop it up
        
result.next();      //go to the first row    
    
        
var item1 result.getString(1);    //get the first item in the results
    
    
}
finally {
    if (
dbConn) {
        
dbConn.close();
    }


Last edited by appsbyaaron; 05-19-2017 at 06:41 AM.
Reply With Quote
  #6  
Old 05-19-2017, 07:22 AM
Stikarty Stikarty is offline
What's HL7?
 
Join Date: May 2017
Location: Portugal
Posts: 3
Stikarty is on a distinguished road
Default continuation

we're using xampp to create the database, more properly phpmyadmin (MYSQL).
what do i need to do, to connect the database from xampp to mirth.
what should i put on these camps ?
Untitled.png
Reply With Quote
Reply

Tags
begining, database, mirth hosts, mysql, tables

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 03:19 PM.


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