org.apache.beehive.controls.system.jdbc
Interface JdbcControl

All Known Implementing Classes:
JdbcControlImpl

public interface JdbcControl

Simplifies access to a relational database from your Java code using SQL commands. The Jdbc Control handles the work of connecting to, sending queries to, and ResultSet mapping from the database. You don't need to know how to use JDBC in order to use the Jdbc Control, just basic SQL.

To use a Jdbc Control create a .jcx file (java file with a .jcx extension) which extends this interface. Add annotations to the jcx to tell the Jdbc Control how to connect to your database instance (either ConnectionDataSource or ConnectionDriver), then add methods which include SQL annotations to access the database.


Nested Class Summary
static interface JdbcControl.ConnectionDataSource
          Class-level annotation for making a DataSource available for use with the Jdbc Control.
static interface JdbcControl.ConnectionDriver
          Class-level annotation for making a ConnectionDriver available for use with the Jdbc Control.
static interface JdbcControl.ConnectionOptions
          Class level annotation used to set options on the JDBC connnection.
static class JdbcControl.FetchDirection
          Enumeration of supported fetch directions.
static class JdbcControl.HoldabilityType
          Enumeration of supported fetch directions.
static class JdbcControl.JndiContextFactory
          Abstract base class for a user defined Jndi Context factory which can be used as a value for the jndiContextFactory member of the ConnectionDataSource annotation.
static class JdbcControl.ScrollType
          Enumeration of supported types of scrolling ResultSets
static interface JdbcControl.SQL
          Method-level annotation for methods in a jcx which wish to access a database instance.
static class JdbcControl.SQLParameter
          Nested class used for specifing parameters for a callable statement.
static interface JdbcControl.TypeMapper
          Class / method level annotation for mapping SQL user defined types (UDTs) to and from java objects.
static interface JdbcControl.UndefinedIteratorType
          Default value for the iteratorElementType element of the SQL annotation.
static interface JdbcControl.UndefinedResultSetMapper
          Default value for the resultSetMapper element of the SQL annotation.
 
Field Summary
static int DEFAULT_FETCH_SIZE
          The default fetch size for result sets, indicates the database should determine the fetch size.
static int MAXROWS_ALL
          This constant can be used as the value for the maxRows element of the SQL annotation.
 
Method Summary
 Connection getConnection()
          Returns a database connection to the server associated with the control.
 Calendar getDataSourceCalendar()
          Gets the Calendar instance used when setting and getting Date, Time, and Timestamp values.
 void setDataSourceCalendar(Calendar cal)
          Sets the Calendar instance that should be used when setting and getting Date, Time, and Timestamp values.
 

Field Detail

MAXROWS_ALL

static final int MAXROWS_ALL
This constant can be used as the value for the maxRows element of the SQL annotation. It indicates that all rows should be returned (i.e. no limit)

See Also:
Constant Field Values

DEFAULT_FETCH_SIZE

static final int DEFAULT_FETCH_SIZE
The default fetch size for result sets, indicates the database should determine the fetch size.

See Also:
Constant Field Values
Method Detail

getConnection

Connection getConnection()
                         throws SQLException
Returns a database connection to the server associated with the control. It is typically not necessary to call this method when using the control.

Returns:
A Connection a database.
Throws:
SQLException

setDataSourceCalendar

void setDataSourceCalendar(Calendar cal)
Sets the Calendar instance that should be used when setting and getting Date, Time, and Timestamp values.

See Also:
java.sql.ResultSet#getDate(int, Calendar), java.sql.ResultSet#getTime(int, Calendar), java.sql.ResultSet#getTimestamp(int, Calendar), java.sql.PreparedStatement#setDate(int, Date, Calendar), java.sql.PreparedStatement#setTime(int, Time, Calendar), java.sql.PreparedStatement#setTimestamp(int, Timestamp, Calendar)

getDataSourceCalendar

Calendar getDataSourceCalendar()
Gets the Calendar instance used when setting and getting Date, Time, and Timestamp values. This is the Calendar set by the setDataSourceCalendar method.

Returns:
The Calendar instance.