SQL Admin Provider::CreateDatabase

The CreateDatabase method allows you to create a database on a SQL server. The only required parameter is that of the database name. Similar to Transact SQL, any values not provided will be provided by SQL per the details of the model database.

Arguments

Input argument Required Description

Name

Yes

The name of the database to be created.

ServerName

Yes

A string representing the name of the server. This can be a network basic input/output system (NetBIOS) name, a fully qualified domain name (FQDN), or an IP address. It is vital that the server upon which MPS is running be able to resolve server names using whichever naming convention you employ.

[sqlUserName]

No

User name for connecting to the SQL server via SQL Authentication. If this node is present, the connection will be made via SQL Authentication rather than Windows Authentication. The existence of this node also requires that the <sqlUserPass/> node exist.

[sqlUserPass]

No

The password for connecting to the SQL server via SQL Authentication, using the username indicated by <sqlUserName/>. If the <sqlUserName/> node is not present, this node is ignored.

[dataFile/logicalName]

No

Logical name for the file. If you intend to supply any of the optional dataFile parameters, you must set the logical name of the data file.

[dataFile/filePath]

No

Operating system file name (full path). Requires that the dataFile/logicalName node exist and be non-null.

[dataFile/fileSize]

No

Size of file in megabytes (MB) (you must specify the unit). If not specified, the model database size of the primary file is used. Requires that the dataFile/logicalName node exist and be non-null.

[dataFile/fileMaxSize]

No

Maximum size in kilobytes (KB), MB, gigabytes (GB), or terabytes (TB), you must specify the unit, for the file. The default is MB and must be a whole number. The default is unlimited. Requires that the dataFile/logicalName node exist and be non-null.

[dataFile/fileGrowth]

No

Designates a growth increment in KB, MB, GB, TB, or percentage (you must specify the unit). The default is 10 percent and the minimum value is 64 KB. Requires that the dataFile/logicalName node exist and be non-null.

[logFile/logicalName]

No

Logical name for the file. If no log file is specified, a single log file is created with a system-generated name and size that is 25 percent of total data file size. If you intend to supply any of the optional logFile parameters, you must set the logical name of the data file.

[logFile/filePath]

No

Operating system file name (full path). Requires that the logFile/logicalName node exist and be non-null.

[logFile/fileSize]

No

Size of file in MB (you must specify the unit). If not specified, the model database size of the primary file is used. Requires that the logFile/logicalName node exist and be non-null.

[logFile/fileMaxSize]

No

Maximum size in KB, MB, GB, or TB for the file. The default is megabyte (MB) and must be a whole number. The default is unlimited. Requires that the logFile/logicalName node exist and be non-null.

[logFile/fileGrowth]

No

Designates a growth increment in KB, MB, GB, TB, or percentage (you must specify the unit). The default is 10 percent and the minimum value is 64 KB. Requires that the logFile/logicalName node exist and be non-null.

Output argument Description

Name

The name of the database to be created.

ServerName

A string representing the name of the server. This can be a NetBIOS name, a FQDN, or an IP address. It is vital that the server upon which MPS is running be able to resolve server names using whichever naming convention you employ.

dataFile/logicalNam

Logical name for the file.

dataFile/filePath

Operating system file name (full path).

dataFile/fileSize

Size of file in MB. If not specified, the model database size of the primary file is used.

dataFile/fileMaxSize

Maximum size in KB, MB, GB, or TB for the file. The default is MB and must be a whole number. The default is unlimited.

dataFile/fileGrowth

Designates a growth increment in KB, MB, GB, TB, or percentage. The default is 10 percent and the minimum value is 64 KB.

logFile/logicalName

Logical name for the file. If no log file is specified, a single log file is created with a system-generated name and size that is 25 percent of total data file size.

logFile/filePath

Operating system file name (full path).

logFile/fileSize

Size of file in MB. If not specified, the model database size of the primary file is used.

logFile/fileMaxSize

Maximum size in KB, MB, GB, or TB for the file. The default is MB and must be a whole number. The default is unlimited.

logFile/fileGrowth

Designates a growth increment in KB, MB, GB, TB, or percentage. The default is 10 percent and the minimum value is 64 KB.

Remarks

Rollback Calls

On transaction rollback, the DeleteDatabase method is called.

Sample Code

Example XML Request

Text here.The following is an example of an XML request for the CreateDatabase method of the SQL Admin Provider:

<?xml version="1.0" encoding="iso-8859-1" ?>  
<request> 
    <data> 
        <name>SampleSQL01</name> 
            <serverName>MySQLServer</serverName> 
            <dataFile> 
                <logicalName>SampleSQL01_dat</logicalName> 
                <filePath> 
                 d:\Program Files\Microsoft SQL Server\ 
                 MSSQL\Data\SampleSQL01.mdf 
                </filePath> 
                <fileSize>2MB</fileSize> 
                <fileMaxSize>100MB</fileMaxSize> 
                <fileGrowth>10%</fileGrowth> 
            </dataFile> 
            <logFile> 
                <logicalName>SampleSQL01_log</logicalName>  
                <filePath> 
                 d:\Program Files\Microsoft SQL Server\ 
                 MSSQL\Data\SampleSQL01_log.ldf 
                </filePath> 
                <fileSize>1MB</fileSize> 
                <fileMaxSize>25MB</fileMaxSize> 
                <fileGrowth>1MB</fileGrowth> 
            </logFile> 
    </data> 
    <procedure> 
    <execute namespace="SQL Admin Provider" procedure="CreateDatabase"> 
    <before source="data" destination="executeData" mode="merge"/> 
    <before source="executeData" destination="data" mode="insert"/> 
    </execute> 
    </procedure> 
</request> 

Example XML Response

The following is an example of an XML response for the CreateDatabase method:

<?xml version="1.0" encoding="iso-8859-1" ?>  
<response> 
    <data> 
        <name>SampleSQL01</name> 
        <serverName>SQL01</serverName> 
        <dataFile> 
            <logicalName>SampleSQL01_dat</logicalName> 
            <filePath> 
             d:\Program Files\Microsoft SQL Server\ 
             MSSQL\Data\SampleSQL01.mdf 
            </filePath> 
            <fileSize>2MB</fileSize> 
            <fileMaxSize>100MB</fileMaxSize> 
            <fileGrowth>10%</fileGrowth> 
        </dataFile> 
        <logFile> 
            <logicalName>SampleSQL01_log</logicalName> 
            <filePath> 
             d:\Program Files\Microsoft SQL Server\ 
             MSSQL\Data\SampleSQL01_log.ldf 
            </filePath> 
            <fileSize>1MB</fileSize> 
            <fileMaxSize>25MB</fileMaxSize> 
            <fileGrowth>1MB</fileGrowth> 
        </logFile> 
        <sqlUserName>sampleUser</sqlUserName> 
        <sqlUserPass>Pass1Word</sqlUserPass> 
    </data> 
</response> 

Applies To

for:

  • Hosted Messaging and Collaboration version 4.5

  • Hosted Messaging and Collaboration version 4.0

  • Hosted Messaging and Collaboration version 3.5

  • Hosted Messaging and Collaboration version 3.0

  • Windows-based Hosting version 4.5

  • Windows-based Hosting version 4.0

  • Windows-based Hosting version 3.5

  • Windows-based Hosting for Applications version 1.0

See also

Tasks

SQL Admin Provider::DeleteDatabase
SQL Admin Provider::ModifyDatabaseFile