MySQL create table script

Introduction

To create an SQL SMS Gateway with Ozeki NG, you can use a MySQL database, which can be accessed using an ADO or ODBC driver. All you have to do is create two database tables (in the ozekisms database): ozekimessagein and ozekimessageout. (The tables can have additional columns.) Ozeki NG will insert the incoming messages into the ozekimessagein table. If you want to send a message, you should insert a record into the ozekimessageout table. The SMS Server periodically checks this table for messages to send.

Database and tables creating

Copy the following text into a Notepad file, and then save it as C:\mysql_create.txt. This will create the ozekisms database including the ozekimessagein and the ozekimesageout table. Then, it will create a user called "sqluser" with the password "abc123" (these values can be freely modified). This user will be authorized to query, modify, delete rows or to insert new rows in the tables of the ozekisms database. You can also download this file here: mysql-sms-create-table.txt.



CREATE DATABASE ozekisms;

USE ozekisms;

CREATE TABLE ozekimessagein
(
id int(11) NOT NULL auto_increment,
sender varchar(30) default NULL,
receiver varchar(30) default NULL,
msg varchar(1024) default NULL,
senttime varchar(100) default NULL,
receivedtime varchar(100) default NULL,
operator varchar(100),
msgtype varchar(160) default NULL,
PRIMARY KEY (id)
);

CREATE TABLE ozekimessageout
(
id int(11) NOT NULL auto_increment,
sender varchar(30) default NULL,
receiver varchar(30) default NULL,
msg varchar(1024) default NULL,
senttime varchar(100) default NULL,
receivedtime varchar(100) default NULL,
status varchar(20) default NULL,
msgtype varchar(160) default NULL,
operator varchar(100),
PRIMARY KEY (id)
);

grant insert,update,select,delete on ozekisms.* to sqluser@localhost
identified by 'abc123';

To start the MySQL Command Line Client: Start menu -> All Programs -> MySQL ->MySQL Command Line Client.

start the mysql sms command line client in the menu
Figure 1 - Start the MySQL Command Line Client in the menu

Then, enter the password and press  ENTER.

enter the mysql password
Figure 2 - Enter the MySQL password and press enter

Enter the following, and press ENTER:

source c:\mysql_create.txt

execute the source command
Figure 3 - Execute the source command to create SMS SQL tables

If everything is working properly, you should see something like this:

the result of the query
Figure 4 - The result of the SMS database query

You can check the result by issuing the following statements:

use ozekisms;
desc ozekimessagein;
desc ozekimessageout;

checking the result
Figure 5 - Checking the result by issuing the following MySQL statements

More information