ServicesTabDbConnectionFuncSpec

Services Tab Database Connection Node

Modificaion History
Winston Prakash: Feb 8, 2007


Note: This is just sample or a starter document to start the discussion based on Services Tab Architecture. Does not correctly reflect the implementation details. Need to be re-written by the Service Type implementor. - Winston



Contents



Introduction

This document describes the support for database connections node in the Services Tab. Some of the main functionalities supported are

  • Provide a view for user to explore the database in the IDE.
  • Ability to add/remove/modify Database connections to that view
  • Ability to add/remove/modify JDBC driver info from that view to create connection.
  • Ability to connect to a database and view its contents such as tables, views, stored procedure etc.
  • Ability to view the contents of table.
  • Ability to drag and drop the table or view to a consumer such as VWP designer or JSP Editor.
  • Ability to drag and drop the table or table view on to the SQL query editor.
  • Ability to export the database connections meta data information (along with any JDBC drivers info).
  • Ability to import the database connection meta data.
  • Ability to view & modify table structure via the view.

Database explorer

The database connections root node in the Services Tab provides the view for the user to interact with the IDE for database support. The database connections node could provides predefined connections to sample databases in the bundled database server. When the IDE starts these predefined connections would show up in the Services Tab. The information about these predefined connections will be kept in the IDE user directory. User can edit these files and place their data connections info by hand using the defined format.

The following figure shows how the database connections node appears in the Services Tab

Image:db_explorer_view_ServicesTabDbConnectionFuncSpec.png

Add Database Connection

By right clicking on the Database Connections node and choosing Add Connection from the pop-up menu. User will be provided with the Add Connection dialog box in which user can supply information about the connection, such as host name, database name, user name, etc

Image:add_connection_dialog_ServicesTabDbConnectionFuncSpec.png

Remove Database Connection

By right clicking on the Database Connections node to be removed and choosing Remove Connection from the pop-up menu. A confirmation dialog pops up to confirm the deletion

Image:delete_connection_dialog_ServicesTabDbConnectionFuncSpec.png

Modify database Connection

By right clicking on the Database Connection node that is being modified and choosing Modify Database Connection from the pop-up menu, user gets to the modify connection node. By default only the schema associated with the current user is displayed in the connection node. Using Modify Connection action user could view other schemas also.

Image:modify_connection_dialog_ServicesTabDbConnectionFuncSpec.png

Exporting Database Connections Metadata

When a connection is added to the project, project keeps reference to the connection in the project. But the actual connection info is maintained by the Connection Manager in the Connection Explorer view. So when the project is checked in to the CVS and checked out by another user, the other user need to add the corresponding connections to his/her IDE environment. This can be achieved by exporting and later importing the connections. The user has the option to provide the user name and password to the other user.

Image:export_db_info_dialog_ServicesTabDbConnectionFuncSpec.png

Importing Database Connections Metadata

When the other user gets the exported Connections XML file, now he/she can import the Connections in to the IDE Connections nodes using the Import Connections dialog. If the user name and password is not exported, then user need to modify the connection using Modify Connection dialog to specify the username and password.

Image:import_db_info_dialog_ServicesTabDbConnectionFuncSpec.png

Add JDBC Driver Info

While adding connections to the Connections Explorer node, user also must be able to add the corresponding JDBC driver jars to the IDE. This need to be done for two reasons.

  • When the table from the connection node is added to the project, a live database connection is maintained. To get this connection JDBC driver jars needed.
  • When the project is deployed, the deployment manager also adds the JDBC driver to the test application sever, so that user need not have to manually add the jars to the application server.

User can add the JDBC driver by right clicking on the connection root node and selecting the Edit JDBC Driver menu item. In the resulting dialog user could add the driver information.

Image:db_add_jdbc_driver_ServicesTabDbConnectionFuncSpec.png

Remove JDBC Driver Info

Right click on the "Drivers" node and select "Remove JDBC driver". All the meta-data info related to this particular driver stored in the user dir will be removed.

Modify JDBC Driver Info

User might want to change the jars associated with a particular JDBC driver Info. This is done by providing a menu item called Modify JDBC Driver in the "JDBC drivers" node

View Table data Driver Info

After connecting to the database via the connection, user has the option to explore the tables and table views in the database. Also via the property sheet user get to see some of the metadata of the Table and its columns

Image:table_column_properties_ServicesTabDbConnectionFuncSpec.png

Also user get to see the contents of the table before adding the table to a component such as table component, by right clicking and selecting view data from the View Data Menu item or double clicking the table node

The data view also gives option to edit the query to customize the view of the data from the table. After modifying the query Run Query fetches the number of rows as specified in the data view.

Image:db_data_view_ServicesTabDbConnectionFuncSpec.png

View table structure

<TBD>

Modify table Structure

<TBD>

Export table structure

<TBD>

Adding Database Connections Root Node to Services Tab

The Database Connections Root Node is added to the Services Tab, via the contract published by Services Tab. So the root node should be added via the layer file as

<folder name="UI">
   <folder name="ServicesTab">
          <file name="org-netbeans-modules-db-nodes-DatabaseConnectionsRootNode.instance" />
   </folder>
</folder>
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