com.jrefinery.data
Class JdbcCategoryDataset

java.lang.Object
  extended by com.jrefinery.data.AbstractDataset
      extended by com.jrefinery.data.AbstractSeriesDataset
          extended by com.jrefinery.data.DefaultCategoryDataset
              extended by com.jrefinery.data.JdbcCategoryDataset
All Implemented Interfaces:
CategoryDataset, Dataset, SeriesChangeListener, SeriesDataset

public class JdbcCategoryDataset
extends DefaultCategoryDataset
implements CategoryDataset

Description of the Class This class provides an chart CategoryDataset implementation over a database JDBC result set. The dataset is populated via a call to executeQuery with the string sql query. The sql query must return at least two columns. The first column will be the catagory name and remaining columns values. executeQuery can be called a number of times. The database connection is read-only and no write back facility exists.

Version:
1.0
Author:
bryan_sco

Field Summary
 
Fields inherited from class com.jrefinery.data.DefaultCategoryDataset
categories, data, seriesNames
 
Fields inherited from class com.jrefinery.data.AbstractDataset
listeners
 
Constructor Summary
JdbcCategoryDataset(java.sql.Connection con)
          Constructor Create a new JdbcCategoryDataset using the specificied database connection.
JdbcCategoryDataset(java.sql.Connection con, java.lang.String query)
           
JdbcCategoryDataset(java.lang.String url, java.lang.String driverName, java.lang.String user, java.lang.String passwd)
          Constructor Create a new JdbcCategoryDataset and establish a new database connection.
 
Method Summary
 void executeQuery(java.lang.String query)
          ExecuteQuery will attempt execute the query passed to it against the existing database connection.
 
Methods inherited from class com.jrefinery.data.DefaultCategoryDataset
getCategories, getCategoryCount, getSeriesCount, getSeriesName, getValue, setCategories, setSeriesName, setSeriesNames, setValue
 
Methods inherited from class com.jrefinery.data.AbstractSeriesDataset
getLegendItemCount, getLegendItemLabels, seriesChanged
 
Methods inherited from class com.jrefinery.data.AbstractDataset
addChangeListener, fireDatasetChanged, notifyListeners, removeChangeListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.jrefinery.data.CategoryDataset
getCategories, getCategoryCount, getValue
 
Methods inherited from interface com.jrefinery.data.SeriesDataset
getSeriesCount, getSeriesName
 
Methods inherited from interface com.jrefinery.data.Dataset
addChangeListener, removeChangeListener
 

Constructor Detail

JdbcCategoryDataset

public JdbcCategoryDataset(java.lang.String url,
                           java.lang.String driverName,
                           java.lang.String user,
                           java.lang.String passwd)
Constructor Create a new JdbcCategoryDataset and establish a new database connection.

Parameters:
url - URL of the database connection
driverName - The database driver class name
user - The database user
passwd - The database users password.

JdbcCategoryDataset

public JdbcCategoryDataset(java.sql.Connection con)
Constructor Create a new JdbcCategoryDataset using the specificied database connection.

Parameters:
con - The database connection to use

JdbcCategoryDataset

public JdbcCategoryDataset(java.sql.Connection con,
                           java.lang.String query)
Method Detail

executeQuery

public void executeQuery(java.lang.String query)
ExecuteQuery will attempt execute the query passed to it against the existing database connection. If no connection exists then no action is taken. The results from the query are extracted and cached locally, thus applying an upper limit on how many rows can be retrieved successfully.

Parameters:
query - The query to be executed


Copyright © 2003 MBARI.

The Monterey Bay Aquarium Research Institute (MBARI) provides this documentation and code "as is", with no warranty, express or implied, of its quality or consistency. It is provided without support and without obligation on the part of MBARI to assist in its use, correction, modification, or enhancement.