Reputation: 131
This is the connection string that I am using:
CxnStr = String.Format("Driver=HiT ODBC/400 Optimized 32bit; UID='{0}'; DPC=0; SSL=0; ChCtg=0; CchUI=0; UnqTb=0; HoldC=1; RmBlk=1; BlkSz=512;BufSz=32767;Rows=0; Libs=0;CSID=0;Stats=1; SpCl=0;Hgls=1; TmOut=9999; NtNm=APPN;MdNm=QSERVER;CmtLvl=0;RdOy=1;SDK=0;Lang=;Pkg=1,1,; CdPg=037; IPAdr='{1}'; APPCRtr=10; Server='{2}'; Database='{3}'; PWD='{4}'", "L10646", HostName, HostName, BasisDatabase, PW)
I am creating a connection using this code:
Try
Using Con As New Odbc.OdbcConnection(CxnStr)
Using Command As New Odbc.OdbcCommand(SQL, Con)
Command.CommandTimeout = 0
Con.ConnectionTimeout = 0
Con.Open()
Using BasDA As New Odbc.OdbcDataAdapter(Command)
BasDA.Fill(DT)
End Using
End Using
End Using
Catch ex As Exception
'Throw New Exception(ex.Message)
End Try
When the connection goes to open, it throws an exception saying:
ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
When I look at my Con variable, many of the parameters that I am assigning are not populated, like Database, Data source, etc.
I have the correct ODBC driver installed, as verified by the ODBCad32.exe program located in C:\Windows\SYSWOW6. The drivers tab shows that the HiT ODBC driver is installed.
What am I doing wrong? I have the driver installed, but even if I didn't the connection string is not filling in the connection properties properly!
Any and all help appreciated!
Upvotes: 2
Views: 263
Reputation: 11
Dillon, Did you get an answer? I just wrote my first .net accessing db2 and this does not look like a good connection string.
This redbook is a little older. But you should find some good information on setting up your connection string. http://www.redbooks.ibm.com/abstracts/sg246440.html
You can use ADO instead of ODBC.
Upvotes: 1