DatabaseResult SetDatabase(OdId tOb, SetDatabaseArg tArg)
tOb. Database moniker.
tArg. Operation execution parameters.
The SetDatabase operation changes database metadata.
The operation changes database server connection parameters. A database should be opened for edit. To execute the operation, in the tOb field specify moniker of opened database instance, and in the tArg.meta field specify updated metadata to be applied. The moniker can be obtained on executing the OpenDatabase operation. The changes are saved automatically on executing the operation. The operation results in the updated database metadata.
The example of changing database server connection parameters. The request contains moniker of opened database instance and values of parameters to be set (automatic connection and use of credentials specified on repository connection). The response contains updated metadata.
{
"SetDatabase" :
{
"tOb" :
{
"id" : "S1!M!S!DB4"
},
"tArg" :
{
"meta" :
{
"connectionParams" :
{
"loginPrompt" : "false",
"useMetabaseCredentials" : "true"
}
}
}
}
}
{
"SetDatabaseResult" :
{
"id" :
{
"id" : "S1!M!S!DB4"
},
"meta" :
{
"obInst" :
{
"obDesc" :
{
"@ds" : "",
"@isShortcut" : "0",
"@isLink" : "0",
"@ver" : "24",
"@hf" : "0",
"i" : "DB_DATA",
"n" : "Database",
"k" : "174189",
"c" : "513",
"p" : "9050",
"h" : "0",
"hasPrv" : "0",
"ic" : "0",
"isPermanent" : "1",
"isTemp" : "0"
}
},
"dirty" : "0",
"connectionParams" :
{
"useMetabaseLogonData" : "0",
"user" : "sa",
"pass" : "Qwerty1",
"logonDataExt" :
{
"driver" : "MSSQL2012",
"server" : "%METABASE_SERVER%",
"database" : "%METABASE_DATABASE%",
"schema" : "dbo",
"unicode" : "1",
"authentication" : "Password",
"caseSensitive" : "0",
"logonTask" :
{
"subName" : ""
},
"webServiceLogon" : "0"
},
"useUnicode" : "1",
"loginPrompt" : "0",
"useMetabaseCredentials" : "1",
"autoAdjustRights" : "0",
"useApplicationRole" : "0",
"supportDecimal" : "0",
"supportBinaryProtocol" : "1"
}
}
}
}
public static DatabaseResult ChangeDatabase(string moniker, bool loginPromptValue, bool useMetabaseCredentialsValue)
{
var somClient = new SomPortTypeClient(); //Proxy object for operation execution
//Operation execution parameters
var tSet = new SetDatabase()
{
tArg = new SetDatabaseArg()
{
meta = new DatabaseMd()
{
connectionParams = new ConnectionParams()
{
loginPrompt = loginPromptValue,
useMetabaseCredentials = useMetabaseCredentialsValue
}
}
},
tOb = new OdId() { id = moniker }
};
//Change parameters
var tResult = somClient.SetDatabase(tSet);
return tResult;
}
See also: