- g++ compiler (tested with version 7.3.1)
This sample app was tested on Linux and Windows.
The server must be configured for OAuth as described in the Vertica documentation.
- Run
sudo yum install unixODBC-devel
(allows includesql.h
) - Install the Vertica ODBC driver:
wget https://www.vertica.com/client_drivers/24.2.x/24.2.0-1/vertica-client-24.2.0-1.x86_64.rpm
sudo yum localinstall vertica-client-24.2.0-1.x86_64.rpm
- Create
~/.odbc.ini
- Put this in the
odbc.ini
file:
[ODBC Data Sources]
VerticaDSN = "My Vertica DSN"
[VerticaDSN]
Description = Vertica
Driver = $LIBVERTICAODBC_DIR/libverticaodbc.so
Database = <your db name>
Servername = <your server name>
UID = <your db user ID>
PWD =
Port = <your db port>
ConnSettings =
AutoCommit = 0
Locale = en_US@collation=binary
- Run
export LIBVERTICAODBC_DIR=<folder containing libverticaodbc.so>
. For example, if yourlibverticaodbc.so
is located at/opt/vertica/lib64/libverticaodbc.so
, then you should use/opt/vertica/lib64
- Run
g++ OAuthSampleApp.cpp -L$LIBVERTICAODBC_DIR -lverticaodbc -Wl,-rpath=$LIBVERTICAODBC_DIR
- Execute the generated
a.out
binary by running./a.out --access-token <access token>
Note that for Windows and MacOS, rather than use the .odbc.ini
file the Vertica ODBC client must be installed and a Vertica ODBC data source must be created named VerticaDSN
using the ODBC Data Source Administrator.
Also note that the command to compile the sample app may differ slightly depending on the platform. The following is how to compile on Windows, assuming an ODBC driver is already installed and available (such as through MinGW):
g++ OAuthSampleApp.cpp -lodbc32 -Wall
./a.exe --access-token <access token>
Possible options:
--access-token <access token>
--refresh-token <refresh token>
--client-secret <client secret>