• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Oracle Datasource for jboss

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
. 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.
 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I'm also new to Jboss. But I'm able to configure Oracle DS to run my ejbs.
I'm using Jboss3.2.3. I don't know about configurations in Jboss 3.0.2.
Here is what I've done for Jboss3.2.3.
Hope it is useful to you in some way.
1. Under server\default\deploy\ folder, add oracle-ds.xml.
2. oracle-ds.xml has entries for datasource.
Ex:
<datasources>
<local-tx-datasource>
<jndi-name>myDS</jndi-name>
<connection-url>jdbc racle:thin:@<ip_address>:<port>:<database></connection-url>
<driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
<user-name>scott</user-name>
<password>tiger</password>
<min-pool-size>5</min-pool-size>
<max-pool-size>100</max-pool-size>
<blocking-timeout-millis>5000</blocking-timeout-millis>
<idle-timeout-minutes>15</idle-timeout-minutes>
<exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name>
</local-tx-datasource>
</datasources>
3. In the jbosscmp-jdbc.xml add,
<jbosscmp-jdbc>
<defaults>
<datasource>java:/myDS</datasource>
<datasource-mapping>Oracle*</datasource-mapping>
</defaults>
....
</jbosscmp-jdbc>
4.Deploy ejbs and try to lookup them.
Regards,
Kalpesh
reply
    Bookmark Topic Watch Topic
  • New Topic