This document is archived and information here might be outdated.  Recommended version.


IDataServerManagerAdmin.CreateGeodatabase Method (ArcObjects .NET 10.4 SDK)
ArcObjects Library Reference (DataSourcesGDB)  

IDataServerManagerAdmin.CreateGeodatabase Method

Creates a new Geodatabase.

[Visual Basic .NET]
Public Sub CreateGeodatabase ( _
    ByVal gdbName As String, _
    ByVal gdbFileName As String, _
    ByVal gdbFileSize As Integer, _
    ByVal logFileName As String, _
    ByVal logFileSize As Integer _
)
[C#]
public void CreateGeodatabase (
    string gdbName,
    string gdbFileName,
    int gdbFileSize,
    string logFileName,
    int logFileSize
);
[C++]
HRESULT CreateGeodatabase(
  BSTR gdbName,
  BSTR gdbFileName,
  long gdbFileSize,
  BSTR logFileName,
  long logFileSize
);
[C++]

Parameters gdbName [in] gdbName is a parameter of type BSTR gdbFileName [in] gdbFileName is a parameter of type BSTR gdbFileSize [in] gdbFileSize is a parameter of type long logFileName [in] logFileName is a parameter of type BSTR logFileSize [in] logFileSize is a parameter of type long

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Errors Returned

An error will be raised if a directory is not specified or if an invalid path is supplied for the gdbFileName argument.

An error will be raised if an mdf or log file already exists with the supplied name.

Remarks

The CreateGeodatabase method creates a geodatabase with the supplied name, corresponding to the specified .mdf file.

The gdbName and gdbFileName arguments must have the same name, geodatabases with different names from the .mdf file are not currently supported.  The gdbFileName argument should contain the complete folder path to the location in which the .mdf file will be created.  It should also correspond with the name of the geodatabase to be created and should have the ".mdf" suffix specified.

gdbFileSize is in megabytes and is an optional parameter.  If you specify 0, the size of the database created will be set to the data server's defaults (which is generally around 7 MBs). 

logFileName and logFileSize are also optional parameters.  If you specify an empty string for the logFileName or 0 for the logFileSize, they will be set to the data server's defaults. If an empty string is supplied for logFileName, a file will be created in the same directory as that specified for the gdbFileName, but will conform to the following: gdbFileName & "_log.LDF".  If the logFileName argument is supplied, a valid size (greater than 0), must be supplied for the logFileSize.  The logFileName may have a different name and be created within a different location than the .mdf file, however, this is generally not recommeded.

You must be a server administrator to perform this operation.

After a geodatabase has been created, all server administrators, including the user who created the geodatabase will have access to it.  Other users will need to be granted permission to the geodatabase.

See Also

IDataServerManagerAdmin Interface

.NET Related Topics

Creating geodatabases