Example #1
0
        protected override void Arrange()
        {
            EnvironmentHelper.AssertDb2ClientIsInstalled();
            DatabaseProviderFactory factory = new DatabaseProviderFactory(Db2TestConfigurationSource.CreateConfigurationSource());

            database = factory.Create("Db2Test") as Db2Database;
        }
        public void CanConnectToDb2AndExecuteCommand()
        {
            ConnectionStringSettings data = ConfigurationManager.ConnectionStrings["Db2Test"];
            Db2Database  Db2Database      = new Db2Database(data.ConnectionString);
            DbConnection connection       = Db2Database.CreateConnection();

            Assert.IsNotNull(connection);
            Assert.IsTrue(connection is iDB2Connection);
            connection.Open();
            DbCommand cmd = Db2Database.GetSqlStringCommand("Select * from Region");

            cmd.CommandTimeout = 0;
            cmd.Connection     = connection;
            cmd.ExecuteReader(System.Data.CommandBehavior.CloseConnection);
        }