When you work with EGL, many of the details of data access
are in variables that you customize for inclusion in statements such
as add or delete. The customized variables include details
that are specific to a particular kind of data store, whether the
kind is a relational database; a file; or, in the future, some other
form of persistent storage. By including the kind-specific detail
in a variable rather than in the statement itself, the EGL design
allows most data-access statements to be structured in a particular
way, regardless of which kind of data store is accessed.
Most of the customized variables that you use for relational database
access are based on the following types:
- SQLDataSource, which represents a database connection.
- SQLResultSet, which represents a result set returned from an SQL
query.
- SQLStatement, which represents an SQL statement that is produced
by issuing the EGL Prepare statement. This kind of SQL statement
is a prepared statement. It is structured from a string
at run time and often has characteristics that are known only at run
time.
A particularly important point is that you can declare a variable
of type SQLDataSource either to represent a connection that is specified
directly in your logic or to reference a database binding in the EGL
deployment descriptor:
- Here is an example in which the connection is specified directly
in the logic:
connectURL string = "jdbc:derby:SomeDB;create=true;";
properties Dictionary{user = "MyID", password = "MyPassword"};
ds SQLDataSource? = new SQLDataSource(connectURL, properties);
- Here is an example of a reference to an EGL deployment descriptor
entry named MyDatabaseBinding:
ds SQLDataSource?{@Resource{bindingkey = "MyDatabaseBinding"}};
Additional information is available: