|The Connection Tool||Exporting to Mathematica|
|Querying the Database||New Connection Wizard|
The Database Explorer is a graphical interface to DatabaseLink. It provides a number of useful functions, such as managing connections and working with the data in a database. It can be launched by loading DatabaseLink and executing the command DatabaseExplorer.
If you find that the examples in this section do not work as shown, you may need to install or restore the example database with the package, as described in "Using the Example Databases".
At this point, you can connect to a database and make queries from its tables. When you have selected the data, it can be used to create a report as a Mathematica notebook. This will allow you to work with the results in Mathematica.
From the main Database Explorer window, you can open the Connection Tool by using the Connect to a data source button. It can also be launched by executing the command OpenSQLConnection, described in "Database Connections: Establishing a Connection".
If you do not see the sample databases shown in the picture, you may need to install or restore the example database with the package, as described in "Using the Example Databases".
The Connection Tool shows all of the database connections that appear in configuration files in DatabaseResources directories. The details of named connections and their configuration files are described in "Database Resources". From the Connection Tool, you can select a connection and edit or delete it. You can also create a new connection, as described in "New Connection Wizard".
When you have connected to a database, as described previously, the Database Explorer shows the actual database in the Connection list and the tables in a scroll list. The following picture shows the result of connecting to the publisher database. This contains a number of tables. If you select one of the tables, its columns will be shown, and you can select any of them. A button for selecting all the columns is also provided.
The Query page also has an Advanced Options button. When you click this button, more options for forming the query are provided. For example, you can put various conditions on columns. Here is an example where data in the TITLE_ID column must be greater than 5000.
When you have set up a query, it can be saved with the Save the Query button. When you click this button, a Save File dialog box appears that includes a number of locations in DatabaseResources directories. (DatabaseResources directories are described in "Database Resources".) When you launch the Database Explorer, all the queries that have been saved are made available and can be run.
The New Connection Wizard is available from the Connection Tool, which can be launched either from the Database Explorer (described previously) or by executing the command OpenSQLConnection (described in "Database Connections: Establishing a Connection"). It will create a new named connection that will be available for future uses. The information about the connection will be written in a configuration file as described in "Database Resources".
A view of the third step is shown in the following picture. In this step, the type of the database is selected from a list. There is also a button for entering a new type of database. The list includes types that have been installed in the system, as described in "Database Resources: JDBC Configuration".
Each screen of the wizard has a full description. When it has finished, a new named connection has been created. This can be used by OpenSQLConnection and will show up in the Connection Tool.