# HG changeset patch # User Sebastien Jodogne # Date 1628862582 -7200 # Node ID 37512473ffe91462ff37f82f471cab334b4569a7 # Parent 8b8df1be0cf9a2b56556883feab4c08133dc6c8e improved odbc diff -r 8b8df1be0cf9 -r 37512473ffe9 Sphinx/source/contributing.rst --- a/Sphinx/source/contributing.rst Fri Aug 13 14:06:23 2021 +0200 +++ b/Sphinx/source/contributing.rst Fri Aug 13 15:49:42 2021 +0200 @@ -30,7 +30,6 @@ * **Plugins**: - - Support of ODBC driver (notably for MSSQL databases) - :ref:`Worklist plugin ` to interface with REST API, HL7 or Mirth Please `get in touch with Osimis `__ if you diff -r 8b8df1be0cf9 -r 37512473ffe9 Sphinx/source/plugins/odbc.rst --- a/Sphinx/source/plugins/odbc.rst Fri Aug 13 14:06:23 2021 +0200 +++ b/Sphinx/source/plugins/odbc.rst Fri Aug 13 15:49:42 2021 +0200 @@ -30,9 +30,10 @@ That being said, there are multiple use cases for the ODBC plugins: -* Connection to Microsoft SQL Server (MSSQL) is only possible with - ODBC. Note that the ODBC plugins were only validated against MSSQL - 2017 and MSSQL 2019, under GNU/Linux. +* Connection to Microsoft SQL Server (MSSQL), including Microsoft + Azure SQL, is only possible with ODBC. Note that the ODBC plugins + were only validated against MSSQL 2017 and MSSQL 2019, under + GNU/Linux. * Contrarily to the built-in SQLite engine and to the MySQL/MariaDB index plugin, the ODBC index plugin supports the :ref:`revision @@ -70,6 +71,7 @@ | Database management system | Recommended index plugin | +==============================+========================================================+ | Microsoft SQL server (MSSQL) | ODBC plugin | +| or Microsoft Azure SQL | | +------------------------------+--------------------------------------------------------+ | MySQL (with revisions) | ODBC plugin | +------------------------------+--------------------------------------------------------+ @@ -92,6 +94,7 @@ | Filesystem | No plugin needed | +------------------------------+--------------------------------------------------------+ | Microsoft SQL server (MSSQL) | ODBC plugin | +| or Microsoft Azure SQL | | +------------------------------+--------------------------------------------------------+ | MySQL | :ref:`MySQL plugin ` | +------------------------------+--------------------------------------------------------+ @@ -166,8 +169,6 @@ Usage ----- -.. highlight:: json - You of course first have to :ref:`install Orthanc `, with a version above 0.9.5. You then have to **configure an ODBC data source** dedicated to Orthanc. The procedure depends upon your @@ -192,6 +193,8 @@ Microsoft `__. +.. highlight:: json + Once Orthanc is installed and the data sources have been defined, you must add a section in the :ref:`configuration file ` that specifies the **data source(s) to be used**. You also have to @@ -206,9 +209,9 @@ "EnableStorage" : true, "IndexConnectionString" : "DSN=index", "StorageConnectionString" : "DSN=storage", - "MaximumConnectionRetries" : 10, // Optional - "ConnectionRetryInterval" : 5, // Optional - "IndexConnectionsCount" : 1 // Optional + "MaximumConnectionRetries" : 10, + "ConnectionRetryInterval" : 5, + "IndexConnectionsCount" : 1 }, "Plugins" : [ "/home/user/orthanc-databases/BuildOdbc/libOrthancOdbcIndex.so", @@ -295,7 +298,9 @@ Note that there exist `many more configuration options `__ - for Microsoft SQL Server. + for Microsoft SQL Server. In particular, ``Encrypt`` and + ``TrustServerCertificate`` and ``Connect Timeout`` can be + interesting in the case of a connection to Microsoft Azure SQL. .. highlight:: json @@ -315,16 +320,32 @@ * ``DSN`` corresponds to the name of the entry in ``~/.odbc.ini``. * ``Uid`` is the user name in MSSQL (by default, the Docker image uses ``sa``). - * ``Pwd`` is the password that has been used when starting Docker. + * ``Pwd`` is the password that has been provided in the ``SA_PASSWORD`` + environment variable when starting Docker. * For security reasons, the ``Uid`` and ``Pwd`` parameters cannot be set in ``~/.odbc.ini``. - - + +**Remark:** It is actually not necessary to create an entry in +``~/.odbc.ini``. All the parameters can indeed be provided directly +in the connection strings, for instance:: + + { + "Odbc" : { + "EnableIndex" : true, + "EnableStorage" : true, + "IndexConnectionString" : "Driver={ODBC Driver 17 for SQL Server};Server=tcp:localhost,1433;Database=orthanctest;Uid=sa;Pwd=MyStrOngPa55word!", + "StorageConnectionString" : "Driver={ODBC Driver 17 for SQL Server};Server=tcp:localhost,1433;Database=orthanctest;Uid=sa;Pwd=MyStrOngPa55word!" + } + } + + PostgreSQL ^^^^^^^^^^ 1. Install the ``odbc-postgresql`` package. +.. highlight:: text + 2. Create the following sample `unixODBC `__ configuration file:: @@ -337,6 +358,8 @@ Password = postgres Port = 5432 +.. highlight:: json + 3. Start Orthanc using the following :ref:`configuration file ` for ODBC:: @@ -357,6 +380,8 @@ `__ (it is not packaged for Ubuntu 18.04). +.. highlight:: text + 2. Create the following sample `unixODBC `__ configuration file:: @@ -369,6 +394,8 @@ PWD = root Port = 3306 +.. highlight:: json + 3. Start Orthanc using the following :ref:`configuration file ` for ODBC:: @@ -389,6 +416,8 @@ 1. Install the ``libsqliteodbc`` package. +.. highlight:: text + 2. Create the following sample `unixODBC `__ configuration file:: @@ -405,6 +434,8 @@ and another for the storage area, because a SQLite database can only be opened by one client at once. +.. highlight:: json + 3. Start Orthanc using the following :ref:`configuration file ` for ODBC::