# EsbCreateDatabase

Description

EsbCreateDatabase() creates a new database within an application, either on the client or the server. If the database is created on the server, it is also started.

Syntax

    EsbCreateDatabase (hCtx, AppName, DbName, DbType)

    ByVal hCtx    As Long
    ByVal AppName As String
    ByVal DbName  As String
    ByVal DbType  As Integer

Parameters

hCtx | Essbase VB API context handle.
AppName | Name of an application to contain database.
DbName | Name of a database to create. Database names can be 8 characters long, and can contain all special characters allowed in DOS file names. No spaces, commas, tabs, slashes, backslashes, or periods are allowed. The use of some special characters is not recommended because they are often used by the operating system (for example, @, $, %, and &).
DbType | Type of database to create: (ESB_DBTYPE_NORMAL/ESB_DBTYPE_CURRENCY).

Return Value

None.

Notes

- Creating a client database creates a directory to contain local database files.
- A newly created database or application is not automatically set to active. Call EsbSetActive() after calling EsbCreateDatabase() or EsbCreateApplication() to keep subsequent functions, such as EsbRestructure(), from operating on the wrong database or application (the application or database that is already active).

Access

For a server database, the caller must have database Create/Delete/Edit privilege (ESB_PRIV_DBCREATE).

Example

    Declare Function EsbCreateDatabase Lib "ESBAPIW" (ByVal hCtx As Long, ByVal AppName As String, ByVal DbName As String, ByVal DbType As Integer) As Long

    Sub ESB_CreateDatabase ()
       Dim sts As Long
       Dim AppName As String
       Dim DbName As String

       AppName = "Sample"
       DbName = "Basic"

       '****************
       ' Create database
       '****************
       sts = EsbCreateDatabase (hCtx, AppName, DbName,
       ESB_DBTYPE_NORMAL)
    End Sub

See Also

EsbCreateApplication()
EsbCreateObject()