Kapish Kumar
Kapish Kumar

Reputation: 143

Can we setup odbc.ini with ClientUserID, ClientAcctString parameter in linux.

In the ODBC driver data source configuration for Windows there are options to configure your data source for information such as ClientUserID, ClientAcctString, etc. These columns are also carried in the Query History database and the configured DSN data will be displayed. What I would like to know is if these same and/or similar options can be configured in the odbc configuration for the Netezza client on Linux?

Upvotes: 3

Views: 545

Answers (1)

ScottMcG
ScottMcG

Reputation: 3887

Yes, you may. Those same parameters can be set in the linux ODBC.ini file, and those values will be carried through to the history database.

Here is an example odbc.ini that works for me.

;
;  odbc.ini
;
[ODBC Data Sources]
NZSQL = NetezzaSQL

[NZSQL]
Driver                = /usr/local/nz/lib64/libnzodbc.so
Description           = NetezzaSQL ODBC
Servername            = 192.168.118.128
Port                  = 5480
Database              = TESTDB
Username              = admin
Password              = somepassword
ReadOnly              = false
ShowSystemTables      = false
LegacySQLTables       = false
LoginTimeout          = 0
QueryTimeout          = 0
DateFormat            = 1
NumericAsChar         = false
SQLBitOneZero         = false
StripCRLF             = false
ClientUserID=someuser
ClientWorkStnName=someworkstation
ClientApplName=someapplication
ClientAcctString=someacctstring

[ODBC]
IANAAppCodePage=4
InstallDir=/opt/odbc32v51
Trace=0
TraceDll=/opt/odbc32v51/lib/odbctrac.so
TraceFile=odbctrace.out
UseCursorLib=0

Note that this will only affect ODBC connections, which means it won't work with the nzsql CLI. Here are two sample queries, one which uses ODBC and one which doesn't.

./nzodbcsql -n NZSQL -q "select current_date ODBC_TEST"

 ODBC_TEST
------------
 2015-07-10

Rows Returned : 1

 ./nzsql -h 192.168.118.128 -d testdb -u admin -pw password -c "select current_date NOTODBC_TEST"

 NOTODBC_TEST
--------------
 2015-07-10
(1 row)

Here's the history database query that shows the values being passed to the history database.

select CLIENT_USER_ID, CLIENT_APPLICATION_NAME, CLIENT_WORKSTATION_NAME, CLIENT_ACCOUNTING_STRING, query from "$v_hist_queries" where submittime > '2015-07-08' and dbname='TESTDB' and query like '%ODBC_TEST%';
 CLIENT_USER_ID | CLIENT_APPLICATION_NAME | CLIENT_WORKSTATION_NAME | CLIENT_ACCOUNTING_STRING |                  QUERY
----------------+-------------------------+-------------------------+--------------------------+-----------------------------------------
 someuser       | someapplication         | someworkstation         | someacctstring           | select current_date ODBC_TEST
                |                         |                         |                          | select current_date NOTODBC_TEST
(2 rows)

Upvotes: 2

Related Questions