Well, I am looking through the Vertica documentation, and I see no way to connect to ODBC without creating a DSN. JDBC seems to be a different matter. If there is a way to do this, I do not see it.
The problem (it is assumed that you have a driver) is that the system does not know that your connection string should be processed by the Vertica driver. The DSN already indicates this, so why does it work (my educated guess).
This is the example they give for JDBC:
"JDBC: Vertica: // server: port / db user = username and amplifier, password = password & = SSL true"
The JDBC connection string seems to let the code know that it should use Vertica.
Let me post part of the relevant document (forgive formatting) regarding ODBC:
DSN Parameters
The parameters in the following tables are common to all user and system DSN entries. The above examples are for Windows clients.
To edit DSN parameters:
* UNIX and Linux users can edit the odbc.ini file. (See Creating an ODBC DSN for Linux and Solaris Clients.) The location of this file is specific to the driver manager. * Windows users can edit the DSN parameters directly by opening the DSN entry in the Windows registry (for example, at HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI\vmartdb). However, the Vertica-preferred method is to follow the steps in Creating an ODBC DSN for Windows Clients. * Parameters can be set while making the connection using SQLDriverConnect(). sqlRet = SQLDriverConnect(sql_hDBC, 0, (SQLCHAR*)"DSN=VerticaSQL;BinaryDataTransfer=1", SQL_NTS, szDNS, 1024,&nSize, SQL_DRIVER_NOPROMPT); Note: In the connection string ';' is a reserved symbol. If you need to set multiple parameters as part of ConnSettings parameter use '%3B' in place of ';'. Also use '+' instead of spaces. For Example: sqlRet = SQLDriverConnect(sql_hDBC, 0, (SQLCHAR*)"DSN=VerticaSQL;BinaryDataTransfer=1;ConnSettings= set+search_path+to+a,b,c%3 Bset+locale=ch;SSLMode=prefer", SQL_NTS, szDNS, 1024,&nSize, SQL_DRIVER_NOPROMPT); * Parameters can also be set and retrieved after the connection has been made using SQLConnect(). Parameters can be set and retrieved using SQLSetConnectAttr(),SQLSetStmtAttr(), SQLGetConnectAttr() and SQLGetStmtAttr() API calls.
geoffrobinson
source share