How can I dump a MySQL database from mysql c library - c++

I want to archive my database of mysql. Kindly give me some guide lines how I can make it possible, I am using mysql c library for insertion and selection etc. I dont know how to use dump command.

Use SHOW TABLES and DESCRIBE tbl_name queries to obtain structure of database and tables. Then, use SELECT to fetch data and proceed it to your output according to the structure.

Related

How to run dynamic queries in Informatica cloud mapping task?

I am new in informatica cloud. I have list of queries ready in my table. Like below.
Now I want to take one by one query from this table which work as a source query and whatever results return which I need to load into target. All tables were already created in source and target.
I just need to copy the data based on dynamic queries which kept in my one of sql tables.
If anyone have any idea then please share your toughs with me. It great helps to me.
The source connection will be the connector to your source database and the Source Type will be query. From there it depends how you are managing your variables. See thread on Informatica Network for links to multiple examples.
Read the table like normally you would do in the cloud. Then pass each of the record into the sql transformation for execution. configure where the sql transformation has to execute and it will run the queries in the database you want.
you can use a SQL task to run dynamic SQL queries.
link to using SQL task approach: https://www.datastackpros.com/2019/12/informatica-cloud-incremental-load_14.html

Importing to SQL Mysql instance

I'm importing data from Storage to SQL GCP (MySql datacloud). When I select the .sql file and the database there is an error message: Sorry, there’s a problem. If you entered information, check it and try again. Otherwise, the problem might clear up on its own, so check back later.
I'm trying using only one catalog table and I have the same mistake. Could you help me? please
Have you created the database before?
It seems that the problem might be with the sql file, that file is a sql dump?
The normal process for migrating to CloudSQL would be:
Create the instance, if your source will be (MySQL) you need to select MySQL.
Create database
Select the database, IMPORT
Select from sql file, and select the file
You need to have permissions for creating an instance and database.
Are you able to input correct parameters like (correct GCS path, valid file, correct database name and table)? Please note that for compressed (.gz file) and sql (dump) file, SQL format should be selected instead of CSV.

Database connection and save data from c++ program to MySQL

I never had to deal with database, therefore, sorry in advance!
I was asked to create a database for a project and store data output from a c++ program into the database. I informed on Google about databases, and I came across with MySQL, and in particular database connection. As far as I understood, in the first place a database has to be created (for example with MySQL), and once data are inserted, it’s possible to access to them. However, it’s not totally clear what is possible to achieve with such a connection and how to save data from a c++ program into the database directly.
Based on what I read on the net, these should be related, is it right? I would really need some help, example or clarification about these two questions. Thanks in advance for your time!
First you should create DB and tables.
You can do it in each DB IDE wizards, or you can write it in a script.
So here are scrypt for MySQL
CREATE DATABASE test_db --this create DB called test_db
I guess you should store a message and a timestamp so a possible table (In MySQL) will be:
USE test_db -- from now on the script using test_db unless specified explicit DB
--creating table with id, mmessage and timestamp
CREATE TABLE output_table (
msg_ID INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
msg VARCHAR(max),
msg_TS TIMESTAMP DEFAULT CURRENT_TIMESTAMP)
In the above table you only need to give the message since all the rest are filled automatically. So Insert into the table command may look like this:
INSERT INTO output_table (msg) values ('this is a message')
When you want to check the whole table you run the following:
SELECT * FROM output_table
Now you need to connect this code to your c++ code:
Generally, you'll need to know db name, user name and password in manner to connect to DB.
You can use ODBC + MySQL ODBC Connector. It is better since you are not limitted in your c++ to a specific DB. If you are sure you will use only MySQL you can use also MySQL C++ Connector directly. Anyway, both will give you option to run SQL commands on your DB.
HERE you can fine MySQL c++ connector sample
HERE you can find ODBC sample.

Want to import data from old database(mysql) to new database(mysql) in kettle

Hi i have a scenerio i have a database dump which i want to import in my new rails web applications database i have used activerecord etl gem but now the demand is that use kettle etl for importing the data. i have no idea of kettle can someone help me or link me the tutorials from where by following it i can do my job?
thanks in advance :)
Actually it's very easy. Just use Table Input to read from current MySQL Table, do some transformation, pipe it to Table Output. In the Table Output, point it to target MySQL connection, fill in the table name and click "Generate SQL" button to execute the DML generated.
For example you can see my article for a sample Excel to MySQL, but the operation can easily converted for MysQL-MySQL migration. (The site is in Indonesian - you can translate it using Google Translator)
http://pentaho.phi-integration.com/kettle/export-excel-ke-mysql

How to query a DB table from C++

I have C++ code, and from it I need to access the DB and make a query in table (with name NECE_TABLE, which has 2 columns - IntID and Status).
Here I need to get "status" column value from DB table (NECE_TABLE) using the IntID from C++ code.
Any help will be greatly helpful. Thanks in advance
Your question is very vague, but in summary you need to:
Use an appropriate client library supported by your database to connect to that database using some user credentials with appropriate permissions for SELECTing from your table
Execute a SQL select to fetch the data you want
There's some confusion as to which database you're using.
If you're using Oracle, you can use the OCCI client library to connect to the database and execute SQL statements. See section 2 of the linked document, where it describes connecting to a database and executing SQL queries.
Take a look at this link - it's a simple tutorial on how to get started with MySQL and C++. You say you are using vanilla SQL in your tags, but the two should be compatible as long as you stick to the more basic queries.