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 Oracle database.

If you are using JDeveloper's embedded OC4J to develop 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 ADF Business Components 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 Business Components project. Also, the data-sources.xml file is automatically packaged and deployed with the Enterprise Archive (EAR) file.

Sample data-sources.xml

     <data-source 
    class="com.evermind.sql.DriverManagerDataSource" 
    name="OracleDS” 
    schema="database-schemas/oracle.xml" 
    location="jdbc/oracle10GCoreDS"
    xa-location="jdbc/xa/OracleXADS"
    ejb-location="jdbc/oracle10GDS"
    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 JDeveloper Release Notes.


Related topics

About OC4J
About the Oracle Application Server
Working with the OC4J Application Servers
Deploying to the Oracle Application Server or Standalone OC4J
Working with the Standalone OC4J Application Server

 

Copyright © 1997, 2004, Oracle. All rights reserved.