예제 #1
0
        protected override SQLConnection InternalCreateConnection()
        {
            // ConnectionClass:
            //  ODBCConnection (default)
            // ConnectionStringBuilderClass
            // LinterADOConnectionStringBuilder (default)

            D4.ClassDefinition classDefinition =
                new D4.ClassDefinition
                (
                    Device.ConnectionClass == String.Empty ?
                    "ODBCConnection.ODBCConnection" :
                    Device.ConnectionClass
                );
            D4.ClassDefinition builderClass =
                new D4.ClassDefinition
                (
                    Device.ConnectionStringBuilderClass == String.Empty ?
                    "LinterDevice.LinterODBCConnectionStringBuilder" :
                    Device.ConnectionStringBuilderClass
                );
            ConnectionStringBuilder connectionStringBuilder = (ConnectionStringBuilder)ServerProcess.CreateObject(builderClass, new object[] {});

            D4.Tags tags = new D4.Tags();
            tags.AddOrUpdate("DataSource", Device.DataSource);
            tags.AddOrUpdate("UserName", DeviceSessionInfo.UserName);
            tags.AddOrUpdate("Password", DeviceSessionInfo.Password);

            tags = connectionStringBuilder.Map(tags);
            Device.GetConnectionParameters(tags, DeviceSessionInfo);
            string connectionString = SQLDevice.TagsToString(tags);

            return((SQLConnection)ServerProcess.CreateObject(classDefinition, new object[] { connectionString }));
        }
예제 #2
0
        protected override SQLConnection InternalCreateConnection()
        {
            // ConnectionClass:
            //  ADOConnection
            //  DB2Connection (default)
            //	ODBCConnection

            // ConnectionStringBuilderClass:
            //  DB2OLEDBConnectionStringBuilder
            //  DB2DB2ConnectionStringBuilder (default)
            //	DB2ODBCConnectionStringBuilder

            /*
             * Note that when this device is connected via ODBC, and HY011 error can occur
             * If this happens, ensure that Asynchronus query executes and cursor holding are both disabled
             * these properties are set in the transaction tab of the advanced settings of the IBM ODBC prog
             */

            D4.ClassDefinition LClassDefinition =
                new D4.ClassDefinition
                (
                    Device.ConnectionClass == String.Empty ?
                    Device.Product == DB2.DB2TextEmitter.UDB ?
                    "DB2Connection.DB2Connection" :
                    "DB2400Connection.DB2400Connection" :
                    //"ODBCConnection.ODBCConnection" :
                    Device.ConnectionClass
                );

            D4.ClassDefinition LBuilderClass =
                new D4.ClassDefinition
                (
                    Device.ConnectionStringBuilderClass == String.Empty ?
                    Device.Product == DB2.DB2TextEmitter.UDB ?
                    "DB2Device.DB2DB2ConnectionStringBuilder" :
                    "DB2Device.DB2DB2400ConnectionStringBuilder" :
                    //"DB2Device.DB2ODBCConnectionStringBuilder" :
                    Device.ConnectionStringBuilderClass
                );
            ConnectionStringBuilder LConnectionStringBuilder = (ConnectionStringBuilder)ServerProcess.CreateObject(LBuilderClass, new object[] {});

            D4.Tags LTags = new D4.Tags();
            LTags.AddOrUpdate("DataSource", Device.DataSource);
            LTags.AddOrUpdate("UserName", DeviceSessionInfo.UserName);
            LTags.AddOrUpdate("Password", DeviceSessionInfo.Password);
            if (Device.Schema != String.Empty)
            {
                LTags.AddOrUpdate("Database", Device.Schema);
            }

            LTags = LConnectionStringBuilder.Map(LTags);
            Device.GetConnectionParameters(LTags, DeviceSessionInfo);
            string LConnectionString = SQLDevice.TagsToString(LTags);

            return((SQLConnection)ServerProcess.CreateObject(LClassDefinition, new object[] { LConnectionString }));
        }
예제 #3
0
        protected override SQLConnection InternalCreateConnection()
        {
            // ConnectionClass:
            //  ODBCConnection
            //  OLEDBConnection
            //  ADOConnection (default)
            //  SASConnection
            // ConnectionStringBuilderClass
            // SASADOConnectionStringBuilder (default)
            //can use others too

            D4.ClassDefinition LClassDefinition =
                new D4.ClassDefinition
                (
                    Device.ConnectionClass == String.Empty ?
                    "ADOConnection.ADOConnection" :
                    Device.ConnectionClass
                );
            D4.ClassDefinition LBuilderClass =
                new D4.ClassDefinition
                (
                    Device.ConnectionStringBuilderClass == String.Empty ?
                    "SASDevice.SASOLEDBConnectionStringBuilder" :
                    Device.ConnectionStringBuilderClass
                );
            ConnectionStringBuilder LConnectionStringBuilder = (ConnectionStringBuilder)ServerProcess.CreateObject(LBuilderClass, new object[] {});

            D4.Tags LTags = new D4.Tags();
            LTags.AddOrUpdate("ServerID", Device.ServerID);
            LTags.AddOrUpdate("Location", Device.Location);
            LTags.AddOrUpdate("UserName", DeviceSessionInfo.UserName);
            LTags.AddOrUpdate("Password", DeviceSessionInfo.Password);

            LTags = LConnectionStringBuilder.Map(LTags);
            Device.GetConnectionParameters(LTags, DeviceSessionInfo);
            string LConnectionString = SQLDevice.TagsToString(LTags);

            SQLConnection LConnection = (SQLConnection)ServerProcess.CreateObject(LClassDefinition, new object[] { LConnectionString });

            LConnection.DefaultUseParametersForCursors = false;
            return(LConnection);
        }