annotate Sphinx/source/plugins/odbc.rst @ 1113:a588960a72e5 default tip

spelling
author Alain Mazy <am@orthanc.team>
date Mon, 28 Oct 2024 09:23:08 +0100
parents 17bf6fafb884
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
750
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 .. _odbc:
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4 ODBC plugins
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5 ============
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 .. contents::
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 The Orthanc project provides two **official** plugins to replace the
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 default storage area (on the filesystem) and the default SQLite index
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 by a `ODBC database
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 <https://en.wikipedia.org/wiki/Open_Database_Connectivity>`__. This
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 can notably be used to connect Orthanc to Microsoft SQL Server.
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 The source code of the ODBC plugins can be found in the
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 ``orthanc-databases`` `Mercurial repository
991
1316bc62b5d5 migration to UCLouvain servers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 789
diff changeset
17 <https://orthanc.uclouvain.be/hg/orthanc-databases/>`__, next to the
750
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 source code of the :ref:`PostgreSQL <postgresql>` and
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 :ref:`MySQL/MariaDB <mysql>` plugins.
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22 When to use ODBC?
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23 -----------------
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25 In general, you'll always get better performance by using native C/C++
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26 plugins dedicated to one single database engine, instead of the ODBC
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27 plugins that can connect to any database driver. This is the price of
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28 genericity: Some specific optimisations can only be done if focusing
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 on one single database.
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31 That being said, there are multiple use cases for the ODBC plugins:
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32
751
37512473ffe9 improved odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 750
diff changeset
33 * Connection to Microsoft SQL Server (MSSQL), including Microsoft
37512473ffe9 improved odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 750
diff changeset
34 Azure SQL, is only possible with ODBC. Note that the ODBC plugins
37512473ffe9 improved odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 750
diff changeset
35 were only validated against MSSQL 2017 and MSSQL 2019, under
37512473ffe9 improved odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 750
diff changeset
36 GNU/Linux.
750
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38 * Contrarily to the built-in SQLite engine and to the MySQL/MariaDB
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39 index plugin, the ODBC index plugin supports the :ref:`revision
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40 mechanism <revisions>` to protect metadata and attachments from
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41 concurrent modifications.
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43 * Because of its genericity, the ODBC storage area plugin does not
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44 implement the :ref:`read-range primitive <registry>`. As a
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45 consequence, using it will write two attachments for each stored
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46 DICOM instance (namely, ``Attachment 1`` that corresponds to the
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47 DICOM instance itself, and ``Attachment 3`` that corresponds to the
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48 tags before the pixel data).
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50 * The Linux Standard Base (LSB) `pre-compiled binaries
993
05b106383b2a migration to UCLouvain servers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 991
diff changeset
51 <https://orthanc.uclouvain.be/downloads/linux-standard-base/orthanc-odbc/index.html>`__ of the ODBC plugins
750
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
52 are not compatible with the ``libsqliteodbc`` `Debian/Ubuntu package
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
53 <http://www.ch-werner.de/sqliteodbc/>`__ because the latter package
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
54 was compiled with the ``HAVE_SQLITE3LOADEXTENSION`` flag.
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
55
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
56 * Finally, make sure to read the :ref:`recommended setup for best
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
57 scalability <scalability>`.
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
58
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
59 Very importantly, pay attention to the fact that the ODBC plugins use
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
60 a different database schema than the built-in SQLite driver, and than
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
61 the PostgreSQL/MariaDB/MySQL plugins. As a consequence, it is **not
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
62 possible to switch back and forth** between ODBC and the native
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
63 drivers without running a :ref:`full replication procedure
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
64 <replication>`. As a consequence, pay attention to choose the right
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
65 plugin from the beginning, as you will need to stick to it.
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
66
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
67 Summarizing, here are two tables containing our recommendations about
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
68 when to use the ODBC plugins:
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
69
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
70 +------------------------------+--------------------------------------------------------+
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
71 | Database management system | Recommended index plugin |
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
72 +==============================+========================================================+
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
73 | Microsoft SQL server (MSSQL) | ODBC plugin |
751
37512473ffe9 improved odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 750
diff changeset
74 | or Microsoft Azure SQL | |
750
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
75 +------------------------------+--------------------------------------------------------+
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
76 | MySQL (with revisions) | ODBC plugin |
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
77 +------------------------------+--------------------------------------------------------+
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
78 | MySQL (without revisions) | :ref:`MySQL plugin <mysql>` |
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
79 +------------------------------+--------------------------------------------------------+
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
80 | PostgreSQL | :ref:`PostgreSQL plugin <postgresql>` |
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
81 +------------------------------+--------------------------------------------------------+
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
82 | SQLite (with revisions) | ODBC plugin |
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
83 +------------------------------+--------------------------------------------------------+
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
84 | SQLite (without revisions) | No plugin needed |
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
85 +------------------------------+--------------------------------------------------------+
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
86 | Other | Create a :ref:`dedicated plugin <creating-plugins>` |
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
87 | | or implement a new dialect in the ODBC plugins |
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
88 +------------------------------+--------------------------------------------------------+
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
89
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
90
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
91 +------------------------------+--------------------------------------------------------+
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
92 | Type of storage area | Recommended storage plugin |
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
93 +==============================+========================================================+
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
94 | Filesystem | No plugin needed |
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
95 +------------------------------+--------------------------------------------------------+
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
96 | Microsoft SQL server (MSSQL) | ODBC plugin |
751
37512473ffe9 improved odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 750
diff changeset
97 | or Microsoft Azure SQL | |
750
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
98 +------------------------------+--------------------------------------------------------+
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
99 | MySQL | :ref:`MySQL plugin <mysql>` |
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
100 +------------------------------+--------------------------------------------------------+
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
101 | PostgreSQL | :ref:`PostgreSQL plugin <postgresql>` |
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
102 +------------------------------+--------------------------------------------------------+
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
103 | SQLite | ODBC plugin |
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
104 +------------------------------+--------------------------------------------------------+
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
105 | Google Cloud Storage, Azure | :ref:`Cloud object storage plugins <object-storage>` |
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
106 | blob storage, AWS S3 | |
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
107 +------------------------------+--------------------------------------------------------+
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
108 | Other | Create a :ref:`dedicated plugin <creating-plugins>`, |
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
109 | | implement a new dialect in the ODBC plugins, |
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
110 | | or prototype using :ref:`Python <python_storage_area>` |
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
111 +------------------------------+--------------------------------------------------------+
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
112
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
113
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
114 Compilation
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
115 -----------
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
116
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
117 Static linking
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
118 ^^^^^^^^^^^^^^
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
119
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
120 .. highlight:: text
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
121
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
122 The procedure to compile these plugins is similar to that for the
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
123 :ref:`core of Orthanc <compiling>`. The following commands should work
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
124 for most UNIX-like distribution (including GNU/Linux)::
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
125
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
126 $ mkdir BuildOdbc
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
127 $ cd BuildOdbc
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
128 $ cmake ../Odbc -DSTATIC_BUILD=ON -DCMAKE_BUILD_TYPE=Release
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
129 $ make
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
130
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
131 The compilation will produce 2 shared libraries, each containing one plugin for Orthanc:
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
132
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
133 * ``OrthancOdbcIndex`` replaces the default SQLite index of Orthanc by ODBC.
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
134 * ``OrthancOdbcStorage`` makes Orthanc store the DICOM files it receives into ODBC.
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
135
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
136
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
137 Microsoft Windows and Apple OS X
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
138 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
139
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
140 Pre-compiled binaries for Microsoft Windows 32bit `are also available
1004
17bf6fafb884 added links to uclouvain
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 993
diff changeset
141 <https://orthanc.uclouvain.be/downloads/windows-32/orthanc-odbc/index.html>`__,
17bf6fafb884 added links to uclouvain
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 993
diff changeset
142 as well as for `Apple macOS
17bf6fafb884 added links to uclouvain
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 993
diff changeset
143 <https://orthanc.uclouvain.be/downloads/macos/orthanc-odbc/index.html>`__.
750
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
144
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
145
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
146 .. _odbc-ubuntu1604:
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
147
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
148 Dynamic linking on Ubuntu 16.04
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
149 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
150
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
151 .. highlight:: text
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
152
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
153 If static linking is not desired, here are build instructions for
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
154 Ubuntu 16.04 (provided build dependencies for the :ref:`core of
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
155 Orthanc <compiling>` have already been installed)::
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
156
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
157 $ sudo apt-get install libodbc1 unixodbc unixodbc-dev
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
158 $ mkdir BuildOdbc
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
159 $ cd BuildOdbc
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
160 $ cmake ../Odbc -DCMAKE_BUILD_TYPE=Release \
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
161 -DALLOW_DOWNLOADS=ON \
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
162 -DUSE_SYSTEM_GOOGLE_TEST=OFF \
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
163 -DUSE_SYSTEM_ORTHANC_SDK=OFF
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
164 $ make
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
165
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
166
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
167
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
168 Usage
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
169 -----
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
170
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
171 You of course first have to :ref:`install Orthanc <binaries>`, with a
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
172 version above 0.9.5. You then have to **configure an ODBC data
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
173 source** dedicated to Orthanc. The procedure depends upon your
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
174 operating system:
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
175
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
176 * Many UNIX-like platforms (including Debian and Ubuntu) use `unixODBC
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
177 <https://en.wikipedia.org/wiki/UnixODBC>`__. You first have to
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
178 install at least one ODBC driver (e.g. on Debian, installing the
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
179 packages ``libsqliteodbc`` and ``odbc-postgresql`` will respectively
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
180 install the driver for SQLite and for PostgreSQL). Secondly, you
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
181 have to edit your ``~/.odbc.ini`` to define the data sources
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
182 (i.e. the actual databases).
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
183
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
184 * On Microsoft Windows, the configuration tool ``odbcad32.exe`` ("ODBC
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
185 Data Source Administrator") allows to define the data sources. You
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
186 also have to install at least one ODBC driver. For instance, the
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
187 `SQLite ODBC Driver <http://www.ch-werner.de/sqliteodbc/>`__ can be
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
188 used to access SQLite.
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
189
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
190 * If you are interested in interfacing Orthanc with Microsoft SQL
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
191 Server, the corresponding ODBC drivers can be `downloaded from
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
192 Microsoft
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
193 <https://docs.microsoft.com/en-us/sql/connect/odbc/download-odbc-driver-for-sql-server>`__.
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
194
751
37512473ffe9 improved odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 750
diff changeset
195 .. highlight:: json
37512473ffe9 improved odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 750
diff changeset
196
750
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
197 Once Orthanc is installed and the data sources have been defined, you
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
198 must add a section in the :ref:`configuration file <configuration>`
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
199 that specifies the **data source(s) to be used**. You also have to
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
200 tell Orthanc in which path it can find the plugins: This is done by
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
201 properly modifying the ``Plugins`` option. You could for instance
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
202 adapt the following configuration file::
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
203
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
204 {
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
205 "Name" : "MyOrthanc",
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
206 "Odbc" : {
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
207 "EnableIndex" : true,
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
208 "EnableStorage" : true,
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
209 "IndexConnectionString" : "DSN=index",
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
210 "StorageConnectionString" : "DSN=storage",
751
37512473ffe9 improved odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 750
diff changeset
211 "MaximumConnectionRetries" : 10,
37512473ffe9 improved odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 750
diff changeset
212 "ConnectionRetryInterval" : 5,
37512473ffe9 improved odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 750
diff changeset
213 "IndexConnectionsCount" : 1
750
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
214 },
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
215 "Plugins" : [
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
216 "/home/user/orthanc-databases/BuildOdbc/libOrthancOdbcIndex.so",
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
217 "/home/user/orthanc-databases/BuildOdbc/libOrthancOdbcStorage.so"
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
218 ]
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
219 }
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
220
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
221 The values of ``IndexConnectionString`` and
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
222 ``StorageConnectionString`` are known as `ODBC connection strings
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
223 <https://www.connectionstrings.com/>`__, and define how to connect to
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
224 the ODBC data source. These connection strings are specific to the
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
225 different types of ODBC drivers. In the following sections, we'll
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
226 review connection strings for SQLite, PostgreSQL, MySQL and Microsoft
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
227 SQL Server.
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
228
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
229 **Important:** The ``EnableIndex`` and ``EnableStorage`` options must
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
230 be explicitly set to ``true``, otherwise Orthanc will continue to use
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
231 its default SQLite back-end and the filesystem storage area.
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
232
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
233 **Remark 1:** When using the ODBC storage area plugin, the DICOM files
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
234 are stored as large objects in the database. This might actually
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
235 consume more space than the DICOM file itself.
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
236
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
237 **Remark 2:** A typical usage of the ODBC plugins is to enable only
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
238 the index plugin, and to use the default filesystem storage for DICOM
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
239 files (on a NAS with proper disaster recovery strategies).
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
240
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
241 Orthanc must of course be **restarted** after the modification of its
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
242 configuration file.
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
243
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
244
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
245 Supported ODBC drivers
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
246 ----------------------
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
247
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
248 The ODBC plugins for Orthanc are universal, in the sense that they can
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
249 connect to any ODBC driver. However, there are some minor variations
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
250 in the SQL language, that are known as "dialects" in the `source code
991
1316bc62b5d5 migration to UCLouvain servers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 789
diff changeset
251 of the plugins <https://orthanc.uclouvain.be/hg/orthanc-databases/>`__.
750
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
252
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
253 As of ODBC plugins 1.0, the supported dialects are Microsoft SQL
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
254 Server, PostgreSQL, MySQL and SQLite. Orthanc auto-detects the dialect
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
255 to be used. Adapting the ODBC plugins to support more dialects should
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
256 be fairly easy by adding new values to the
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
257 ``OrthancDatabases::Dialect`` enumeration in the C++ source code.
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
258
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
259 Also, note that the database for the index and the database for the
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
260 storage area can mix different type of ODBC drivers.
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
261
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
262 We now review sample `connection strings
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
263 <https://www.connectionstrings.com/>`__ for the supported ODBC drivers
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
264 under Ubuntu 18.04.
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
265
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
266
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
267 Microsoft SQL Server
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
268 ^^^^^^^^^^^^^^^^^^^^
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
269
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
270 .. highlight:: bash
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
271
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
272 1. Install the `ODBC driver for SQL server
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
273 <https://docs.microsoft.com/fr-fr/sql/connect/odbc/download-odbc-driver-for-sql-server>`__
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
274 (version 2017).
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
275
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
276 2. A **non-persistent** developer instance of MSSQL 2019 can be
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
277 started using the `Docker image provided by Microsoft
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
278 <https://hub.docker.com/_/microsoft-mssql-server>`__ as follows::
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
279
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
280 $ docker run --name mssql --rm -t -i -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=MyStrOngPa55word!' \
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
281 -e MSSQL_MEMORY_LIMIT_MB=512 -p 1433:1433 mcr.microsoft.com/mssql/server:2019-latest
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
282
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
283 3. Create a database dedicated to Orthanc in MSSQL::
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
284
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
285 $ /opt/mssql-tools/bin/sqlcmd -S 192.168.0.17 -U sa -P 'MyStrOngPa55word!' -Q 'CREATE DATABASE orthanctest'
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
286
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
287 .. highlight:: text
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
288
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
289 4. Create the following sample `unixODBC
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
290 <https://en.wikipedia.org/wiki/UnixODBC>`__ configuration file::
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
291
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
292 $ cat ~/.odbc.ini
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
293 [orthanctest]
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
294 Driver = ODBC Driver 17 for SQL Server
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
295 Server = tcp:localhost,1433
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
296 Database = orthanctest
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
297
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
298 Note that there exist `many more configuration options
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
299 <https://docs.microsoft.com/en-us/sql/relational-databases/native-client/applications/using-connection-string-keywords-with-sql-server-native-client>`__
751
37512473ffe9 improved odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 750
diff changeset
300 for Microsoft SQL Server. In particular, ``Encrypt`` and
37512473ffe9 improved odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 750
diff changeset
301 ``TrustServerCertificate`` and ``Connect Timeout`` can be
37512473ffe9 improved odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 750
diff changeset
302 interesting in the case of a connection to Microsoft Azure SQL.
750
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
303
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
304 .. highlight:: json
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
305
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
306 5. Start Orthanc using the following :ref:`configuration file
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
307 <configuration>` for ODBC::
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
308
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
309 {
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
310 "Odbc" : {
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
311 "EnableIndex" : true,
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
312 "EnableStorage" : true,
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
313 "IndexConnectionString" : "DSN=orthanctest;Uid=sa;Pwd=MyStrOngPa55word!",
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
314 "StorageConnectionString" : "DSN=orthanctest;Uid=sa;Pwd=MyStrOngPa55word!"
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
315 }
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
316 }
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
317
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
318 In the connection strings:
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
319
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
320 * ``DSN`` corresponds to the name of the entry in ``~/.odbc.ini``.
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
321 * ``Uid`` is the user name in MSSQL (by default, the Docker image uses ``sa``).
751
37512473ffe9 improved odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 750
diff changeset
322 * ``Pwd`` is the password that has been provided in the ``SA_PASSWORD``
37512473ffe9 improved odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 750
diff changeset
323 environment variable when starting Docker.
750
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
324 * For security reasons, the ``Uid`` and ``Pwd`` parameters cannot
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
325 be set in ``~/.odbc.ini``.
751
37512473ffe9 improved odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 750
diff changeset
326
37512473ffe9 improved odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 750
diff changeset
327 **Remark:** It is actually not necessary to create an entry in
37512473ffe9 improved odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 750
diff changeset
328 ``~/.odbc.ini``. All the parameters can indeed be provided directly
37512473ffe9 improved odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 750
diff changeset
329 in the connection strings, for instance::
37512473ffe9 improved odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 750
diff changeset
330
37512473ffe9 improved odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 750
diff changeset
331 {
37512473ffe9 improved odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 750
diff changeset
332 "Odbc" : {
37512473ffe9 improved odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 750
diff changeset
333 "EnableIndex" : true,
37512473ffe9 improved odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 750
diff changeset
334 "EnableStorage" : true,
37512473ffe9 improved odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 750
diff changeset
335 "IndexConnectionString" : "Driver={ODBC Driver 17 for SQL Server};Server=tcp:localhost,1433;Database=orthanctest;Uid=sa;Pwd=MyStrOngPa55word!",
37512473ffe9 improved odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 750
diff changeset
336 "StorageConnectionString" : "Driver={ODBC Driver 17 for SQL Server};Server=tcp:localhost,1433;Database=orthanctest;Uid=sa;Pwd=MyStrOngPa55word!"
37512473ffe9 improved odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 750
diff changeset
337 }
37512473ffe9 improved odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 750
diff changeset
338 }
37512473ffe9 improved odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 750
diff changeset
339
789
2f70f622059b added odbc tip
Alain Mazy <am@osimis.io>
parents: 751
diff changeset
340 **Remark:** On Windows systems, we have noticed that the ODBC drivers character encoding
2f70f622059b added odbc tip
Alain Mazy <am@osimis.io>
parents: 751
diff changeset
341 seems to depend on a system level configuration. This configuration needs to enforce UTF-8.
2f70f622059b added odbc tip
Alain Mazy <am@osimis.io>
parents: 751
diff changeset
342 Therefore, it is advised to configure the system locale as follow:
2f70f622059b added odbc tip
Alain Mazy <am@osimis.io>
parents: 751
diff changeset
343
2f70f622059b added odbc tip
Alain Mazy <am@osimis.io>
parents: 751
diff changeset
344 .. image:: ../images/odbc-windows-system-locale.png
2f70f622059b added odbc tip
Alain Mazy <am@osimis.io>
parents: 751
diff changeset
345 :align: center
2f70f622059b added odbc tip
Alain Mazy <am@osimis.io>
parents: 751
diff changeset
346 :width: 600px
2f70f622059b added odbc tip
Alain Mazy <am@osimis.io>
parents: 751
diff changeset
347
2f70f622059b added odbc tip
Alain Mazy <am@osimis.io>
parents: 751
diff changeset
348 |
751
37512473ffe9 improved odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 750
diff changeset
349
750
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
350 PostgreSQL
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
351 ^^^^^^^^^^
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
352
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
353 1. Install the ``odbc-postgresql`` package.
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
354
751
37512473ffe9 improved odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 750
diff changeset
355 .. highlight:: text
37512473ffe9 improved odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 750
diff changeset
356
750
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
357 2. Create the following sample `unixODBC
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
358 <https://en.wikipedia.org/wiki/UnixODBC>`__ configuration file::
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
359
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
360 $ cat ~/.odbc.ini
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
361 [orthanctest]
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
362 Driver = PostgreSQL Unicode
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
363 Servername = localhost
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
364 Database = orthanctest
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
365 UserName = postgres
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
366 Password = postgres
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
367 Port = 5432
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
368
751
37512473ffe9 improved odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 750
diff changeset
369 .. highlight:: json
37512473ffe9 improved odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 750
diff changeset
370
750
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
371 3. Start Orthanc using the following :ref:`configuration file
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
372 <configuration>` for ODBC::
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
373
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
374 {
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
375 "Odbc" : {
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
376 "EnableIndex" : true,
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
377 "EnableStorage" : true,
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
378 "IndexConnectionString" : "DSN=orthanctest",
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
379 "StorageConnectionString" : "DSN=orthanctest"
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
380 }
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
381 }
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
382
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
383
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
384 MySQL
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
385 ^^^^^
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
386
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
387 1. Install the official `Connect/ODBC package
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
388 <https://dev.mysql.com/downloads/connector/odbc/>`__ (it is not
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
389 packaged for Ubuntu 18.04).
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
390
751
37512473ffe9 improved odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 750
diff changeset
391 .. highlight:: text
37512473ffe9 improved odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 750
diff changeset
392
750
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
393 2. Create the following sample `unixODBC
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
394 <https://en.wikipedia.org/wiki/UnixODBC>`__ configuration file::
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
395
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
396 $ cat ~/.odbc.ini
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
397 [orthanctest]
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
398 Driver = MySQL ODBC 8.0 Unicode Driver
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
399 Servername = localhost
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
400 Database = orthanctest
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
401 UID = root
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
402 PWD = root
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
403 Port = 3306
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
404
751
37512473ffe9 improved odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 750
diff changeset
405 .. highlight:: json
37512473ffe9 improved odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 750
diff changeset
406
750
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
407 3. Start Orthanc using the following :ref:`configuration file
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
408 <configuration>` for ODBC::
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
409
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
410 {
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
411 "Odbc" : {
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
412 "EnableIndex" : true,
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
413 "EnableStorage" : true,
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
414 "IndexConnectionString" : "DSN=orthanctest;charset=utf8",
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
415 "StorageConnectionString" : "DSN=orthanctest;charset=utf8"
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
416 }
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
417 }
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
418
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
419 The ``charset=utf8`` option is necessary if using MySQL 8.x.
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
420
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
421
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
422 SQLite
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
423 ^^^^^^
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
424
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
425 1. Install the ``libsqliteodbc`` package.
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
426
751
37512473ffe9 improved odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 750
diff changeset
427 .. highlight:: text
37512473ffe9 improved odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 750
diff changeset
428
750
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
429 2. Create the following sample `unixODBC
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
430 <https://en.wikipedia.org/wiki/UnixODBC>`__ configuration file::
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
431
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
432 $ cat ~/.odbc.ini
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
433 [index]
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
434 Driver=SQLite3
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
435 Database=/tmp/test-odbc-index.sqlite
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
436
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
437 [storage]
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
438 Driver=SQLite3
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
439 Database=/tmp/test-odbc-storage.sqlite
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
440
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
441 Note that we define two different data sources, one for the index
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
442 and another for the storage area, because a SQLite database can
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
443 only be opened by one client at once.
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
444
751
37512473ffe9 improved odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 750
diff changeset
445 .. highlight:: json
37512473ffe9 improved odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 750
diff changeset
446
750
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
447 3. Start Orthanc using the following :ref:`configuration file
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
448 <configuration>` for ODBC::
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
449
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
450 {
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
451 "Odbc" : {
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
452 "EnableIndex" : true,
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
453 "EnableStorage" : true,
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
454 "IndexConnectionString" : "DSN=index",
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
455 "StorageConnectionString" : "DSN=storage",
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
456 "IndexConnectionsCount" : 1
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
457 }
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
458 }
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
459
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
460 **Remark 1:** As written just above, one SQLite database should
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
461 only be opened by one client at a time. This implies that the
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
462 ``IndexConnectionsCount`` must be set to ``1``, and that the index
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
463 and storage area must never have connection strings corresponding
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
464 to the same SQLite database.
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
465
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
466 **Remark 2:** As written above, the ODBC plugin supports the
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
467 :ref:`revision mechanism <revisions>`. This contrasts with the
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
468 built-in SQLite database of Orthanc. So, it might be interesting to
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
469 use the ODBC index plugin instead of the built-in SQLite database
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
470 of Orthanc, if you are a developer who wants to test revisions
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
471 before a :ref:`large-scale deployment <scalability>`.
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
472
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
473
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
474 Advanced options
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
475 ----------------
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
476
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
477 Several advanced options are available as well to fine-tune the
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
478 configuration of the ODBC plugins. They are documented below.
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
479
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
480
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
481 .. _odbc-multiple-writers:
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
482
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
483 Multiple writers or connections
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
484 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
485
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
486 Starting with Orthanc 1.9.2, it is possible to use :ref:`multiple
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
487 writers or connections in large-scale deployments
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
488 <multiple-writers>`. Here is the list of configuration that control
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
489 this behaviour:
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
490
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
491 * ``MaximumConnectionRetries`` governs how many times Orthanc tries to
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
492 connect to the database, as well as how many times Orthanc replays
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
493 transactions to deal with collisions between multiple writers.
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
494
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
495 * ``IndexConnectionsCount`` controls the number of connections from
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
496 the index plugin to the ODBC database. It is set to ``1`` by
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
497 default, which corresponds to the old behaviour of Orthanc <= 1.9.1.
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
498
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
499 * ``ConnectionRetryInterval`` is only used when opening one database
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
500 connection to ODBC.
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
501
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
502 * These options cannot be used in the case of SQLite databases, that
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
503 only support one client at once.