There are three types of data sources you can use in OC4J:
Emulated Data Sources Emulated data sources emulate the XA (Transactional) protocol for JTA ( Java Transaction API) transactions and offer features such as OC4J caching and pooling and Oracle JDBC extensions (for Oracle databases). The need for emulated data sources arose because many JDBC drives didn’t offer XA capabilities in earlier days. An emulated data source doesn’t provide full XA global transactional support, such as the two-phase commit, which is unsupported under emulated data sources. However, because they lack full transactional support, emulated data source connections tend to be quite fast in nature. If you’re using local transactions or global transactions that don’t require the two-phase commit mechanism, emulated data sources are the recommended type of data source for you to use. The following is a data-sources.xml configuration entry for an emulated data source: <data-source Although you specify values for the location, ejb-location, and xa-location attributes when configuring an emulated data source in your data-source.xml file, you must only use the value specified by the ejb-location attribute when looking up that emulated data source. By now, you’re well aware that you use a JNDI tree to look up a data source. You must look up a data source in the following way (only the "jdbc/OracleDS" value is used in the JNDI lookup):
Context ic = new InitialContext(); Or this: DataSource ds = (DataSource) ic.lookup("java:comp/env/jdbc/OracleDS");
Non-Emulated Data Sources A non-emulated data source provides full JTA services, meaning that the two-phase commit mechanism is provided as well. Oracle Corporation recommends you use non-emulated data sources. A non-emulated data source provides higher recovery and reliability as well as distributed database features, unlike the emulated data sources. Note that to run a non-emulated data source, you must use a Java-enabled database, such as the Oracle Database. Here’s a typical data-sources.xml file for a non-emulated data source: <data-source Note that JNDI lookups are performed using the value of the location attribute in the data-sources.xml file. In the data-sources.xml file,
Native Data Sources Native data sources are supplied by JDBC vendors, and are used to implement data sources. Vendors provide extensions to facilitate capabilities such as caching and pooling. OC4J supports native data sources, but because they don’t provide JTA services such as commits and rollbacks, they can’t be used in global transactions. Here’s how a data-sources.xml file looks for a native data source: <data-source
You can manage data sources through the Application Server Control’s Application Data Sources page. You can reach this page by clicking the Administration tab on the OC4J home page, and then clicking on Data Sources under the Application Defaults section. From the Application Data Sources page, you can perform the following functions:
The Data Sources page can be used to connect top Oracle as well as non-Oracle databases. For Oracle database connections, you must either configure a non-emulated Data Source that is purely Oracle based or use an emulated Data Source, which involves a wrapper around an Oracle Data Source.
blog comments powered by Disqus |
|
|
|
|
|
|
|