summaryrefslogtreecommitdiff
path: root/docs/manual/smsd/odbc.rst
blob: d32e41ff6d4de3ba7c39fbdb914bee17a65a109f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
.. _gammu-smsd-odbc:

ODBC Backend
============

Description
-----------

.. versionadded:: 1.29.92

ODBC backend stores all data in any database supported by `ODBC`_, which
parameters are defined by configuration (see :ref:`gammu-smsdrc` for description of
configuration options).

For tables description see :ref:`gammu-smsd-tables`.

This backend is based on :ref:`gammu-smsd-sql`.

Supported drivers
-----------------

On Microsoft Windows, Gammu uses native ODBC, on other platforms, `unixODBC`_
can be used. 

.. _ODBC: https://en.wikipedia.org/wiki/Open_Database_Connectivity
.. _unixODBC: http://www.unixodbc.org/

Limitations
-----------

Due to limits of the ODBC interface, Gammu can not reliably detect which SQL
engine it is connected to.

In most cases this can be solved by setting :config:option:`SQL` setting to
correct dialect.

If that fails, you can also tweak the SQL queries to work in used SQL server,
see :ref:`SQL Queries` for more details. Still you should set 
:config:option:`SQL` to closest matching SQL dialect.

Configuration
-------------

Before running :ref:`gammu-smsd` you need to create necessary tables in the
database. You can use examples given in database specific backends parts of
this manual to do that.

You specify data source name (DSN) as :config:option:`Host` in
:ref:`gammu-smsdrc`. The data source is configured depending on your platform.

.. note::

    Please remember that SMSD might be running in different context than your
    user (separate account on Linux or as as service on Windows), so the ODBC
    DSN needs to be configured as system wide in this case (system DSN on
    Windows or in global configuration on Linux).

On Microsoft Windows, you can find instructions on Microsoft website:
https://support.microsoft.com/kb/305599

For unixODBC this is documented in the user manual:
http://www.unixodbc.org/doc/UserManual/

Creating tables
---------------

Prior to starting SMSD you have to create tables it will use. Gammu ships SQL
scripts for several databases to do that:

* :ref:`mysql-create`
* :ref:`pgsql-create`
* :ref:`sqlite-create`


Example
-------

Example configuration:

.. code-block:: ini

    [smsd]
    service = sql
    driver = odbc
    host = dsn_of_your_database
    sql = sql_variant_to_use
    user = username
    password = password

.. seealso:: :ref:`gammu-smsdrc`