Connecting to Vertica using Excel VBA

Moderator: NorbertKrupa

Post Reply
Posts: 1
Joined: Tue Dec 02, 2014 6:38 pm

Connecting to Vertica using Excel VBA

Post by gordonunderwood » Tue Dec 02, 2014 7:05 pm

Hello all, I'm a new user to this forum, and also a new Vertica user.

Here is my goal: There is a SQL query that needs to be run through our Vertica database. The query changes depending on what inputs the user enters to an excel workbook. I would like to be able to:
  • 1. open a connection to our database
    2. run a query
    3. retrieve those results to populate cells.
I am having trouble with setting up my connection. I have installed the Vertica 64 bit drivers. I am able to connect manually through the connection wizard within excel.

Here is the basic code I have been using to just set up my connection:

Code: Select all

Sub DbConnection()

    Dim cn As ODBCConnection
    Dim strConnect As String
    strConnect = "DSN=xxx;UID=xxx;APP=Microsoft Office 2013;DATABASE=xxx;"
    cn.Connection = strConnect
End Sub
Are there any obvious syntax errors here? Is what I am trying to do even possible?

Note: (There is no password for the database)

Thanks in advance for your help.

Post Reply

Return to “ODBC”