I'm writing a cpp application that connects to a vertica 7.1 server via odbc. The development system is an hLinux (Debian variant), I'm using the latest odbc driver manager and drivers from vertica.
I've setup the odbc.ini, odbcinst.ini and vertica.ini files as per the instructions and set an environment variable VERTICAINI. I'm able to connect to the server using "isql <myDSNName>".
But, when invoking the following code:
Code: Select all
ret = SQLConnect(hdlDbc, (SQLCHAR*)dsn, sizeof(dsn)-1,(SQLCHAR*)userID,sizeof(userID)-1,
(SQLCHAR*)passwd,sizeof(passwd)-1);
if(!SQL_SUCCEEDED(ret)) {
SQLCHAR *sqlstate = new u_char[6];
SQLINTEGER nativeError=0;
SQLCHAR *messageText = new u_char[255];
SQLSMALLINT textLength =0;
SQLGetDiagRec(SQL_HANDLE_DBC,hdlDbc,1, sqlstate,
&nativeError, messageText,
255, &textLength);
printf("Could not connect to database.\n");
cout << messageText << endl;
}
I've checked the odbc.ini file and these two properties appear (stars mask the actual values for security reasons):Could not connect to database.
[Vertica][ODBC] (10380) Unable to establish a connection with data source. Missing settings: {[Database] [ServerName]}
$ cat /etc/odbc.ini
[ODBC Data Sources]
Vertica = "*********************************"
[Vertica]
Description = HP Vertica DSN ODBC driver for ****
Driver = /opt/vertica/lib64/libverticaodbc.so
Database = ****
Servername = ***********************.hp.com
UserName = ******
Password = *******
Port = ****
LogLevel=4
LogPath=/tmp
Ideas anyone?
Thanks,
Tomer