Kinetica provides a SQL-92 interface through its ODBC connector. For details on the extent of SQL-92 coverage, see the SQL Support section.
There are two parts of the Kinetica ODBC driver, which translates SQL for Kinetica: the small ODBC Client wrapper, and main ODBC Server. The client sends SQL to the server, and the server translates the SQL and sends it as a request to the Kinetica server.
The ODBC Server should be started when all the Kinetica components are started via gpudb start. The client runs on Linux, Mac, and Windows. There is also a JDBC Client for connecting from Java programs.
The ODBC Server is installed by default in a standard Kinetica installation.
The ODBC Client must be installed for the environment in which it will be used. The following sections will detail how to install & configure the client in Linux & Windows.
The Unix ODBC library and our ODBC Client driver are both provided in the
RPM and Deb in /opt/gpudb/connectors/odbcserver/client
. Specifically,
the ODBC Client driver itself is at
/opt/gpudb/connectors/odbcserver/client/lib/libSimbaClient.so
.
Instructions on configuring it are in
/opt/gpudb/connectors/odbcserver/README.md
.
If installing a different version of the library to a Kinetica server or if installing to a server other than a Kinetica one, use the following procedure.
Install the unixODBC package.
Ubuntu:
$ sudo apt-get install unixodbc
CentOS:
$ sudo yum install unixODBC
Copy the Simba library from an existing Kinetica server to the target
server running unixODBC. The Simba library is installed by default at
/opt/gpudb/connectors/odbcserver/client/lib/libSimbaClient.so
on any
Kinetica server with the Kinetica ODBC Connector component. There is no
requirement that the Simba library be copied to any specific directory on
the target unixODBC server.
Register the Kinetica ODBC driver on the unixODBC server by adding the
following entry to the end of the /etc/odbcinst.ini
file (create the
file if it doesn't already exist). Note that Driver is the new
location of the Simba library file on the unixODBC server:
[SimbaODBCClientDSIIDriver]
APILevel=1
ConnectFunctions=YYY
Description=Kinetica Simba Client Driver
Driver=</path/to/Simba/lib>/libSimbaClient.so
DriverODBCVer=03.80
SQLLevel=1
Add a system DSN entry for the Kinetica database server to which the
unixODBC client will connect. The entry should be added to
/etc/odbc.ini
on the unixODBC server, and this file can be created
if it does not exist. Note that Driver refers to the same
Simba library path as above, ServerList is the host & port of
the Kinetica ODBC Server, and URL is the URL of the primary
Kinetica database server:
[KINETICA]
Description=Kinetica Connection
Driver=</path/to/Simba/lib>/libSimbaClient.so
Locale=en-US
UseSsl=0
ServerList=<odbc.host> 9292
ParentSet=MASTER
URL http://<database.host>:9191
PWD=
UID=
Create a user DSN by copying the system DSN file to a given user's home directory, prepending a dot to the file name in order to make it hidden:
$ cp /etc/odbc.ini ~/.odbc.ini
Add the ODBC Client driver directory to the LD_LIBRARY_PATH
:
$ export LD_LIBRARY_PATH=</path/to/Simba/lib>:$LD_LIBRARY_PATH
Check the ODBC configuration. Running the following commands should generate similar output:
$ which isql
/usr/bin/isql
$ isql --version
unixODBC 2.3.1
$ odbcinst -q -d
[SimbaODBCClientDSIIDriver]
$ odbcinst -q -s
[KINETICA]
$ odbcinst -j
unixODBC 2.3.1
DRIVERS............: /etc/odbcinst.ini
SYSTEM DATA SOURCES: /etc/odbc.ini
FILE DATA SOURCES..: /etc/ODBCDataSources
USER DATA SOURCES..: /home/<user>/.odbc.ini
SQLULEN Size.......: 8
SQLLEN Size........: 8
SQLSETPOSIROW Size.: 8
Connect to Kinetica and request a list of tables:
$ isql -3 -m20 -v kinetica
+---------------------------------------+
| Connected! |
| |
| sql-statement |
| help [tablename] |
| quit |
| |
+---------------------------------------+
SQL> help
+---------------------+---------------------+---------------------+---------------------+---------------------+
| TABLE_QUALIFIER | TABLE_OWNER | TABLE_NAME | TABLE_TYPE | REMARKS |
+---------------------+---------------------+---------------------+---------------------+---------------------+
+---------------------+---------------------+---------------------+---------------------+---------------------+
SQLRowCount returns 0
SQL>
Tip
Using the -v option will show troubleshooting information if any error occurs in connecting.
Kinetica provides both a 32-bit & 64-bit Windows ODBC Client driver. The 32-bit version of Windows requires the 32-bit driver. The 64-bit version of Windows can use either the 32-bit or 64-bit driver, or both, as needs warrant. For instance, a user running 64-bit Windows and wanting to make ODBC connections to Kinetica from a 32-bit version of Excel will need the 32-bit driver. A user with the same OS using the 64-bit Tableau will need the 64-bit driver. A user wanting to use both will need both drivers.
Kinetica
Kinetica
MASTER
9292
The configuration parameters are the same in Linux & Windows, though the locations of the configurations are not.
ODBC Server settings are set in the
/opt/gpudb/connectors/odbcserver/bin/GISFederal.GPUdbODBC.ini
file on
Linux. In Windows, these are set in the
HKEY_LOCAL_MACHINE\SOFTWARE\Kinetica\Server
registry key.
Config Parameter | Default Value | Description |
---|---|---|
ConsoleOutput | 0 |
Whether debug logging is turned off or written to
|
DontCombine | 0 |
Whether or not SQL statements merging multiple tables (UNION/JOIN) will be done in 1 call or multiple calls
|
FailPartialPassdown | 0 |
Whether or not to have the server fail any queries which cannot be fully optimized
|
KeepTempTables | 0 |
Whether or not temporary tables will automatically be cleaned up by the system
|
ListenPort | 9292 |
Kinetica database server listen port |
LogLevel | 4 |
Controls how much information is written to the
|
LogNamespace | GISFederal::GPUdbODBC |
|
LogPath | /opt/gpudb/connectors/odbcserver/logs |
Where to write log files |
LogTree | 0 |
Whether or not algebraic expression trees (AE Trees) are written to the
|
MaxConnections | 64 |
Maximum number of clients that can have connections simultaneously |
MaxQueryDimensions | 10 |
Number of tables in a single query allowed to be joined on columns that are not primary keys |
MaxRowsToFetch | 100000 |
Maximum number of response records to send to the client for a given query (may be overridden by client) |
NoPassdown | 0 |
Whether or not to execute queries with no optimization
|
ParentSet | MASTER |
Collection containing tables that clients will use by default (may be overridden by client) |
PWD | Password to use, if none specified by client | |
ReceivedLinesToShow | 0 |
Output received data and types to stdout (if ConsoleOutput is on) |
RowsPerFetch | 1000 |
Number of response records to send to the client at a time (may be overridden by client) |
TTL | 5 |
Time to Live (TTL) for temp sets, in minutes. Other possible values:
|
UID | User ID to use, if none specified by client | |
URL | http://127.0.0.1:9191/ | URL of Kinetica database server to connect to |
In Linux, the ODBC Client DSN settings are configured via the
/opt/gpudb/connectors/odbcserver/client/etc/odbc.ini
file. In
Windows, these settings are stored in the registry in
HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI\<DSN NAME>
. Some settings of
note follow.
Config Parameter | Default Value | Description |
---|---|---|
UID | User ID for database connection (blank to use default credentials) | |
PWD | Password for database connection (blank to use default credentials) | |
ReadOnly | 0 |
Whether connection is read-only or read-write:
|
ServerList | 127.0.0.1 9292 |
Host and port of the ODBC Server |
The following are optional parameters that could be used to override the server's settings but usually should be left blank (or not supplied) to use the server's settings.
Config Parameter | Default Value | Description |
---|---|---|
DontCombine | 0 |
Whether or not SQL statements merging multiple tables (UNION/JOIN) will be done in 1 call or multiple calls
|
FailPartialPassdown | 0 |
Whether or not to have the server fail any queries which cannot be fully optimized
|
KeepTempTables | 0 |
Whether or not temporary tables will automatically be cleaned up by the system
|
MaxQueryDimensions | 10 |
Number of tables in a single query allowed to be joined on columns that are not primary keys |
MaxRowsToFetch | 100000 |
Maximum number of records to request from the server for a given query |
NoPassdown | 0 |
Whether or not to execute queries with no optimization
|
ParentSet | MASTER |
Collection containing tables to access |
RowsPerFetch | 10000 |
Number of records to request from the server at a time |
TTL | 5 |
TTL for temp sets, in minutes. Other possible values:
|
URL | http://127.0.0.1:9191 | URL of Kinetica database server to connect to |
Important
If a list of tables is requested through the ODBC Client driver, the set of tables in the collection specified by the ParentSet parameter will be returned. New tables will also be created in this collection, by default. Tables not in this collection can be accessed by name, even though they won't be returned in a table list request.
$ PATH=${PATH}:/opt/gpudb/connectors/odbcserver/client/bin
$ isql -3 -m20 -v <DSN> [UID [PWD]]
DSN is the name of the configured ODBC connection to Kinetica. If
configured as in the Installation > Linux section,
this will be kinetica
; on servers with Kinetica installed, a DSN of
GPUDBDSN
is pre-configured for that server's database instance.
UID and PWD are the User ID and Password parameters,
respectively, which are optional on some systems. The -3 option
instructs isql to use ODBC 3 calls, the -m20 option
reduces column widths to 20 characters (the default causes severe
line-wrapping), and the -v option puts isql into verbose
mode. You should see something like this:
$ isql -3 -m20 -v kinetica
+---------------------------------------+
| Connected! |
| |
| sql-statement |
| help [tablename] |
| quit |
| |
+---------------------------------------+
SQL>
You can type help
for a list of all tables & views in the database:
SQL> help
+---------------------+---------------------+---------------------+---------------------+---------------------+
| TABLE_QUALIFIER | TABLE_OWNER | TABLE_NAME | TABLE_TYPE | REMARKS |
+---------------------+---------------------+---------------------+---------------------+---------------------+
+---------------------+---------------------+---------------------+---------------------+---------------------+
SQLRowCount returns 0
You may now type SQL commands at the SQL>
prompt, and the responses will be
displayed. For example:
SQL> select x, y from calcs
You can exit this mode by typing quit.
The documentation for isql can be found at: https://www.mankier.com/1/isql
Kinetica
MASTER
To read in data using the ODC file created above:
Kinetica
com.simba.client.core.jdbc4.SCJDBC4Driver
jdbc:simba://localhost:9292;URL=http://localhost:9191;ParentSet=MASTER
admin
for database administrator
connection); this should result in the JDBC URL being
populated automaticallyjdbc:simba://<machine running ODBC Server>:<port>
jdbc:simba://127.0.0.1:9292
9292
com.simba.client.core.jdbc4.SCJDBC4Driver
The ODBC Server logs events from the ODBC Server driver to
/opt/gpudb/connectors/odbcserver/logs/GPUdbODBC_driver.log
. The
interactions between the ODBC Server driver and the database are logged to
/opt/gpudb/connectors/odbcserver/logs/odbcserver.log
. To change the
location of the log files see ODBC Configuration above.