Using Prepared Statements in JDBC Data Sources

This is an example of using prepared statements in JDBC data sources. The sample data source can be downloaded here (714 Bytes).

  1. This example uses a simple fruit sales table:
    ps01

  2. The SQL query to be used:
    SELECT * from FruitSales where (Company = "${Company1}" or Company = "${Company2}")

  3. Creating a prepared statement using the above query, declare the parameters as arguments:
    ps02

  4. Test the prepared statement:
    ps03

  5. The prepared statement returns the following results based on the selected parameter values:
    ps04