Skip to content

Latest commit

 

History

History
52 lines (43 loc) · 2.08 KB

README.md

File metadata and controls

52 lines (43 loc) · 2.08 KB

Pre-requisites

  • 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.

Running the ODBC sample app

  1. Run sudo yum install unixODBC-devel (allows include sql.h)
  2. 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
  1. Create ~/.odbc.ini
  2. 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
  1. Run export LIBVERTICAODBC_DIR=<folder containing libverticaodbc.so>. For example, if your libverticaodbc.so is located at /opt/vertica/lib64/libverticaodbc.so, then you should use /opt/vertica/lib64
  2. Run g++ OAuthSampleApp.cpp -L$LIBVERTICAODBC_DIR -lverticaodbc -Wl,-rpath=$LIBVERTICAODBC_DIR
  3. 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>