A Database control makes it easy to access a relational database via SQL commands. When you create a new Database control, you specify which database it connects to and write methods to access data using SQL commands. This topic describes the mechanics of creating a Database control.
You can add a Database control in any of the following types of files:
Note: In previous releases, JCX files were known as CTRL files. CTRL files are still supported.
Note: The cgSampleDataSource data source is available for experimentation. For more information about data sources, see the Choosing a Data Source section, below.
You can also create a Database control file manually by copying an existing Database control file and modifying the copy.
To learn how to add a method to a Database control, see Adding a Method to a Database Control.
Before you can perform operations on a database, you must have a connection to the database. The Database control handles all of the details of managing the database connection, but you must supply the name of a data source that has been configured with the information necessary to access a database.
A default data source called cgSampleDataSource is configured when WebLogic Workshop is installed. This data source uses the PointBase database.
To learn how to create, configure and register a data source, see Configuring a Data Source and How Do I: Connect a Database Control to a Database Such as SQL Server or Oracle.
Once the data source is configured and registered in the JNDI registry, the data source name may be used in the data-source-jndi-name attribute of the @jc:connection annotation.
For detailed information on the @jc:connection annotation, see @jc:connection Annotation.
Note: If you are creating a Database control that connects to an Informix database, you must use a transactional (XA) driver to connect to the Informix database. For more information on transactional drivers for Informix, see the Informix documentation.
How Do I: Connect a Database Control to a Database Such as SQL Server or Oracle
Adding a Method to a Database Control