BES - Modules - SQL Hander: Difference between revisions

From OPeNDAP Documentation
⧼opendap2-jumptonavigation⧽
m (Created page with "== Kinds of files the handler will serve == This handler will serve data stored in a relational database if that database is configured to be accessed using ODBC. The handler has...")
 
Line 11: Line 11:


== Configuring the handler ==
== Configuring the handler ==
=== Configuring the ODBC Driver ===
To configure the handler both the handler itself must be told which tables, or parts of tables, should be accessed and the ODBC driver must be configured. In general, ODBC drivers are pretty easy to configure and, while each driver has its idiosyncrasies, most of the setup is the same for any driver/database combination. Both ''unixODBC'' and ''iODBC'' use two configuration fills: ''/etc/odbcinst.ini'' and ''/etc/odbc.ini''. The driver should have documentation on these, however, there is one parameter you will need to know to make use of the sql handler. In the ''odbc.ini'' file, the parameter ''database'' is used to reference the actual database that is matched to particular ''Data Source Name'' (DSN). You will need to know the DSN since programs that use ODBC to access a database use the DSN and not the name of the database. In addition, there is a ''user'' and ''password'' parameter set defined for a particular DSN; the sql handler will likely need that too (NB: This might no actually be needed 9/9/12).
To configure the handler both the handler itself must be told which tables, or parts of tables, should be accessed and the ODBC driver must be configured. In general, ODBC drivers are pretty easy to configure and, while each driver has its idiosyncrasies, most of the setup is the same for any driver/database combination. Both ''unixODBC'' and ''iODBC'' use two configuration fills: ''/etc/odbcinst.ini'' and ''/etc/odbc.ini''. The driver should have documentation on these, however, there is one parameter you will need to know to make use of the sql handler. In the ''odbc.ini'' file, the parameter ''database'' is used to reference the actual database that is matched to particular ''Data Source Name'' (DSN). You will need to know the DSN since programs that use ODBC to access a database use the DSN and not the name of the database. In addition, there is a ''user'' and ''password'' parameter set defined for a particular DSN; the sql handler will likely need that too (NB: This might no actually be needed 9/9/12).


=== Configuring the handler ===
==== SQL.CheckPoint ====
Checkpoints in the SQL handler are phases of the database access process where error conditions can be tested for and reported. If these are activated using the ''SQL.CheckPoint'' parameter and an error is found, then a message will be printed in the bes.log and an exception will be thrown. There are five checkpoints supported by the handler:
;CONNECT: 1 (Fatal error)
;CLOSE: 2
;QUERY: 3
;GET_NEXT: 4 (Recoverable error)
;NEXT_ROW: 5
The default for the handler is to test for and report all errors:
SQL.CheckPoint=1,2,3,4,5


== Configuration parameters ==
== Configuration parameters ==

Revision as of 02:49, 10 September 2012

Kinds of files the handler will serve

This handler will serve data stored in a relational database if that database is configured to be accessed using ODBC. The handler has been tested using both the unixODBC and iODBC driver managers on Linux and OS/X, respectively. While our testing has been limited to the MySQL and Postgres database servers, the handler contains is not specific to either of those severs; it should work with any database that can be accessed using ODBC.

The handler can be configured to combine information from several tables and provide access to it as a single dataset, including performing the full range of SQL operations. At the same time, the SQL database server is never exposed to the web using this handler, so the database contents are safe.

Mappings between the ODBC data types and DAP2 data types

Known problems

There are no known problems.

Configuring the handler

Configuring the ODBC Driver

To configure the handler both the handler itself must be told which tables, or parts of tables, should be accessed and the ODBC driver must be configured. In general, ODBC drivers are pretty easy to configure and, while each driver has its idiosyncrasies, most of the setup is the same for any driver/database combination. Both unixODBC and iODBC use two configuration fills: /etc/odbcinst.ini and /etc/odbc.ini. The driver should have documentation on these, however, there is one parameter you will need to know to make use of the sql handler. In the odbc.ini file, the parameter database is used to reference the actual database that is matched to particular Data Source Name (DSN). You will need to know the DSN since programs that use ODBC to access a database use the DSN and not the name of the database. In addition, there is a user and password parameter set defined for a particular DSN; the sql handler will likely need that too (NB: This might no actually be needed 9/9/12).

Configuring the handler

SQL.CheckPoint

Checkpoints in the SQL handler are phases of the database access process where error conditions can be tested for and reported. If these are activated using the SQL.CheckPoint parameter and an error is found, then a message will be printed in the bes.log and an exception will be thrown. There are five checkpoints supported by the handler:

CONNECT
1 (Fatal error)
CLOSE
2
QUERY
3
GET_NEXT
4 (Recoverable error)
NEXT_ROW
5

The default for the handler is to test for and report all errors:

SQL.CheckPoint=1,2,3,4,5

Configuration parameters