[RSS]

Create MySQL Database UI Spec

This UI spec describes the details of the CreateDatabase action associated with a database listed under the MySQL node (see MySQLNodeUISpec)

Clicking on this action brings up the following dialog:

----------------------------------------------------------------
|            Create MySQL Database                              |
|                                                               |
| Database Name: _________________________________V             |
|                                                               |
| [x] Grant full access to user: _____________________V         |
|                                                               |
| [x] Create connection in Database Explorer                    |
|                                                               |
|                                              [Cancel]  [OK]   |
|---------------------------------------------------------------

Note that the database name is a drop-down. We will provide pre-configured sample databases that can be created this way. The pre-configured samples are:

  • sample - the standard sample database
  • travel - the visualweb sample database
  • vir - Vehicle Incident Report - the old Creator sample database

Alternately, the user can type in their own name, and a new database with that name is created.

The user can also choose to grant full access to this database to a specific user, by checking the "Grant read/write access" checkbox and picking the user from the drop-down

When the user clicks "OK", NetBeans does the following:

  • Connects to the database server using the provided credentials
  • If the sample database exists, bring up a dialog telling the user that the sample already exists:
---------------------------------------------------------
|                                                       |
| The database {dbname} already exists.  Do you want to |
| delete it?                                            |
|                                                       |
|                                      [Cancel]  [OK]   |
---------------------------------------------------------

If the user presses "Cancel" they are returned to the Create Database dialog so they can make changes if they want to.

If the user presses "OK", then we continue:

  • Delete the old database if it exists
  • Issue the command to create the new database

If this is a sample database, these steps are also performed:

  • Create the appropriate schema on the database server for the sample
    • 'app' for sample
    • 'travel' for travel
    • 'vir' for vir
  • Create the tables and data and other artifacts under that schema

If the user has checked the "Grant rights" box, then the provider grants full access to the new database to the selected user.

Upon completion, if the user has checked the "Create connection" checkbox, the provider registers a connection to the new database in the Database Explorer with an empty user and password.

It is possible for the database to be created and then an error occurs afterwards (e.g. when creating tables or granting rights). When this happens, the error is displayed, and then a second dialog is shown:

---------------------------------------------------------
|                                                         |
| The database was created but a subsquent error occurred |
| Do you want to delete the database?                     |
|                                                         |
|                                        [Cancel]  [OK]   |
---------------------------------------------------------

If they press "Cancel" then the database is not deleted.

If they press "OK" then the database is deleted.

If there is an error while attempting to delete the database, an error dialog is displayed.