SMS from/to PostgreSQL
This chapter gives you great opportunity to see how to send and receive SMS messages through pre-created PostgreSQL database tables. You just need to connect to them with a Database User of Ozeki SMS Gateway. Do not forget to provide the ODBC driver connection string for the user.
Please install two important programs. A simple PostgreSQL database server and an Ozeki SMS Gateway, which is capable to create a Database User and connect to the PostgreSQL database using the connection string. Check this page how to install a Database User. Do not forget to create a separate table for the outgoing and incoming messages. These tables are called 'ozekimessagein' and 'ozekimessageout' in the current example. Send and receive SMS messages by using simple SELECT and INSERT SQL statements on the tables.
Use Ozeki SMS Gateway's browser GUI to install a Database User and provide a connection string similarly as you would do it for other databases (e.g. MSSQL, Oracle, MySQL etc.) PostgreSQL uses an ODBC connection string. Please select 'Odbc' connection string on the Database User's configuration panel as seen on Figure 2 and use this string:
It works if you modify the variables by using the information of your PostgreSQL database server (Figure 2).
Install psqlODBC driver
The ODBC driver can be downloaded from:
Install psqlODBC driver by using the downloaded exe file and clicking through the dialog boxes of the installation process.
The psqlODBC driver is needed to create a database connection. It is required to open database connectivity on your ODBC driver, so Ozeki SMS Gateway can connect to your PostgreSQL database.
CREATE tables in PostgreSQL
PostgreSQL accepts simple SQL statements. You can see how to CREATE two separate tables for incoming and outgoing messages in Figure 3.
The CREATE TABLE script in PostgreSQL:
You can always increase the size of the 'msg' field above 160 characters. You can also change it's data type as well.
It is strongly suggested to maintain the 'id' attribute in all tables. 'id' is basicly the index of each record.