MySQLNodeUISpec

UI Spec for a MySQL node under databases

Tracked by Issue 127539

We recently moved Java DB functionality to a node under Databases. This spec proposes creating a new node for MySQL that also goes under Databases.

This node does not appear by default. It will appear only if we detect a running MySQL server on the local machine at the default port.

The user will also be able to manually register MySQL it is running on the non-standard port, if it's installed but currently not running, or if it is running on a different machine.

Contents


Top-Level Actions

The top-level actions would look like this:

Databases 
    MySQL  -------------------------
          | Create Database...      |
          | Start                   |
          | Stop                    |
          | Connect                 |
          | Delete                  |
          | Run Administration Tool |
          | Properties...           |
           -------------------------

List of Databases

Under the MySQL node will be a list of databases available from this server.

Databases
   MySQL
     sample
     sakila
     vir

This database list is automatically refreshed. So for example if you create or drop a database through the Create Database or Delete actions, of if you do this from the SQL editor or even an external tool, the list of databases will be automatically refreshed.

Each database node will have the following actions

  • Connect
  • Delete

These actions are described in more detail below under "Database Actions"

Manually Registering the MySQL Server

If we do not auto-detect and register the MySQL node, the user can manually register it. There will be a new action under Databases to register the server

Databases
    -------------------------
    | New Connection...     |
    | Register MySQL Server |
    |-----------------------|
    | Enable Debug          |
    | Disable Debug         |
    -------------------------

This will bring up the MySQL Properties dialog (see below), and once this is filled in, the MySQL node will appear under the Databases node.

If the MySQL node is already registered, then this action is not available.

Connection Status and the MySQL Node Name

The MySQL Node has the name
MySQL Server at {host}:{port} [User]"
, e.g.
MySQL Server at localhost:3309 [Root]

If we are currently disconnected from the server, the name also includes the tag "(not connected)", e.g.

MySQL Server at localhost:3309 [Root] (not connected)

If we are in the process of connecting to the server, the name includes the tab "(connecting)"

Actions on the MySQL Node

This section describes each of the top-level actions for the MySQL node in more detail

The Create Database Action

This action brings up a dialog for creating a database, including sample databases

The dialogs for creating a database are described in this separate UI spec.

The Start and Stop Actions

Database servers are often set up as a service which are managed automatically by the operating system, and which generally, once they're set up, don't need to be regularly stopped and started.

However, in some environments the server may be local to the current user and not installed as a service. In this scenario, it is valuable to provide start/stop functionality from within the IDE.

If the user chooses this action and no start or stop command is set, then they are prompted to set the command:

Image:mysql-set-stop-command_MySQLNodeUISpec.jpg

Output will be sent to an output window for these actions.

"Start" will be disabled if the server is already running and "Stop" will be disabled if the server is not running.


The Delete Action

This action removes the MySQL node. It also marks the node as removed, so that next time the user starts up NetBeans we will not auto-register the node again. The user will need to manually register the node using Databases->Register MySQL Server

A confirmation dialog will be brought up to confirm the user wants to delete the node:

-------------------------------------------------------------------
| Are you sure you want to delete MySQL Server?          |
|                                                                  |
|                                                   [[OK | OK]] [Cancel]  |
-------------------------------------------------------------------

The Start Administration Tool Action

This action brings up the administration tool that is registered with the runtime.

The provider either invokes the admin tool as a separate system process, or if it is a web-based tool, brings up the provided URL in the default browser.

If the administer command has not been set, then when the user picks the action, they are prompted to set the path to the command.

Image:mysql-set-admin-command_MySQLNodeUISpec.jpg


The Properties Action

This action brings up a dialog that allows the user to configure important settings for the server. There are two tabs, one for basic settings and one for setting command paths to administrative commands (start, stop, administer)

Image:mysql-basic-properties_MySQLNodeUISpec.jpg

Image:mysql-admin-properties_MySQLNodeUISpec.jpg

  • If the user wants to enable administration from Netbeans, they can enter a path/URL to the admin tool. We will try to auto-detect a pre-existing tool

and place it here if found.

  • If the user wants to enable start/stop, they can enter a full path to the start and stop commands. The reason we do this is that often a

pre-configured stack like XAMPP or MAMP comes with its own start/stop script, or the user may have written their own.

If the user changes any fields that affect the connection properties to the server, we will attempt to re-connect to the server with the new properties. A dialog is raised if this fails.


Actions on a Database Node

Connect

If a connection for this database is already registered, we just connect using that connection.

If a connection does not exist, we prompt the user if they want to create a connection, and then bring up the standard create new connection dialog, with the driver and url already filled in correctly. The user can then adjust, set the user and password, and connect.

Delete Database

This action brings up a dialog for deleting a database.

---------------------------------------------------------
|              Delete Database                           |
|                                                        |
| Are you sure you want to delete {dbname}? |
|                                                        |
|                                        [[Cancel | Cancel]]  [OK]  |
---------------------------------------------------------

If we detect that a connection exists to this database in the DB Explorer, we also delete this connection, as it is no longer valid.

Auto-detection

In order to make it as easy as possible to get started with MySQL in NetBeans, we have added the ability to automatically detect a running MySQL server and certain standard installations of MySQL.

Detection of running server

If MySQL is running on the local host at the default port of 3306, then we will automatically register the MySQL node in the Services tab and create a default connection to the server.

Detection of existing MySQL connection

If the user has a MySQL connection registered with the Database Explorer, we will automatically register the MySQL node using the properties defined on the connection.

Adding a new MySQL connection

If the user adds a MySQL connection, we will automatically register the MySQL node using the properties defined on the connection.

Detection of a standard installation

There are a number of installations that we recognize (see list below). If any of these installations are detected on the users's machine, then we will automatically register the MySQL node and set up the properties for the start, stop and administration tool commands.

Note that on UNIX installations, if the installation detected is one we know requires root for start and stop commands, and we detect the UNIX command 'gksu', then we will invoke gksu when running the start and stop commands. This will bring up a dialog from the operating system prompting the user for the root password, and then the command is run as root.

List of Recognized Installations

Platform Name Admin command Start Command Stop Command
Linux Standalone installation <none> /usr/bin/gksu /etc/init.d/mysql start /usr/bin/gksu /etc/init.d/mysql stop
Linux XAMPP installation http://localhost/phpmyadmin /usr/bin/gksu /opt/lampp/lampp startmysql /usr/bin/gksu /opt/lampp/lampp stopmysql
Macintosh MAMP installation
http://localhost:8888/MAMP/frame.php?src=%2FphpMyAdmin%2F%3F
/Applications/MAMP/bin/startMysql.sh /Applications/MAMP/bin/stopMysql.sh
Solaris/OpenSolaris Webstack Installation <none> /usr/bin/gksu /usr/bin/svcadm enable svc:/application/database/mysql:version_50 /usr/bin/gksu /usr/bin/svcadm disable svc:/application/database/mysql:version_50
Windows Standalone 5.0 <none> C:/Program Files/MySQL/MySQL Server 5.0/bin/mysqld-nt.exe C:/Program Files/MySQL/MySQL Server 5.0/bin/mysql.exe -u root stop
Windows Standalone 5.1 <none> C:/Program Files/MySQL/MySQL Server 5.1/bin/mysqld-nt.exe C:/Program Files/MySQL/MySQL Server 5.1/bin/mysql.exe -u root stop


I would have liked to have supported Windows XAMPP, but this installation behaves very strangely and I was unable to get it to work properly.

Manually registering the MySQL server

If none of the auto-detection mechanisms are successful, the MySQL node will not be registered. You can, however, manually register the user by choosing the "Register MySQL Server" action under "Databases". This action is only available *if* the MySQL node has not yet been registered.

Disabling auto-detection

If the MySQL node is registered, and the user manually deletes it using the "Delete" action, then we will not perform auto-detection again for that user (unless the user removes the user directory). It can be manually registered again if desired.

Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo