Step 4. 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
- Open the DbXplorer view, if it is not visible. To open DbXplorer view, go to the Window menu and select Show View > DbXplorer .
- Right-click anywhere within the body of the DbXplorer view
and select New
Connection. (Alternatively, you can click the second icon
on
the menu bar of the DbXplorer view.)
- 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.

- 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.

- Click Next.
- 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.

- 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.
- For User name, enter sa.

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

- Click Finish.
- 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.
- 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.

- 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.