Forum Discussion

shabeerfja's avatar
13 years ago

Creating Connection string for JDBC:DB2

Could someone please help me with this one.I am trying to create a connection string to access my database but dont get connection string to work. Here is Information. I am not sutre abot the driver -- my driver name is : "com.ibm.jcc.DB2Driver"



Function GetDataFromBase(DNS,UID,PWD)


 Set MyConnection = CreateObject("ADODB.Connection")

 Set myrecordset = CreateObject("ADODB.recordset")

 

 MyConnection.ConnectionString ="DSN=" & DNS & "; UID=" & UID & ";PWD=" & PWD

 

 MyConnection.Open


End Function


Function CheckConnection

   Dim MyConnString, MyConnection

   'Set MyConnection = getConnection

   Set MyConnection =GetDataFromBase("DB2Driver","db2admin","Ibmtest1")

   If MyConnection.Errors.Count = 0 Then

    Print "Database Connected"

 else

  Print "Database Failed"

   End If

End Function



Thanks,

Shabeer

  • Hi,



    Most probably, your connection string is incorrect. Check whether you connect to your DB properly - TC doesn't affect this, it just uses ADO. If I get it right that your DB is IBM DB2, you can find the correct connection strings here.