0
votes

Code:

Public Class Form1
    Dim con As New OleDb.OleDbConnection


    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Try
            con.ConnectionString = "Provider=DB2OLEDB;Data Source=@IP;Persist Security Info=False;Password=UserPWD;User ID=UserID;Database Name=@IP;Network Address=@IP;Package Collection=QGPL"
            con.Open()
        Catch ex As Exception
            MessageBox.Show("Erreur Message : " & ex.Message)
            MessageBox.Show("Erreur StackTrace: " & ex.StackTrace)
            MessageBox.Show("Erreur HelpLink: " & ex.HelpLink)
            MessageBox.Show("Erreur Source: " & ex.Source)
            MessageBox.Show("Erreur TargetSite: " & ex.TargetSite.ToString())
        End Try
    End Sub
End Class

Error Message:

The host resource could not be found. Check that the Initial Catalog value matches the host resource name.

Error StackTrace:

System.Data.OleDb.OleDbConnectionInternal..ctor(OleDbConnectionString constr, OleDbConnection connection)

System.Data.OleDb.OleDbConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject)

System.Data.ProviderBase.DbConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions)

System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup, DbConnectionOptions userOptions)

System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)

System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource1 retry, DbConnectionOptions userOptions)

System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)

System.Data.ProviderBase.DbConnectionInternal.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)

System.Data.OleDb.OleDbConnection.Open()

TestConnection.Form1.Form1_Load(Object sender, EventArgs e) dans C:\Users...\Form1.vb:ligne 8

Error Source:

Microsoft DB2 OLE DB Provider

Error TargetSite:

Void .ctor(System.Data.OleDb.OleDbConnectionString, System.Data.OleDb.OleDbConnection)

Note: The same program works on my co-worker's PC

My PC configuration: Win 8.1 Pro 64 bits

His PC configuration: Win 7 Pro 64 bits

We are using Cisco Any connect Secure Mobility Client VPN and DB2 provider V 4.0

1

1 Answers

0
votes

your connectionstring is wrong

try Something like this

con.ConnectionString="Provider=IBMDADB2;Database=urDataBase;Hostname=urServerAddress;Protocol=TCPIP;Port=50000;Uid=urUsername;Pwd=urPassword;"

you must change urDataBase, urServerAddress, urUsername and urPassword values of course