tyrex.resource.jdbc.xa
public class EnabledDataSource extends XADataSourceImpl implements DataSource, Referenceable, ObjectFactory, Serializable
The driver class name EnabledDataSource specifies the class of the JDBC driver to be loaded.
The JDBC URL is specified by EnabledDataSource. The JDBC URL is of the form jdbc:subprotocol:subname. The initial "jdbc:" is optional so that subprocol:subname is also valid.
The supported data source properties are:
driverName (required) description (required, default) loginTimeout (required, default from driver) driverClassName (optional) user (optional) password (optional) transactionTimeout (optional, default from driver) isolationLevel (optional, defaults to serializable)This data source may be serialized and stored in a JNDI directory. Example of how to create a new data source and register it with JNDI:
EnabledDataSource ds; InitialContext ctx; ds = new EnabledDataSource(); ds.setDriverClassName( "..." ); ds.setDriverName( "jdbc:subprotocol:subname" ); ds.setUser( "me" ); ds.setPassword( "secret" ); ctx = new InitialContext(); ctx.rebind( "/comp/jdbc/test", ds );Example for obtaining the data source from JNDI and opening a new connections:
InitialContext ctx; DataSource ds; ctx = new InitialContext(); ds = (DataSource) ctx.lookup( "/comp/jdbc/test" ); ds.getConnection();
Version: 1.0
See Also: XADataSourceImpl DataSource Connection
Constructor Summary | |
---|---|
EnabledDataSource() |
Method Summary | |
---|---|
protected String | createJDBCURL()
Construct the JDBC URL used to connect to the database.
|
boolean | equals(Object other)
Returns true if this datasource and the other are equal.
|
Connection | getConnection() |
Connection | getConnection(String user, String password) |
String | getDescription()
Returns the description of this datasource.
|
String | getDriverClassName()
Returns the class name of the JDBC driver to use.
|
String | getDriverName()
Returns the URL name of the JDBC driver to use. |
String | getIsolationLevelAsString()
Returns the transaction isolation level used with all new
transactions, or null if the driver's default isolation
level is used. |
int | getLoginTimeout() |
PrintWriter | getLogWriter() |
Object | getObjectInstance(Object refObj, Name name, Context nameCtx, Hashtable env) |
String | getPassword()
Returns the database password.
|
Reference | getReference() |
String | getUser()
Returns the user's account name.
|
void | setDescription(String description)
Sets the description of this datasource.
|
void | setDriverClassName(String className)
Sets the class name of the JDBC driver to use, e.g. |
void | setDriverName(String driverName)
Sets the JDBC URL for the JDBC driver to use. |
void | setIsolationLevel(String level)
Sets the transaction isolation level used with all new
transactions, or null if the driver's default isolation
level should be used. |
void | setLoginTimeout(int seconds) |
void | setLogWriter(PrintWriter writer) |
void | setPassword(String password)
Sets the database password.
|
void | setUser(String user)
Sets the user's account name.
|
String | toString() |
Returns: the JDBC URL used to connect to the database.
Returns: The description of this datasource
Returns: The class name of the JDBC driver to use, null if not specified
Returns: The URL name of the JDBC driver to use
Returns: The transaction isolation level
Returns: The database password
Returns: The user's account name
Parameters: description The description of this datasource
Parameters: className The class name of the JDBC driver to use
Parameters: driverName The URL name of the JDBC driver to use
Parameters: level The transaction isolation level
Parameters: password The database password
Parameters: user The user's account name