next up previous contents
Next: 6 The Anatomy of Up: DataVision version 0.2.0 Previous: 4 Incorporating DataVision Into   Contents

Subsections

5 Creating a New Report

To create a new report, either start DataVision without specifying a report XML file or select New from the File menu.


5.1 Connecting to the Database

When you first create a new report, a dialog box will appear asking you how to connect to the database. Either copy this information from an existing report (everything but the password, which is not stored with a report) or specify the information directly. In either case, you will be asked to supply a database password each time you open a report.

To copy the database connection information, click the button labeled ``Copy Settings...''. An ``Open File'' dialog box will let you choose a report XML file from which the settings will be copied.

There are four pieces of information you need to supply: the JDBC driver class name, the connection info string, your database user name (not necessarily the same as your login name), and your database password.

You should be able to find the JDBC driver class name and connection info string from your database driver documentation. The connection info string will contain the name of the database to which your are connecting (not a database vendor's name like ``Oracle'', but the name of the database instance like ``dv_example'' or ``jobsdb'' or ``xyzzy''). As an example, to connect to my PostgreSQL database named ``jobs'' I use the driver class name org.postgresql.Driver and the connection info string ``jdbc:postgresql:jobs'' (without the quotes).

Note that you will probably have to enter your database name twice: once in the connection info string and again in the ``Database Name'' field. Why twice? Because DataVision has no way of understanding every connection info string and there is no guarantee that the last thing in the connection info string is the database name. DataVision needs the database name not for connecting to the database but for display purposes, like when it asks you for the database password.

After connecting to the database, the report will store the driver class name, connection info string, and database user name in the report XML file. You must enter the database password each time you open a report.

5.1.1 Errors

Unfortunately, some drivers do not support the optional driver features upon which DataVision currently relies. Eventually, I hope that DataVision can stop relying upon these features, but I'm not sure.

If you see an error message something like this (when running DataVision from the command line):

Exception occurred during event dispatching:
java.lang.AbstractMethodError
        at jimm.datavision.Report.run(Report.java:763)
        at jimm.datavision.gui.ReportRunner.run(ReportRunner.java:37)
        at jimm.datavision.gui.DesignWin.runReport(DesignWin.java:709)
        at jimm.datavision.gui.DesignWin.actionPerformed(DesignWin.java:618)

then your driver does not support one of the new driver calls used by DataVision. Try to upgrade to a newer version of your driver. For example, one user saw this message until he upgraded to version from MM.MySQL 2.0.4 to 2.0.11.

5.1.2 PostgreSQL

The document ``PostgreSQL JDBC Documentation'' which can be found at http://jdbc.postgresql.org/doc.html describes the format of the connection string.

If left out, host defaults to localhost (not 127.0.0.1) and port to PostgreSQL's default port number (normally 5432, but configurable at build time).

5.1.3 MySQL

If you use either the mm.mysql-2.0.X-bin.jar or mysql_comp.jar drivers, the driver class name should be ``org.gjt.mm.mysql.Driver''.

The format of the connection string must be ``jdbc:mysql://host/database''. The host name is not optional. If the MySQL database is on the same machine as DataVision, use the host name ``localhost''.

One user reported trouble with the MySQL JDBC drivers until he switched to version 2.0.11. The latest version of the MySQL JDBC driver is available on its SourceForge project page.

5.1.4 ODBC

Unfortunately, it appears that the Sun JDBC:ODBC driver and the Microsoft ODBC Driver for SQL Server Version 3.70 do not support the optional driver features upon which DataVision currently relies. I have read that Sun is no longer actively developing their JDBC:ODBC driver, so their driver may never support these optional features.

From a post on the Usenet news group comp.lang.java.databases:

The Sun driver list contains all the SQLServer JDBC drivers. You might want to have a look at the Merant DataDirect JDBC drivers. Free eval type 3 and 4 drivers are available at www.merant.com/datadirect.

However, I have read that Microsoft is developing a type-4 JDBC driver that should implement all of the features DataVision needs. It is in beta now (February 2002), and is available for download from their SQL Server pages.

5.1.5 Informix

One user reports that his Informix JDBC driver does not implement the optional driver features upon which DataVision currently relies. He is using the latest version, but I don't know where he found the driver.

Another user reports success with a jar file named ifxjdbc.jar. This jar file is available from www.informix.com/evaluate, though you must be registered.

5.2 Adding Fields and Text

To add database fields to a report, select Database Field... from the Insert menu. The Field Picker window will open. Notice that the first item in the window is ``Database Fields'' and the last item is ``All Database Fields''. In a newly created report, the first ``Database Fields'' item will be empty, because it displays database columns that are already in the report.

Double-click ``All Database Fields''. A list of all of the database's tables will appear. Double-click on a table to reveal the columns within that table.

Drag a column name from the Field Picker window into the report. As an added bonus, when you drag a database column into a ``Detail'' section, the name of the column will automagically appear in the ``Page Header'' section.

To add text to a report, select Text from the Insert menu. The cursor will change to a text cursor. Click anywhere on the report, and a new empty text field will appear. Start typing the text.

To finish entering text, click anywhere outside of the text field.


next up previous contents
Next: 6 The Anatomy of Up: DataVision version 0.2.0 Previous: 4 Incorporating DataVision Into   Contents
Jim Menard 2002-04-18