f2s_mssql_contained_db_mode

Applies to: MS SQL

Syntax

set_attribute f2s_mssql_contained_db_mode of {DriverID} to {variable}
get_attribute f2s_mssql_contained_db_mode of {DriverID} to {variable}

Parameter

Description

DriverID

The ID of the driver for which this applies. In most cases, you should use _f2s_ActiveDriverID.

variable

Boolean variable. If true then contained mode is true.

Description

Getting this attribute gets the current contained db mode. Connecting to a contained db is a bit different in that you’re connecting to the database rather than to the server. When setting this attribute (which should be specified BEFORE login) you are not able to use/switch to another database because your connection is isolated to this database. This mode is used for Always On Failover Clustering as well. When connecting to a failover cluster, a contained db must be used. Also, when logging in, the server name should be the failover cluster name rather than the individual server instance name.

Examples

get_attribute

boolean bContained
Get_Attribute f2s_mssql_contained_db_mode of _f2s_ActiveDriverID to bContained

set_attribute

//in the oApplication Object
//activate the f2s_ms driver
f2s_activate_driver "f2s_ms"
//set the contained mode to true
Set_Attribute f2s_mssql_contained_db_mode of _f2s_ActiveDriverID to True
//login to the server - in this case using trusted connection (but you don't have to)
Login "localhost\SQLEXPRESS" "" "" _f2s_ActiveDriver

Replaces: Commands GET_SQL_CONTAINED_DB_MODE and SET_SQL_CONTAINED_DB_MODE