How to use a database to save all SMS messages
This guide explains how to setup a Microsoft SQL Database server to save all SMS messages going through the system. This setup makes it possible for you to create reports, write bills or to calculate the cost of operating your SMS gateway system. (Figure 1)
Saving all messages in a database (Quick Steps)
- Open the 'Reporting' from the Edit menu
- Click on 'Create new SMS Reporter'
- Select MS SQL type database
- Enter the connection details (Server, Port, Database, UserID and Password)
- Make sure that the database connection is established
- Go to the Table layout tab
- Copy the corresponding query to create the table for the reporting
- Go to the SQL tab
- Paste the create table query and execute it
- Send test message from Admin user
- Go to the MS SQL Reporter
- Query messages from database
Firstly, open the Reporting from the Edit menu in the navigation bar (Figure 2).
In the Reporting menu click on the Create new SMS Reporter button and then select MS SQL type database (Figure 3).
Now enter the connection details like Server, Port, Database, UserID and Password. And enter the Connection name. Finally click on the OK button (Figure 4).
In the Events tab you can see the logging of the latest server events. As you can see on the Figure 5 the database connection is established.
On the Table layout tab, you can find the corresponding query to create the table for the reporting. Copy it from here (Figure 6).
On the SQL tab you can execute SQL queries in the database connection. Paste here the create table query and execute it (Figure 7).
From the Admin user you can send test SMS message. Provide the recipient address, the message and click on the OK button (Figure 8).
Finally in the MS SQL Reporter you can query the messages from the database, and you will see there is a new message in the table (Figure 9).
How to test sms reporting
To test sms reporting, it is a good idea to setup an SMPP simulator system, and to send some test SMS messages to this system. The SMPP simulator is a simple configuration, that accepts sms messages using the built in SMPP server of the SMS gateway, and forwards these SMS messages to the sms tester connection. This simulator allows you to test sql reporting free of charge. We have used a similar setup when we have create a performance test of 1 000 000 sms messages to validate that Ozeki SMS Gateway can deliver up to 1000 sms / second.
FAQs
I have a database user in the system, and the logging is slow at times, the events appear in the log with some delay. Why? How can I fix this issue?
Ozeki SMS Gateway can optimize performance with proper database indexing.
Here's why indexing helps:
- When you have a high number of messages, logging can become slow because the system needs to constantly update the database.
- Indexing specific database fields speeds up these updates, leading to faster logging overall.
How to set up indexing:
- Open the "Edit" menu and select "Server preferences."
- Navigate to the "Databases" tab.
- Look for tables related to message logs, such as "Received" or "Accepted for delivery."
- Within each table, identify the "where" conditions used for filtering messages during searches. These conditions often involve specific message fields.
- Consider indexing those fields for faster database updates and improved logging performance.
What is the recommended database server for SQL logging?
Here are a few ways to rephrase "We recommend Microsoft SQL Server. It has a
relatively bug free native OleDb driver, and a good implementation for storing
large volume of data.":
Formal:
For optimal performance and scalability, we recommend using Microsoft SQL
Server. Its native OleDb driver offers exceptional reliability and stability,
while the database itself excels at handling large datasets.
Benefit-focused:
Ensure seamless data management with Microsoft SQL Server. Its robust native
OleDb driver minimizes the risk of errors, and the database is specifically
optimized for storing and managing massive amounts of data.
More concise:
Microsoft SQL Server is our preferred choice due to its reliable OleDb driver
and efficient handling of large datasets.
Any configuration lost after making any restarts? What can I do about this?
Your message recipient might be outside your service area, or the number format
is incorrect.
Here are two possibilities:
- International Number Format: If you're trying to send messages internationally or to roaming recipients, you need to use the international number format. This typically includes a country code prefix (e.g., +44 for UK, +1 for USA). For details on international number formats, visit our FAQ on SMS number formats.
- SMS Service Provider Restriction: It's also possible your SMS service provider restricts sending messages to certain countries or mobile networks. To confirm, contact your provider and provide details about the specific country and mobile network where delivery is failing.
My messages are not received abroad. What can cause this problem?
We're having trouble sending your message. Here are two possible reasons:
- International Number Format: If you're trying to reach someone internationally or a roaming recipient, you might need to use the international number format. This typically includes a plus sign (+) followed by the country code and phone number (e.g., +44 for UK, +1 for USA). For details on international number formats, visit our FAQ on SMS number formats.
- SMS Service Provider Restriction: It's also possible your SMS service provider restricts sending messages to certain countries or mobile networks. To confirm, contact your provider and provide details about the specific country and mobile network where delivery is failing.