SetDatabase

Syntax

DatabaseResult SetDatabase(OdId tOb, SetDatabaseArg tArg)

Parameters

tOb. Database moniker.

tArg. Operation execution parameters.

Description

The SetDatabase operation changes database metadata.

Comments

The operation enables the user to change 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.

Example

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.

SOAP request:

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SetDatabase xmlns="http://www.fsight.ru/PP.SOM.Som">
<tOb xmlns="">
  <id>S1!M!S!DB4</id>
  </tOb>
<tArg xmlns="">
<meta>
<connectionParams>
  <loginPrompt>false</loginPrompt>
  <useMetabaseCredentials>true</useMetabaseCredentials>
  </connectionParams>
  </meta>
  </tArg>
  </SetDatabase>
  </s:Body>
  </s:Envelope>

SOAP response:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<SetDatabaseResult xmlns="http://www.fsight.ru/PP.SOM.Som" xmlns:q1="http://www.fsight.ru/PP.SOM.Som" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<id xmlns="">
  <id>S1!M!S!DB4</id>
  </id>
<meta xmlns="">
<obInst>
<obDesc ds="" isShortcut="0" isLink="0" ver="24" hf="0">
  <i>DB_DATA</i>
  <n>Database</n>
  <k>174189</k>
  <c>513</c>
  <p>9050</p>
  <h>0</h>
  <hasPrv>0</hasPrv>
  <ic>0</ic>
  <isPermanent>1</isPermanent>
  <isTemp>0</isTemp>
  </obDesc>
  </obInst>
  <dirty>0</dirty>
<connectionParams>
  <useMetabaseLogonData>0</useMetabaseLogonData>
  <user>sa</user>
  <pass>Qwerty1</pass>
<logonDataExt>
  <driver>MSSQL2012</driver>
  <server>%METABASE_SERVER%</server>
  <database>%METABASE_DATABASE%</database>
  <schema>dbo</schema>
  <unicode>1</unicode>
  <authentication>Password</authentication>
  <caseSensitive>0</caseSensitive>
<logonTask>
  <subName />
  </logonTask>
  <webServiceLogon>0</webServiceLogon>
  </logonDataExt>
  <useUnicode>1</useUnicode>
  <loginPrompt>0</loginPrompt>
  <useMetabaseCredentials>1</useMetabaseCredentials>
  <autoAdjustRights>0</autoAdjustRights>
  <useApplicationRole>0</useApplicationRole>
  <supportDecimal>0</supportDecimal>
  <supportBinaryProtocol>1</supportBinaryProtocol>
  </connectionParams>
  </meta>
  </SetDatabaseResult>
  </soapenv:Body>
  </soapenv:Envelope>

JSON request:

{
"SetDatabase" :
{
"tOb" :
{
"id" : "S1!M!S!DB4"
},
"tArg" :
{
"meta" :
{
"connectionParams" :
{
"loginPrompt" : "false",
"useMetabaseCredentials" : "true"
}
}
}
}
}

JSON response:

{
"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:

Working with Relational Objects of Repository