Loading from RDBMS
As the final recipe on loading, let's try to load data from an RDBMS data source, which is MySQL in our case. This recipe assumes that you have already installed MySQL in your machine.
How to do it…
Let's go through the prerequisite steps first. If you already have a MySQL table to play with, you can safely ignore this step. We are just going to create a new database and a table and load some sample data into it.
The prerequisite step (optional):
- Creating a database and a table: This is achieved in MySQL by using the create database and the create table DDL:
create database scalada; use scalada CREATE TABLE student ( id varchar(20), `name` varchar(200), phone varchar(50), email varchar(200), PRIMARY KEY (id));
- Loading data into the table: Let's dump some data into the table. I wrote a very simple app to do this. Alternatively, you can use the
load data infile
command if you have"local-infile=1"
enabled on your server and the client. Refer to...