Contents
A JDBC Table is a data construct that enables a StreamBase application to read from, write to, update, and query an external, persistent JDBC data source. When connected to a JDBC Table, a Query operator can manipulate the JDBC data together with tuples from the application's input streams. JDBC Tables can be associated with multiple Query operators, but each Query operator can be associated only with one JDBC Table.
This topic describes the configuration options for each tab of the JDBC Table's Properties view. To connect a JDBC Table data construct to an actual JDBC data source, you must declare the data source in the server configuration file for your Studio project and add the path to the JDBC driver's JAR file, as described in JDBC Data Source Overview.
Tip
JDBC Query operators that specify a select statement generate a typecheck error when working in an environment that does not have connectivity to the database server. As a workaround, you can specify an explicit schema for the SQL query in the operator's Result Settings tab. If you anticipate having database connectivity when composing the operator, but none later, use the Execute query and populate fields link that derives the schema from executing the SQL query.
At the top of the Properties view for a JDBC Table data construct, there is an Affected Components link. Click this link to display a pop-up window that lists the Query operators in the current module that are associated with the selected JDBC Table. Click anywhere outside the pop-up to close the pop-up.
The following example shows an Affected Components pop-up window for the BikesOrder
JDBC Table in the JDBCQuery.sbapp
sample shipped with StreamBase.
Name: Use this field to specify or change the component's name, which must be unique in the application. The name must contain only alphabetic characters, numbers, and underscores, and no hyphens or other special characters. The first character must be alphabetic or an underscore.
Description: Optionally enter text to briefly describe the component's purpose and function. In the EventFlow canvas, you can see the description by pressing Ctrl while the component's tooltip is displayed.
In the Data Source tab, select the JDBC data source you want to use from the drop-down list. The list contains the name of
every JDBC data source declared in the <data-sources>
section of the current project's server configuration file.
Use the configure sources link to open the project's server configuration file. If no configuration file exists for this project, clicking this link opens the New StreamBase Server Configuration File dialog to create a new, empty configuration file.
Note
If you specify a data source name, but that data source's definition is incomplete in the server configuration file, the typechecking errors show up in the associated Query operators, not in the JDBC Table data construct itself.
You can also type a parameter name in parameter notation, such as ${ds}
. This lets you pass in the name of a data source at runtime as a global parameter.