org.jfree.data.jdbc
Class JDBCPieDataset
- Cloneable, Dataset, KeyedValues, ObjectInputValidation, PieDataset, PublicCloneable, Serializable, Values
A
PieDataset
that reads data from a database via JDBC.
A query should be supplied that returns data in two columns, the first
containing VARCHAR data, and the second containing numerical data. The
data is cached in-memory and can be refreshed at any time.
JDBCPieDataset(Connection con) - Creates a new JDBCPieDataset using a pre-existing database connection.
|
JDBCPieDataset(Connection con, String query) - Creates a new JDBCPieDataset using a pre-existing database connection.
|
JDBCPieDataset(String url, String driverName, String user, String password) - Creates a new JDBCPieDataset and establishes a new database connection.
|
void | close() - Close the database connection
|
void | executeQuery(Connection con, String query) - ExecuteQuery will attempt execute the query passed to it against the
existing database connection.
|
void | executeQuery(String query) - ExecuteQuery will attempt execute the query passed to it against the
existing database connection.
|
clear , clone , equals , getIndex , getItemCount , getKey , getKeys , getValue , getValue , hashCode , remove , setValue , setValue , sortByKeys , sortByValues |
JDBCPieDataset
public JDBCPieDataset(Connection con)
Creates a new JDBCPieDataset using a pre-existing database connection.
The dataset is initially empty, since no query has been supplied yet.
con
- the database connection.
JDBCPieDataset
public JDBCPieDataset(Connection con,
String query)
throws SQLException
Creates a new JDBCPieDataset using a pre-existing database connection.
The dataset is initialised with the supplied query.
con
- the database connection.query
- the database connection.
JDBCPieDataset
public JDBCPieDataset(String url,
String driverName,
String user,
String password)
throws SQLException,
ClassNotFoundException
Creates a new JDBCPieDataset and establishes a new database connection.
url
- the URL of the database connection.driverName
- the database driver class name.user
- the database user.password
- the database users password.
close
public void close()
Close the database connection
executeQuery
public void executeQuery(Connection con,
String query)
throws SQLException
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.
con
- the connection the query is to be executed againstquery
- the query to be executed
executeQuery
public void executeQuery(String query)
throws SQLException
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.
query
- the query to be executed.