By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,988 Members | 1,350 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,988 IT Pros & Developers. It's quick & easy.

DB2 remote connection string on vb 2005

P: 1
Hi,

I would like to know what's the right connection string on vb 2005. I would like to connect to a database from a db2 server(version 9).

I can connect to a db2 server using a db2 client application. However I cannot connect to it from my vb 2005 application coz i don't know the connection string that i will use..

Can you give some sample codes.

Any help will be deeply appreciated


Thanks,
Jan 10 '08 #1
Share this Question
Share on Google+
1 Reply


MindBender77
100+
P: 234
Hi,
I would like to know what's the right connection string on vb 2005.
Make sure you: Import system.data.oledb.oledbconnections
Try this connection string:

Expand|Select|Wrap|Line Numbers
  1. Dim con as ADODB.Connection
  2.  
  3. Public Sub db2_connection()
  4.    Try
  5.         con = New ADODB.Connection
  6.         con.ConnectionString = "DSN = yourDSN; UID = yourUserID; PWD =               
  7.                yourPassword"
  8.         con.Provider = "IBMDADB2"
  9.         con.CursorLocation = ADODB.CursorLocationEnum.adUseClient
  10.         con.Open()
  11.  
  12.    Catch ex As Exception
  13.         Msgbox(ex.message)
  14.         con.close()
  15.         me.close()
  16.    End Try
  17. End Sub
  18.  
Jan 15 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.