annotate Sphinx/source/plugins/odbc.rst @ 828:e587ba35dba2

advanced stone web viewer
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 25 Mar 2022 16:44:12 +0100
parents 2f70f622059b
children 1316bc62b5d5
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
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 <https://hg.orthanc-server.com/orthanc-databases/>`__, next to the
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
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
51 <https://lsb.orthanc-server.com/plugin-odbc/>`__ of the ODBC plugins
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
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
141 <https://www.orthanc-server.com/browse.php?path=/plugin-odbc>`__. A
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
142 package for `Apple's Mac OS X
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
143 <https://www.osimis.io/en/download.html>`__ is available courtesy of
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
144 `Osimis <https://www.osimis.io/>`__.
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
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
147 .. _odbc-ubuntu1604:
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
148
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
149 Dynamic linking on Ubuntu 16.04
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
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
152 .. highlight:: text
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
153
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
154 If static linking is not desired, here are build instructions for
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
155 Ubuntu 16.04 (provided build dependencies for the :ref:`core of
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
156 Orthanc <compiling>` have already been installed)::
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
157
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
158 $ sudo apt-get install libodbc1 unixodbc unixodbc-dev
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
159 $ mkdir BuildOdbc
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
160 $ cd BuildOdbc
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
161 $ cmake ../Odbc -DCMAKE_BUILD_TYPE=Release \
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
162 -DALLOW_DOWNLOADS=ON \
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
163 -DUSE_SYSTEM_GOOGLE_TEST=OFF \
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
164 -DUSE_SYSTEM_ORTHANC_SDK=OFF
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
165 $ make
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
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
169 Usage
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
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
172 You of course first have to :ref:`install Orthanc <binaries>`, with a
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
173 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
174 source** dedicated to Orthanc. The procedure depends upon your
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
175 operating system:
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
176
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
177 * Many UNIX-like platforms (including Debian and Ubuntu) use `unixODBC
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
178 <https://en.wikipedia.org/wiki/UnixODBC>`__. You first have to
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
179 install at least one ODBC driver (e.g. on Debian, installing the
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
180 packages ``libsqliteodbc`` and ``odbc-postgresql`` will respectively
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
181 install the driver for SQLite and for PostgreSQL). Secondly, you
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
182 have to edit your ``~/.odbc.ini`` to define the data sources
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
183 (i.e. the actual databases).
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
184
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
185 * On Microsoft Windows, the configuration tool ``odbcad32.exe`` ("ODBC
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
186 Data Source Administrator") allows to define the data sources. You
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
187 also have to install at least one ODBC driver. For instance, the
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
188 `SQLite ODBC Driver <http://www.ch-werner.de/sqliteodbc/>`__ can be
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
189 used to access SQLite.
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
190
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
191 * If you are interested in interfacing Orthanc with Microsoft SQL
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
192 Server, the corresponding ODBC drivers can be `downloaded from
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
193 Microsoft
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
194 <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
195
751
37512473ffe9 improved odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 750
diff changeset
196 .. highlight:: json
37512473ffe9 improved odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 750
diff changeset
197
750
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
198 Once Orthanc is installed and the data sources have been defined, you
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
199 must add a section in the :ref:`configuration file <configuration>`
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
200 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
201 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
202 properly modifying the ``Plugins`` option. You could for instance
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
203 adapt the following configuration file::
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 {
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
206 "Name" : "MyOrthanc",
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
207 "Odbc" : {
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
208 "EnableIndex" : true,
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
209 "EnableStorage" : true,
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
210 "IndexConnectionString" : "DSN=index",
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
211 "StorageConnectionString" : "DSN=storage",
751
37512473ffe9 improved odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 750
diff changeset
212 "MaximumConnectionRetries" : 10,
37512473ffe9 improved odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 750
diff changeset
213 "ConnectionRetryInterval" : 5,
37512473ffe9 improved odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 750
diff changeset
214 "IndexConnectionsCount" : 1
750
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
215 },
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
216 "Plugins" : [
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
217 "/home/user/orthanc-databases/BuildOdbc/libOrthancOdbcIndex.so",
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
218 "/home/user/orthanc-databases/BuildOdbc/libOrthancOdbcStorage.so"
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
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
222 The values of ``IndexConnectionString`` and
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
223 ``StorageConnectionString`` are known as `ODBC connection strings
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
224 <https://www.connectionstrings.com/>`__, and define how to connect to
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
225 the ODBC data source. These connection strings are specific to the
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
226 different types of ODBC drivers. In the following sections, we'll
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
227 review connection strings for SQLite, PostgreSQL, MySQL and Microsoft
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
228 SQL Server.
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
229
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
230 **Important:** The ``EnableIndex`` and ``EnableStorage`` options must
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
231 be explicitly set to ``true``, otherwise Orthanc will continue to use
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
232 its default SQLite back-end and the filesystem storage area.
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
233
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
234 **Remark 1:** When using the ODBC storage area plugin, the DICOM files
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
235 are stored as large objects in the database. This might actually
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
236 consume more space than the DICOM file itself.
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
237
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
238 **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
239 the index plugin, and to use the default filesystem storage for DICOM
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
240 files (on a NAS with proper disaster recovery strategies).
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
241
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
242 Orthanc must of course be **restarted** after the modification of its
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
243 configuration file.
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
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
246 Supported ODBC drivers
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
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
249 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
250 connect to any ODBC driver. However, there are some minor variations
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
251 in the SQL language, that are known as "dialects" in the `source code
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
252 of the plugins <https://hg.orthanc-server.com/orthanc-databases/>`__.
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
253
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
254 As of ODBC plugins 1.0, the supported dialects are Microsoft SQL
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
255 Server, PostgreSQL, MySQL and SQLite. Orthanc auto-detects the dialect
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
256 to be used. Adapting the ODBC plugins to support more dialects should
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
257 be fairly easy by adding new values to the
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
258 ``OrthancDatabases::Dialect`` enumeration in the C++ source code.
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
259
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
260 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
261 storage area can mix different type of ODBC drivers.
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
262
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
263 We now review sample `connection strings
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
264 <https://www.connectionstrings.com/>`__ for the supported ODBC drivers
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
265 under Ubuntu 18.04.
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
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
268 Microsoft SQL Server
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
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
271 .. highlight:: bash
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
272
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
273 1. Install the `ODBC driver for SQL server
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
274 <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
275 (version 2017).
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
276
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
277 2. A **non-persistent** developer instance of MSSQL 2019 can be
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
278 started using the `Docker image provided by Microsoft
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
279 <https://hub.docker.com/_/microsoft-mssql-server>`__ as follows::
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
280
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
281 $ 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
282 -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
283
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
284 3. Create a database dedicated to Orthanc in MSSQL::
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
285
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
286 $ /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
287
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
288 .. highlight:: text
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
289
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
290 4. Create the following sample `unixODBC
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
291 <https://en.wikipedia.org/wiki/UnixODBC>`__ configuration file::
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
292
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
293 $ cat ~/.odbc.ini
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
294 [orthanctest]
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
295 Driver = ODBC Driver 17 for SQL Server
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
296 Server = tcp:localhost,1433
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
297 Database = orthanctest
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
298
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
299 Note that there exist `many more configuration options
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
300 <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
301 for Microsoft SQL Server. In particular, ``Encrypt`` and
37512473ffe9 improved odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 750
diff changeset
302 ``TrustServerCertificate`` and ``Connect Timeout`` can be
37512473ffe9 improved odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 750
diff changeset
303 interesting in the case of a connection to Microsoft Azure SQL.
750
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
304
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
305 .. highlight:: json
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
306
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
307 5. Start Orthanc using the following :ref:`configuration file
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
308 <configuration>` for ODBC::
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 {
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
311 "Odbc" : {
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
312 "EnableIndex" : true,
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
313 "EnableStorage" : true,
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
314 "IndexConnectionString" : "DSN=orthanctest;Uid=sa;Pwd=MyStrOngPa55word!",
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
315 "StorageConnectionString" : "DSN=orthanctest;Uid=sa;Pwd=MyStrOngPa55word!"
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
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
319 In the connection strings:
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
320
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
321 * ``DSN`` corresponds to the name of the entry in ``~/.odbc.ini``.
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
322 * ``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
323 * ``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
324 environment variable when starting Docker.
750
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
325 * For security reasons, the ``Uid`` and ``Pwd`` parameters cannot
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
326 be set in ``~/.odbc.ini``.
751
37512473ffe9 improved odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 750
diff changeset
327
37512473ffe9 improved odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 750
diff changeset
328 **Remark:** It is actually not necessary to create an entry in
37512473ffe9 improved odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 750
diff changeset
329 ``~/.odbc.ini``. All the parameters can indeed be provided directly
37512473ffe9 improved odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 750
diff changeset
330 in the connection strings, for instance::
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 {
37512473ffe9 improved odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 750
diff changeset
333 "Odbc" : {
37512473ffe9 improved odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 750
diff changeset
334 "EnableIndex" : true,
37512473ffe9 improved odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 750
diff changeset
335 "EnableStorage" : true,
37512473ffe9 improved odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 750
diff changeset
336 "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
337 "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
338 }
37512473ffe9 improved odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 750
diff changeset
339 }
37512473ffe9 improved odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 750
diff changeset
340
789
2f70f622059b added odbc tip
Alain Mazy <am@osimis.io>
parents: 751
diff changeset
341 **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
342 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
343 Therefore, it is advised to configure the system locale as follow:
2f70f622059b added odbc tip
Alain Mazy <am@osimis.io>
parents: 751
diff changeset
344
2f70f622059b added odbc tip
Alain Mazy <am@osimis.io>
parents: 751
diff changeset
345 .. image:: ../images/odbc-windows-system-locale.png
2f70f622059b added odbc tip
Alain Mazy <am@osimis.io>
parents: 751
diff changeset
346 :align: center
2f70f622059b added odbc tip
Alain Mazy <am@osimis.io>
parents: 751
diff changeset
347 :width: 600px
2f70f622059b added odbc tip
Alain Mazy <am@osimis.io>
parents: 751
diff changeset
348
2f70f622059b added odbc tip
Alain Mazy <am@osimis.io>
parents: 751
diff changeset
349 |
751
37512473ffe9 improved odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 750
diff changeset
350
750
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
351 PostgreSQL
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
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
354 1. Install the ``odbc-postgresql`` package.
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
355
751
37512473ffe9 improved odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 750
diff changeset
356 .. highlight:: text
37512473ffe9 improved odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 750
diff changeset
357
750
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
358 2. Create the following sample `unixODBC
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
359 <https://en.wikipedia.org/wiki/UnixODBC>`__ configuration file::
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
360
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
361 $ cat ~/.odbc.ini
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
362 [orthanctest]
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
363 Driver = PostgreSQL Unicode
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
364 Servername = localhost
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
365 Database = orthanctest
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
366 UserName = postgres
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
367 Password = postgres
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
368 Port = 5432
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
369
751
37512473ffe9 improved odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 750
diff changeset
370 .. highlight:: json
37512473ffe9 improved odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 750
diff changeset
371
750
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
372 3. Start Orthanc using the following :ref:`configuration file
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
373 <configuration>` for ODBC::
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 {
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
376 "Odbc" : {
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
377 "EnableIndex" : true,
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
378 "EnableStorage" : true,
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
379 "IndexConnectionString" : "DSN=orthanctest",
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
380 "StorageConnectionString" : "DSN=orthanctest"
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
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
385 MySQL
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
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
388 1. Install the official `Connect/ODBC package
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
389 <https://dev.mysql.com/downloads/connector/odbc/>`__ (it is not
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
390 packaged for Ubuntu 18.04).
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
391
751
37512473ffe9 improved odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 750
diff changeset
392 .. highlight:: text
37512473ffe9 improved odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 750
diff changeset
393
750
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
394 2. Create the following sample `unixODBC
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
395 <https://en.wikipedia.org/wiki/UnixODBC>`__ configuration file::
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
396
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
397 $ cat ~/.odbc.ini
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
398 [orthanctest]
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
399 Driver = MySQL ODBC 8.0 Unicode Driver
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
400 Servername = localhost
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
401 Database = orthanctest
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
402 UID = root
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
403 PWD = root
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
404 Port = 3306
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
405
751
37512473ffe9 improved odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 750
diff changeset
406 .. highlight:: json
37512473ffe9 improved odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 750
diff changeset
407
750
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
408 3. Start Orthanc using the following :ref:`configuration file
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
409 <configuration>` for ODBC::
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 {
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
412 "Odbc" : {
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
413 "EnableIndex" : true,
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
414 "EnableStorage" : true,
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
415 "IndexConnectionString" : "DSN=orthanctest;charset=utf8",
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
416 "StorageConnectionString" : "DSN=orthanctest;charset=utf8"
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
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
420 The ``charset=utf8`` option is necessary if using MySQL 8.x.
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
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
423 SQLite
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
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
426 1. Install the ``libsqliteodbc`` package.
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
427
751
37512473ffe9 improved odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 750
diff changeset
428 .. highlight:: text
37512473ffe9 improved odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 750
diff changeset
429
750
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
430 2. Create the following sample `unixODBC
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
431 <https://en.wikipedia.org/wiki/UnixODBC>`__ configuration file::
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
432
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
433 $ cat ~/.odbc.ini
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
434 [index]
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
435 Driver=SQLite3
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
436 Database=/tmp/test-odbc-index.sqlite
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
437
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
438 [storage]
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
439 Driver=SQLite3
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
440 Database=/tmp/test-odbc-storage.sqlite
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
441
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
442 Note that we define two different data sources, one for the index
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
443 and another for the storage area, because a SQLite database can
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
444 only be opened by one client at once.
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
445
751
37512473ffe9 improved odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 750
diff changeset
446 .. highlight:: json
37512473ffe9 improved odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 750
diff changeset
447
750
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
448 3. Start Orthanc using the following :ref:`configuration file
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
449 <configuration>` for ODBC::
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 {
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
452 "Odbc" : {
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
453 "EnableIndex" : true,
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
454 "EnableStorage" : true,
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
455 "IndexConnectionString" : "DSN=index",
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
456 "StorageConnectionString" : "DSN=storage",
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
457 "IndexConnectionsCount" : 1
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
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
461 **Remark 1:** As written just above, one SQLite database should
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
462 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
463 ``IndexConnectionsCount`` must be set to ``1``, and that the index
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
464 and storage area must never have connection strings corresponding
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
465 to the same SQLite database.
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
466
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
467 **Remark 2:** As written above, the ODBC plugin supports the
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
468 :ref:`revision mechanism <revisions>`. This contrasts with the
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
469 built-in SQLite database of Orthanc. So, it might be interesting to
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
470 use the ODBC index plugin instead of the built-in SQLite database
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
471 of Orthanc, if you are a developer who wants to test revisions
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
472 before a :ref:`large-scale deployment <scalability>`.
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
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
475 Advanced options
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
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
478 Several advanced options are available as well to fine-tune the
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
479 configuration of the ODBC plugins. They are documented below.
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
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
482 .. _odbc-multiple-writers:
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
483
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
484 Multiple writers or connections
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
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
487 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
488 writers or connections in large-scale deployments
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
489 <multiple-writers>`. Here is the list of configuration that control
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
490 this behaviour:
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
491
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
492 * ``MaximumConnectionRetries`` governs how many times Orthanc tries to
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
493 connect to the database, as well as how many times Orthanc replays
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
494 transactions to deal with collisions between multiple writers.
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
495
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
496 * ``IndexConnectionsCount`` controls the number of connections from
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
497 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
498 default, which corresponds to the old behaviour of Orthanc <= 1.9.1.
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
499
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
500 * ``ConnectionRetryInterval`` is only used when opening one database
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
501 connection to ODBC.
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
502
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
503 * These options cannot be used in the case of SQLite databases, that
8b8df1be0cf9 documenting odbc
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
504 only support one client at once.