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.
Reports retrieve data from data sources. A data
source can be either a database or a comma- or tab-separated file. Each
data source has a different way of specifying the metadata (tables,
columns, and column data types) available for reports.
A database data source reads table and column metadata from the database.
A ``charsep'' data source reads column metadata from the report XML file,
either directly or indirectly. See charsep for the gory
details. When using a charsep data source, the ``Select Records'' text
which is normally added to a SQL query's WHERE clause is instead evaluated
as a Ruby script. The result is used to determine if a record is used or
ignored.
Not yet implemented: When you first create a new report,
DataVision asks you which kind of data source you will be using.
Connecting to a 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 Copy
Settings... button. An ``Open File'' dialog box will let you
choose a report XML file from which the settings will be copied.
There are five pieces of information you need to supply: the JDBC driver
class name, the connection info string, the database name, your database
user name, and your database password. When saving a report, all but the
password are stored in the report XML file.
JDBC driver class name You should be able to find the JDBC driver
class name from your database driver documentation. There are examples for
some databases below.
Connection info string You should be able to find the JDBC
connection info string from your database driver documentation. It will
probably contain either the name of the database schema or the ``sid''.
Sometimes it is the same as the database name. 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).
Database name Sometimes called the schema name, the database name
refers to a set of database tables. (This isn't the name ``Oracle'' or
``PostgreSQL''.) When DataVision asks the database for the list of table
names, it uses the database name to specify which tables to return.
Database user name This is the user name you use to connect to
the database. It is not necessarily the same as your computer login
name.
Database password You must enter the database password each time
you open a report.
PostgreSQL
The document PostgreSQL
JDBC Documentation describes the format of the connection string.
- jdbc:postgresql:database
- jdbc:postgresql://host/database
- jdbc:postgresql://host:port/database
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).
The database name (or schema name) in newer versions of PostgreSQL seems to
default to ``public''. You may want to try that in the database name field.
I admin that ``Schema Name'' may have been a better name for that field.
For example, my connection info string is ``jdbc:postgresql:dv_example''
and the database name I use is ``public''.
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.
Oracle
Try the driver class name ``oracle.jdbc.driver.OracleDriver''.
The connection info string will depend upon the type of JDBC driver you are
using. For the thin driver, try
``jdbc:oracle:thin:@host:1521:sid''. host
can be ``localhost'' or ``127.0.0.1'' if the Oracle database is running on
the same computer. 1521 is the default port number; that will only be
different if the Oracle database was configured to use a different one. The
``sid'' is a string that identifies where to find the database. It is not
necessarily the same as the database name.
ODBC
The vanilla JDBC-ODBC bridge should work just fine.
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.
I have read that Microsoft is developing a type-4 JDBC driver. It was in
beta as of February 2002, and was available for download from their SQL
Server pages.
Easysoft
John Kos of Easysoft writes:
The Easysoft JDBC-ODBC Bridge server software is predominantly used to
access Windows databases such as MS Access and SQL Server or databases
hosted on other platforms for which a JDBC driver is not available i.e.
ISAM files. In these circumstances the server component will be installed
on a Windows device. (Note: unlike the Sun bridge Easysoft is a type 3
driver and therefore DataVision can run on any remote device, no local ODBC
driver is required).
To configure DataVision you will need:
- SERVER
- the name of the Windows server hosting the Easysoft JDBC-ODBC
Bridge
- DSN
- the name of the target datasource on server_name
- LOGIN
- a Windows user for SERVER (with correct privs)
- PASSWORD
- the Windows password for the above user
Adding the driver to the class path
Copy the file EJOB.jar to the client device and add to the
CLASSPATH
by editing Datavision.bat. By default
EJOB.jar will be found in C:\Program
Files\Easysoft\Easysoft JDBC-ODBC Bridge\jars\EJOB.jar.
Establishing the connection
- Driver Name
- easysoft.sql.JobDriver
- Connection Info
- jdbc:easysoft://SERVER/DSN:logonuser=LOGIN:logonpassword=PASSWORD
- Database Name
- DSN
- Username
- LOGIN
- Password
- PASSWORD
Informix
One 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.
Adding Fields and Text
This section gives a brief description of how to add database fields and
text to a report. For details, see Editing a
Report.
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.