Currently, I'm trying to query a Db2 instance from VBA but am having hard time finding proper documentation or previous stack questions that provide complete answers.
When I run the below, I receive an error:
"SQL1032N No start database manager command was issued. SQLSTATE=57019"
Current connection code:
Sub connect()
Dim conn As Object 'Variable for ADODB.Connection object
Dim rs As Object 'Variable for ADODB.Recordset object
Set conn = CreateObject("ADODB.Connection")
Set rs = CreateObject("ADODB.Recordset")
conn.ConnectionString = "Provider=IBMDADB2.1;Server=servername;Database=dbname;Port=port;Data Source=DB2;ProviderType=OLEDB;UID=uid;PWD=pw"
conn.Open
rs.Open "Select * .....", conn
rs.Close
conn.Close
End Sub
Thanks yall
Just for reference for anybody who stumbles upon this question in the future, I was able to successfully connect with the following:
Dim conn As Object 'Variable for ADODB.Connection object
Dim rs As Object 'Variable for ADODB.Recordset object
Set conn = CreateObject("ADODB.Connection")
Set rs = CreateObject("ADODB.Recordset")
conn.ConnectionString = "Provider=IBMDADB2.1;UID=" & username & ";PWD=" & password & ";Data Source=ABCDB1;ProviderType=OLEDB"
conn.Open
Note: username and password are strings assigned appropriate credentials
This works on my machine with Windows 7, client DB2 installed, and Excel 2010 over a private/secure LAN network