. I have configured standardjaws.xml (in the
jboss conf dir - jboss-3.0.2\server\default\conf\) as:
code:
--------------------------------------------------------------------------------
<jaws> <datasource>
java:/DefaultDS</datasource> <type-mapping>Oracle8</type-mapping> <debug>false</debug> <default-entity> <create-table>false</create-table> <remove-table>false</remove-table> ........
--------------------------------------------------------------------------------
2. I have configured standardjbosscmp-jdbc.xml (in the same dir)as:
code:
--------------------------------------------------------------------------------
<jbosscmp-jdbc> <defaults> <datasource>java:/DefaultDS</datasource> <datasource-mapping>Oracle8</datasource-mapping> <create-table>false</create-table> <remove-table>false</remove-table>.....
--------------------------------------------------------------------------------
3. In file login-config.xml (in the same conf dir) I have set authentification block:
code:
--------------------------------------------------------------------------------
<application-policy name="OracleDbRealm"> <authentication> <login-module code="org.jboss.resource.security.ConfiguredIdentityLoginModule" flag="required"> <module-option name="principal">anuz</module-option> <module-option name="userName">anuz</module-option> <module-option name="password">anuz123</module-option> <module-option name="managedConnectionFactoryName">jboss.jca:service=LocalTxCM,name=OracleDS</module-option> </login-module> </authentication> </application-policy>
--------------------------------------------------------------------------------
4. Finally, i have configured JNDI Name in oracle-service.xml in deploy dir (for example, at jboss-3.0.2\server\default\deploy\):
set block:
code:
--------------------------------------------------------------------------------
<application-policy name = "OracleDbRealm"> <authentication> <login-module code = "org.jboss.resource.security.ConfiguredIdentityLoginModule" flag = "required"> <module-option name = "principal">anuz</module-option> <module-option name = "userName">anuz</module-option> <module-option name = "password">anuz123</module-option> <module-option name = "managedConnectionFactoryName">jboss.jca:service=LocalTxCM,name=OracleDS</module-option> </login-module> </authentication> </application-policy>
--------------------------------------------------------------------------------
and
code:
--------------------------------------------------------------------------------
<!--uncomment out this line if you are using the OracleDbRealm above --> <attribute name="SecurityDomainJndiName">OracleDbRealm</attribute> <depends optional-attribute-name="ManagedConnectionFactoryName"> <!--embedded mbean--> <mbean code="org.jboss.resource.connectionmanager.RARDeployment" name="jboss.jca:service=LocalTxDS,name=OracleDS"> <attribute name="JndiName">DefaultDS</attribute> <attribute name="ManagedConnectionFactoryProperties"> <properties> <config-property name="ConnectionURL" type="java.lang.String">
jdbc : oracle:thin:@MY_ORACLE_SERVER_MACHINE_NAME:1521:MY_ORACLE_SID</config-property> <config-property name="DriverClass" type="java.lang.String">oracle.jdbc.driver.OracleDriver</config-property> <!--set these only if you want only default logins, not through JAAS --> <config-property name="UserName" type="java.lang.String"/> <config-property name="Password" type="java.lang.String"/> </properties> </attribute> <!--Below here are advanced properties --> <!--hack--> <depends optional-attribute-name="OldRarDeployment">jboss.jca:service=RARDeployment,name=JBoss LocalTransaction JDBC Wrapper</depends> </mbean> </depends>
After doing all these i have tried to access the data source and for that i have used this code:
Context initial = new InitialContext();
DataSource dataSource =
(DataSource)initial.lookup("java:comp/env/OracleDS");
Connection con = dataSource.getConnection();
But this does not work. When i run my client it says in jboss window that OracleDS is not bound.Can Any one tell me wat is wrong or what i will have to do.i am trying to connect oracle database from my ejb.please help me with this.