About OC4J Data Sources

J2EE applications such as servlets and EJBs retrieve connections to the database through java.sql.DataSource objects. The class entry used must be com.evermind.sql.DriverManagerDataSource and the connection entry used must be the oracle.jdbc.driver.OracleDriver class. Data sources are factories that return JDBC connections to business data in an Oracle9i database.

If you are using JDeveloper's embedded Oracle9i Application Server Containers for J2EE (OC4J) server to run, debug, profile, or CodeCoach your EJB applications, a <data-source> element is automatically created for each JDBC database connection defined in JDeveloper and written to the embedded OC4J server's data source file. JDeveloper ensures that this file is updated accordingly as new data source elements are created and whenever the embedded OC4J server is started. Do not edit this file as this may affect the proper running of the embedded OC4J server.

For deployment to a remote OC4J instance, all data sources are defined in the data-sources.xml file. When you deploy a WAR or EJB, the latest data-sources.xml file is automatically packaged and deployed with the Enterprise Archive (EAR) file. For each configured database instance, there should be a corresponding <data-source> element in the data-sources.xml file which is located in the following OC4J directory:

<ORACLE_HOME>/j2ee/config

When deploying Business Components for Java applications to a remote OC4J instance, JDeveloper generates the data sources file based on the database connection name you have chosen in the Business Components Deployment Wizard to build the BC4J project. Also, the data-sources.xml file is automatically packaged and deployed with the Enterprise Archive (EAR) file. For more information, see:

Sample data-sources.xml

 
    <data-source 
    class="com.evermind.sql.DriverManagerDataSource" 
    name="OracleDS” 
    schema="database-schemas/oracle.xml" 
    location="jdbc/oracle9iCoreDS"
    xa-location="jdbc/xa/OracleXADS"
    ejb-location="jdbc/oracle9iDS"
    connection-driver="oracle.jdbc.driver.OracleDriver"
    username="Scott" 
    password="tiger”
    url="jdbc:oracle:thin:@dlsun1630:1521:ORCL"
    /> 

See also: For more information about OC4J data sources, see the "Oracle Application Server Containers for J2EE User's Guide" which is provided with the Oracle Application Server documentation library.

Foreign Data Sources Support

If you have configured other types of JDBC connections besides Oracle, the driver information and connection details from the connection descriptor file, connections.xml, are also included in the data-sources.xml file and bundled with the deployed .ear file used by the embedded OC4J server. These connections are added to the data-source entry in the data-sources.xml file.

If you are connecting to heterogeneous databases such as Microsoft, SQLServer, Sybase, and DB2, refer to the the Merant documentation for installing Merant JDBC drivers.

Note: For more information on foreign data source support and configuration, refer to the Oracle9i JDeveloper Release Notes.


Related topics

Configuring Database Connections
Ways to Create Application Server Connections
Ways to Deploy J2EE Applications
About Business Components for Java (BC4J) Deployment
Defining BC4J JSP Runtime Properties in the bc4j.xcfg File
About BC4J Configuration Properties for a JSP Project