1.. _gammu-smsd-odbc:
2
3ODBC Backend
4============
5
6Description
7-----------
8
9.. versionadded:: 1.29.92
10
11ODBC backend stores all data in any database supported by `ODBC`_, which
12parameters are defined by configuration (see :ref:`gammu-smsdrc` for description of
13configuration options).
14
15For tables description see :ref:`gammu-smsd-tables`.
16
17This backend is based on :ref:`gammu-smsd-sql`.
18
19Supported drivers
20-----------------
21
22On Microsoft Windows, Gammu uses native ODBC, on other platforms, `unixODBC`_
23can be used.
24
25.. _ODBC: https://en.wikipedia.org/wiki/Open_Database_Connectivity
26.. _unixODBC: http://www.unixodbc.org/
27
28Limitations
29-----------
30
31Due to limits of the ODBC interface, Gammu can not reliably detect which SQL
32engine it is connected to.
33
34In most cases this can be solved by setting :config:option:`SQL` setting to
35correct dialect.
36
37If that fails, you can also tweak the SQL queries to work in used SQL server,
38see :ref:`SQL Queries` for more details. Still you should set
39:config:option:`SQL` to closest matching SQL dialect.
40
41Configuration
42-------------
43
44Before running :ref:`gammu-smsd` you need to create necessary tables in the
45database. You can use examples given in database specific backends parts of
46this manual to do that.
47
48You specify data source name (DSN) as :config:option:`Host` in
49:ref:`gammu-smsdrc`. The data source is configured depending on your platform.
50
51.. note::
52
53    Please remember that SMSD might be running in different context than your
54    user (separate account on Linux or as as service on Windows), so the ODBC
55    DSN needs to be configured as system wide in this case (system DSN on
56    Windows or in global configuration on Linux).
57
58On Microsoft Windows, you can find instructions on Microsoft website:
59https://support.microsoft.com/kb/305599
60
61For unixODBC this is documented in the user manual:
62http://www.unixodbc.org/doc/UserManual/
63
64Creating tables
65---------------
66
67Prior to starting SMSD you have to create tables it will use. Gammu ships SQL
68scripts for several databases to do that:
69
70* :ref:`mysql-create`
71* :ref:`pgsql-create`
72* :ref:`sqlite-create`
73
74
75Example
76-------
77
78Example configuration:
79
80.. code-block:: ini
81
82    [smsd]
83    service = sql
84    driver = odbc
85    host = dsn_of_your_database
86    sql = sql_variant_to_use
87    user = username
88    password = password
89
90.. seealso:: :ref:`gammu-smsdrc`
91