title: How to connect to Netezza (PureData System for Analytics) via VBA
body: <p>I am trying to connect to connect to Netezza using VBA. I have enabled the following:</p>
  
  <ul>
  <li>Microsoft Excel 15.0 Object Library</li>
  <li>Microsoft Office 15.0 Object Library</li>
  <li>Microsoft ActiveX Data Objects 6.1 Library</li>
  <li>Visual Basic for Applications</li>
  </ul>
  
  <p>Here is my code:</p>
  
  <pre><code>Sub NZConn()
  
  Dim cmd As New ADODB.Command
  Dim rs As New ADODB.Recordset
  Dim x As Variant
  
  Set cmd = New ADODB.Command
  Set RS = New ADODB.Recordset
  
  cmd.ActiveConnection = "Driver={Netezza " &amp; _
  "ODBC};servername=servername;port=####;database=database;" &amp; _
  "username=username;password=password;"
  
  cmd.ActiveConnection.CursorLocation = adUseClient
  cmd.CommandTimeout = 120
  cmd.CommandType = adCmdText
  
  x = "Write Query here"
  cmd.CommandText = x
  
  Set rs = cmd.Execute
  Sheet1.Range("A1").CopyFromRecordset rs
  
  cmd.ActiveConnection.Close
  
  End Sub
  </code></pre>
  
  <p>I can get the code to run without throwing back an error, but there is nothing that is pasted from the record set, which leads me to believe that is may have something to do with the structure of the connection string. </p>
  
  <p>I have the server, user id, password, database, port, and driver. </p>
  
  <p>Would I need to establish / open an ActiveConnection first?</p>