void setResultSet(String,ResultSet)

Applies only to the Java PopChart Embedder.

Syntax myPopChart.setResultSet(graphname, resultSet);

Description Imports the data from a ResultSet object into the specified graph object. The new data will replace any existing data.

ResultSet is a class in the java.sql package. ResultSet objects are usually returned when you make an SQL query. See Example 4.13 for an example of how this works.

For more information about using databases with PopChart Server, refer to "Importing Data Directly from Databases" in Chapter 6 of the PopChart Server User Guide.

Parameters The setResultSet() method accepts the following parameters.

graphname

String

The name of the graph object into which you want to import the data. Usually, this is graph, but check the appearance file to be sure.

resultSet

ResultSet

A resultSet object.

Example 4.13 Using setResultSet()

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); 

theConnection = DriverManager.getConnection("jdbc:odbc:bcdemos","popchart","secretpassword"); 

theStatement = theConnection.createStatement(); 

ResultSet results = theStatement.executeQuery("Select Description, OnHand from parts order by Description"); 

myPopChart.setResultSet("graph", results);

Note: The example above accomplishes the same task that Example 4.12 accomplished.