Database to Database Duplication in Mirth - mysql

I am new to Mirth COnnect software. Will somebody guide me how can i populate my destination database. I had successfully setup Oracle Database as Source Channel and Mysql as Destination. But in Destination channel beside providing the basic information i failed to understand how to make Mirth do the required task.
Thanks

You're asking a very broad question. It seems like you need a tutorial about Mirth Connect rather than a specific question. I'll try to answer it here anyway.
First review the tutorials for Mirth Connect at the Mirth Connect Wiki. You will not find an exact example for your use case. You need to learn three things:
1. How to read from a DB
1. How to map variables from source messages to map variables
1. How to write to a DB
Review those examples and pick out the ones that cover the three items listed above.
You will need to create a channel that works like this:
Your source connector will be a Database Reader which queries Oracle for the data you need. This would run a SELECT statement with an optional UPDATE statement which runs after the data is processed.
Your destination will be a Database Writer that runs INSERT or UPDATE statements against MySQL
The hard part is writing the mappings. If you set up your source connector and look at the message view you will see the XML representation Mirth Connect uses for database read operations. Copy this message.
Paste that message into the template for the destination transformer for your MySQL step. You can now use the mapper to choose elements from that source message and map them to variables. You should almost always map them as channelMap variables.
After you have pulled the data from your source reader to map variables you can now use those variables in the database writer template to populate the destination connector with the actual data to write.

Related

Connecting a database with Thingsboard

Will you Please help me in one more important thing??? I need to store dashboard's data in a database.. according to my study thingsboard supports 3 database at the moment. NoSQL, Mysql and Hybrid (Psql+cassandra) so i have researched a lot but could not find any way to send my telemetry data to any database. I know it is possible because the thingsboard doc itself say so... but how do i do that?? I checked Psql database thingsboard that i created during installation but there are those relations are present that was made by default. i need to store my project's data in databases just like in AWS we store IoT core's data in Dynamo DB or in IoT analytics. Thingsboard do not provide any node related to DB in his rule engine?? so How do i make a rule chain to transfer my projects data in any Database server. i have installed pgadmin4 to Graphically see the database but nothing useful found. Documentation and stakoverflow geeks said that configuring Thingsboard.yml file located in monolithic installation on linux (/etc/thingsboard/conf/thingsboard.conf ) in this path it have cassandra,mysql,postgres configuration but how to properly configure it??? i tried to access the default database of postgres named thingsboard that i created on installing time but when i list the content of database it only shows the default things/relations of thingsboard if i create a device on thingsboard that is not showing in database why?? I really can use your help. Please enlighten me a way to connect my THINGSBOARD with a DATABASE.
see in my attached images there are everything default, nothing that i create on thingsboard.
enter image description here
That's wrong, ThingsBoard currently supports 3 database setups: Postgres only, Hybrid Postgres + Cassandra (only telemetries) & Postgres + Timescale. So there is no MySQL database used anywhere.
https://thingsboard.io/docs/user-guide/install/ubuntu/#step-3-configure-thingsboard-database
Find guides for connecting your devices to Thingsboard here, e.g. via MQTT:
https://thingsboard.io/docs/reference/mqtt-api/
If you would like to forward the stored telemetries of ThingsBoard to different databases, this is not possible directly with rulechains (there's only one node to store data in a cassandra table)
One way to achieve this, would be fetching the data with an external microservice/program via HTTP API and persisting the data in the database of your choice. You could use a python script for example.
https://thingsboard.io/docs/reference/rest-api/
Alternatively, you can send the data to a Message queue like Kafka instead of fetching via HTTP API. But still it would require additional tools for storing the data in external databases outside ThingsBoard.

MySQL help figuring out structure of databases

I am a java programmer trying to make the jump to web development and database management. I am trying to figure out the structure of web services in general and I will try to ask some questions that lead to definite non-abstract answers, but I barely understand MySQL so please forgive me if my question has no answer, or is wrong or something.
I understand the concept of a relational database, but I don't understand the how it is implemented in MySQL or SQL in general. Is there a database file somewhere I don't know... Basically my question is how does MySQL store databases and what is the proper way to interact with them?
also is there a way to set up a MySQL database that is not on a server?
Follow the directions here: http://docs.oracle.com/javase/tutorial/jdbc/basics/gettingstarted.html , for MySQL.
Most RDBMSs, including MySQL, are implemented as servers to which your Java program connects using the JDBC interfaces. There are a few that have local files -- derby, sqlite, access -- but not in general.
Basically, it goes like this:
Java program issues a connect request to a server.
RDBMS Server accepts connect request.
Java program prepares a SQL query, like
SELECT name, address FROM customer WHERE status = 'active' and zip = ?
Java program binds variables to the query. e.g. variable 1 = string '90210'.
Java program issues query.
RDBMS carries out query, and sends a result set to Java.
Java program receives result set row - by - row and does what it needs to do

How to do a query in Mysql WorkBench?

I have an .sql script that contains inserts and creates tables. I used the "Create EER Model From Script"
It created the tables but I can't see the data inside these tables.
I went to the query menu and tried to make a query but it gives me an error about not being able to connect to localhost.
Am I doing it right?
As documented under Create EER Model from SQL Script:
Clicking this action item launches the Reverse Engineer SQL Script wizard. This is a multi-stage wizard that enables you to select the script you want to create your model from.
For further information, see Section 7.7.9.1, “Reverse Engineering Using a Create Script”.
Following that link:
However, if you are working with a script that also contains DML statements you need not remove them; they will be ignored.
Instead, you want the Manage Data Import/Export option under Server Administration (within the Workspace section of the Home window).
You are confusing things here. Creating a model from a script is a process where meta data is examined and a model is created that you can then use to modify your schema structure, further design your db objects and all that. Modeling is a design process for the structure of your schema/db so it only deals with meta data. It's also used for documentation (e.g. in teams).
On the other hand there's normal sql work with existing db objects and/or actually creating/deleting/modifying db objects. In order to do the latter you must have an understanding of the design of the schema (which you could get by using the modeling part of MySQL Workbench, but not only by that). This is also the place to load a script, run it to insert data and such.
The error you mentioned regarding the connection is yet another problem and you need to solve this first to be able to even access your server. And yes, you have to install a server first somewhere. MySQL Workbench is a tool to visually work with your server(s) in opposition to the MySQL command line client which is a pure text interface (but still also a client application for your MySQL servers).
If you are on Windows and want a MySQL server installed locally (e.g. for testing) your best option is to download the MySQL Installer which greatly simplifies installing any of the tools from the MySQL family (server, client tools, connectors, documentation and more).

connecting Visual Fox Pro to MySql database

I converted visual foxpro DBF to mysql and I need to connect the vfp code directly to the mysql database.Please help.thanks
There are a number of ways to access data from a server database from VFP, but I'm not sure you'd call any of them connecting directly to the server database. Specifically, you can't use commands like USE and REPLACE directly against a server database, nor can you bind form controls directly to the server data.
Whichever approach you use, you pull some data from the server into a cursor in VFP, operate on the cursor, and then, if appropriate, save changes back to the server.
The three main approaches are:
1) Remote views--with this approach, you store SQL queries in a database. To run the query and pull data from the server, you USE the remote view.
2) SQL Pass-Through (SPT)--with this approach, you use the SQLEXEC() command to send SQL commands to the server, and get results.
3) CursorAdapter class--with this approach, you set up a class that describes how you want to get data from the server, and when you call the CursorFill() method, you get a cursor full of data.
You should choose one of these approaches and use it throughout your application. They each have pros and cons.
To get you started, since you'll probably want to use SPT for testing purposes (like in the Command Window) anyway, here's the basics of that approach:
First, you have to connect to the database. You do that with either the SQLConnect() or SQLStringConnect() function. For example:
You'll need to fill in your userid and password where indicated.
nHandle = SQLStringConnect("driver={MySQL ODBC 5.1 Driver};SERVER=localhost;UID=;pwd=")
A positive value for nHandle indicates success. Once you have a handle, you use it to send additional commands. For example:
nSuccess = SQLEXEC(m.nHandle, "SELECT First, Last FROM Customers WHERE State='PA'", "csrPACustomers")
That tells MySQL to execute the query you pass in and put the results in csrPACustomers. nSuccess indicates success or failure.
When you're done, use SQLDisconnect() to close your connection:
SQLDisconnect(m.nHandle)
You can read about all three approaches to remote data in the VFP Help file and on the VFP Wiki (http://fox.wikis.com). Once you decide which approach you want to use, you can ask specific questions.

Update MySQL database from SQL Server in different domain

I am SQL Server developer and the current assignment is little different than what I have done in past. I found Stack Overflow very promising for my problem. I am working on the SQL Server 2005 database for the internal application for my client and the client also got the public facing web application with MySQL database. I do not have any details about this web application, but I got the assignment to update the MySQL database (on public domain) from the SQL Server database (internal domain) on daily basis as auto process. How can I achieve this through the SQL Server?
You might want to try Pentaho Data integrator.
http://wiki.pentaho.com/display/EAI/Latest+Pentaho+Data+Integration+%28aka+Kettle%29+Documentation
The product would allow you to speak to both data technologies. (MSSQL+MySQL) You will find the product similar to DTS. You may be able to construct your solution will little to no code.
SSIS will do this just fine. The hard part is determining how you want to transform the data from one structure to the other (I assume they are not exactly alike in terms of table design.)
But basically you create a dataflow task, connect to the SQL Server for the source data and use a query to define what data you are going to copy, then you do any transformations needed to make the data fit into the MySQL structure and connect to a MySQL destination.
Repeat this process for mulitple data sets you want to send to differnt places.
Once the SSIS pacakge is done, set up configurations so that you can run the package on the production server (you will want to test development to development of course!) then schedule the package to run at an appropriate time.
Depending on how different the two databases are and how much data you need to move, this can be a relatively simple process or very complicated.