Announcement

Collapse
No announcement yet.

acessing databases

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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.

  • #2
    Can you please provide more detailed information?
    What you pretend?
    Best Regards,
    Alex Neiva

    Comment


    • #3
      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.

      Comment


      • #4
        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.

        Comment


        • #5
          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, 06:41 AM.

          Comment


          • #6
            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

            Comment

            Working...
            X