none
Connection string for iSeries Access RRS feed

  • Question

  • Hello,

    I am writing a database connection class in C# to connect to an iSeries machine. I have tried various connection strings but they all fail. I keep getting the message "The connection string is invalid". Can anyone please help. For clarity, I am enclosing my code below (the connection part of it). Thanks a lot guys. 


    using

     

    System;

    using

     

    System.Collections.Generic;

    using

     

    System.Text;

    using

     

    System.Data;

    using

     

    System.Data.Common;

    using

     

    System.Configuration;

    using

     

    System.Security.Principal;

    using

     

    IBM.Data.DB2.iSeries;

    namespace

     

    MyNameSpace

    {

     

    public class DatabaseConn

    {

     

    private string sConnectString = string.Empty;

     

     

    public void ConnectToAS400()

    {

     

    string sSqlQuery = string.Empty;

     

    sConnectString =

    new iDB2Connection("Data Source=mydatasourceipaddress;user id=myuserid;password=mypassword;").ToString();

     

     

    using (iDB2Connection connection = new iDB2Connection(sConnectString))

    {

    try{

    connection.Open();
    }
    catch(iDB2InvalidConnectionStringException ex)
    {
    ex.Message.ToString();
    }
    }
    }
    }
    }

    Thursday, June 18, 2009 5:27 PM

All replies