Step 3. Connect and Analyze Database Schema Using DbXplorer

Workshop allows you to connect to any database, create and analyze database schemas, tables, columns, and even populate the database with sample data. In this step, we will learn how to create a database connection and explore it using DbXplorer.

DbXplorer provides an intuitive interface for database access through Workshop. It allows you to set up the database connection, review the database artifacts, query existing data, and generate Hibernate mappings.

The tasks in this step are:

To Create a New Database Connection

To Browse the Database Artifacts using DBXplorer

To Create a New Database Connection

  1. Open the DbXplorer view, if it is not visible. To open DbXplorer view, go to the Window menu and select Show View > DbXplorer .
  2. Right-click anywhere within the body of the DbXplorer view and select New Connection. (Alternatively, you can click the second icon 2nd on the menu bar of the DbXplorer view.)
  3. In the Add Database Connection Wizard, enter the database connection name. The database connection name can be arbitrary and does not have to match the actual name of the database server. For this tutorial, use the name SalesDBConnection. Click Next.

  4. In Add Database Connection dialog, click Add and select the Hypersonic JDBC driver file. For example, if your workspace folder is C:\MyData\workspace then the path would be C:\MyData\workspace\workshop-hibernate-tutorial\web\WEB-INF\lib\hsqldb.jar.

  5. Click Next.
  6. Workshop provides sample Database URL's for some standard databases, which can be accessed from the Populate from database defaults pull down menu. Select HypersonicSQL In-Memory.

  7. For the database URL jdbc:hsqldb:{db filename}, specify the Hypersonic database script file location for {db filename}. For example, if your workspace folder is C:\MyData\workspace then the path would be C:\MyData\workspace\workshop-hibernate-tutorial\web\hsqlDB\salesDB.
  8. For User name, enter sa.

  9. Click the Test Connection button to verify the connection information.

  10. Click Finish.
  11. Workshop configures the new database connection and displays it in DbXplorer.

To Browse the Database Artifacts Using DBXplorer (Optional)

DbXplorer allows you to browse the database components.

  1. In the DbXplorer view, expand the nodes inside the SalesDBConnection node. You can view the individual tables and columns. Observe that the DbXplorer view shows which columns have been designated as primary keys.

  2. While browsing database artifacts, the Properties view displays the relevant properties of the component.

Click one of the following arrows to navigate through the tutorial:

Still need help? Post a question on the Workshop newsgroup.