In Oc4j, If we have an EAR app, we can tell the deployer to create a datasource for the application using orion-application with something like:
<orion-application.xml>
<?xml version='1.0'?>
<orion-application xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://xmlns.oracle.com/oracleas/schema/orion-application-10_0.xsd"
default-data-source="jdbc/mainsearchds">
<data-sources path="./data-sources.xml" />
</orion-application>
which uses:
开发者_Python百科 <connection-factory factory-class="oracle.jdbc.pool.OracleDataSource" user="xx" password="xx" url="jdbc:oracle:thin:@server:1521:xyz" />
</connection-pool>
<managed-data-source name="MainSearchDataSource" jndi-name="jdbc/mainsearchds" connection-pool-name="MainSearchPool" />
</data-sources>
So... in a web application (not inside an EAR app)... how to configure it to automatically creates its required data-source on deploy??
Thanks.
You can't. When you deploy a WAR, behind the scenes OC4J creates an EAR with no datasource configured. Then using the command line you can add the datasource.
It makes no sense to deploy a WAR in OC4J, always deploy a EAR and don't let the server create configuration files for you.
精彩评论