Esempio n. 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 }));
        }
Esempio n. 2
0
        protected override SQLConnection InternalCreateConnection()
        {
            // ConnectionClass:
            //  ODBCConnection
            //  OLEDBConnection
            //  ADOConnection
            //  OracleConnection (default)
            // ConnectionStringBuilderClass
            // OracleConnectionStringBuilder (default)
            // OracleODBCConnectionStringBuilder
            // OracleOLEDConnectionStringBuilder

            var classDefinition =
                new ClassDefinition
                (
                    Device.ConnectionClass == String.Empty
                        ?
#if USEODP
                    "OracleConnection.OracleConnection" :
#else
                    "MSOracleConnection.OracleConnection"
                    :
#endif
                    Device.ConnectionClass
                );
            var builderClass =
                new ClassDefinition
                (
                    Device.ConnectionStringBuilderClass == String.Empty
                        ?
#if USEODP
                    "OracleDevice.OracleConnectionStringBuilder" :
#else
                    "OracleDevice.OracleConnectionStringBuilder"
                    :
#endif
                    Device.ConnectionStringBuilderClass
                );
            var connectionStringBuilder =
                (ConnectionStringBuilder)
                ServerProcess.CreateObject(builderClass, new object[] {});

            var tags = new Tags();

            tags.AddOrUpdate("HostName", Device.HostName);
            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 }));
        }
Esempio n. 3
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 }));
        }
Esempio n. 4
0
        protected override SQLConnection InternalCreateConnection()
        {
            var classDefinition =
                new ClassDefinition
                (
                    Device.ConnectionClass == String.Empty
                                                ? "CacheConnection.CacheConnection"
                                                : Device.ConnectionClass
                );

            var builderClass =
                new ClassDefinition
                (
                    Device.ConnectionStringBuilderClass == String.Empty
                                                ? "CacheConnection.CacheConnectionStringBuilder"
                                                : Device.ConnectionStringBuilderClass
                );

            var connectionStringBuilder =
                (ConnectionStringBuilder)ServerProcess.CreateObject
                (
                    builderClass,
                    new object[] {}
                );

            var tags = new Tags();

            tags.AddOrUpdate("ServerName", Device.ServerName);
            tags.AddOrUpdate("DatabaseName", Device.DatabaseName);
            tags.AddOrUpdate("ApplicationName", Device.ApplicationName);
            tags.AddOrUpdate("Port", Device.Port);
            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 }
                 ));
        }
Esempio n. 5
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);
        }
Esempio n. 6
0
        protected override SQLConnection InternalCreateConnection()
        {
            // ConnectionClass:
            //  ODBCConnection
            //  OLEDBConnection (default)
            //  ADOConnection
            //  MSSQLConnection
            // ConnectionStringBuilderClass
            // MSSQLOLEDBConnectionStringBuilder (default) (use with ADOConnection and OLEDBConnection)
            // MSSQLADODotNetConnectionStringBuilder (use with MSSQLConnection)
            // MSSQLODBCConnectionStringBuilder (use with ODBCConnection)

            /*
             *                  Connectivity Implementations with MSSQL:
             *                          ADOConnection ->
             *                                  When we use ADO, it is fully functional, but thread locks when we attempt to use it concurrently.
             *                                  If we switch providers to MSDASQL, it doesn't work either because the Command and Recordset objects
             *                                  are not being released.  The connection complains that too many recordsets are open, even though no
             *                                  recordsets are open.  Marshal.ReleaseComObject doesn't help either.  I suspect that the thread locking
             *                                  problem we are seeing when we use ADO is related to this same issue.
             *
             *                          MSSQLConnection ->
             *                                  When we use the native managed provider (SqlClient), performance drops by a factor of 2.
             *                                  There are also issues with binary, varbinary, and image data types.
             *
             *                          OLEDBConnection ->
             *                                  The OLEDB managed provider seems to resolve the thread locking issues, but it has yet to be probed for
             *                                  full functionality.  As of right now, this if the only supported connectivity implementation for the
             *                                  MSSQLDevice.  This may change.
             *
             *                          There are also several mono providers which we can try if we run out of options in the Microsoft space.
             *
             *                  BTR 12/20/2004 ->
             *                          Changed the default to use the native managed provider on the assumption that this is faster because less
             *                          layers are involved. This assumption did not hold up under transaction processing tests prior to service pack 1,
             *                          but we are hoping that service pack 1 has improved performance of this provider. We still need to run tp tests
             *                          with the provider.
             *
             *                  BTR 12/20/2004 ->
             *                          Later that same day...
             *                          When using the SqlClient on Jeff's machine (not sure whether it was sp1 or not, need to check) we were getting
             *                          non-deterministic behavior (The connection would close unexpectedly after an open and cause Dataphor to consider
             *                          the connection a transaction failure). This behavior does not occur with the OleDbConnection so we switched back
             *                          to it. More later...
             *
             *                  BTR 12/21/2004 ->
             *                          SqlClient using .NET 1.1 with sp1 is confirmed, the behavior is unpredictable, same codebase with the OleDbConnection
             *                          works fine, so we are switching to that provider until further notice.
             */

            var classDefinition =
                new ClassDefinition
                (
                    Device.ConnectionClass == String.Empty
                        ?
                                                #if USEADOCONNECTION
                    "ADOConnection.ADOConnection"
                                                #else
                                                #if USEOLEDBCONNECTION
                    "Connection.OLEDBConnection"
                                                #else
                    "Connection.MSSQLConnection"
                                                #endif
                                                #endif
                            : Device.ConnectionClass
                );

            var builderClass =
                new ClassDefinition
                (
                    Device.ConnectionStringBuilderClass == String.Empty
                        ?
                                                #if USEADOCONNECTION
                    "MSSQLDevice.MSSQLOLEDBConnectionStringBuilder"
                                                #else
                                                #if USEOLEDBCONNECTION
                    "MSSQLDevice.MSSQLOLEDBConnectionStringBuilder"
                                                #else
                    "MSSQLDevice.MSSQLADODotNetConnectionStringBuilder"
                                                #endif
                                                #endif
                                                : Device.ConnectionStringBuilderClass
                );

            var connectionStringBuilder =
                (ConnectionStringBuilder)ServerProcess.CreateObject
                (
                    builderClass,
                    new object[] {}
                );

            var tags = new Tags();

            tags.AddOrUpdate("ServerName", Device.ServerName);
            tags.AddOrUpdate("DatabaseName", Device.DatabaseName);
            tags.AddOrUpdate("ApplicationName", Device.ApplicationName);
            if (Device.UseIntegratedSecurity)
            {
                tags.AddOrUpdate("IntegratedSecurity", "true");
            }
            else
            {
                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 }
                 ));
        }