3 Replies Latest reply on Apr 2, 2009 2:11 PM by dvohra21

    datasource through jboss API..

    682114
      hi all,

      how can i make a datasource by using jboss server API??

      Thanks
      Mohit
        • 1. Re: datasource through jboss API..
          dvohra21
          For which database?
          • 2. Re: datasource through jboss API..
            682114
            for oracle database..
            • 3. Re: datasource through jboss API..
              dvohra21
              To configure JBoss 4.0 with Oracle, we first need to put Oracle's driver classes in the CLASSPATH. Copy Oracle's JDBC driver JAR file ojdbc5.jar or ojdbc4.jar to the server/default/lib directory.

              To use Oracle's transactional (XA) data source, copy /docs/examples/jca/oracle-xa-ds.xml to the /server/default/deploy directory. To configure with the non-XA data source, copy /docs/examples/jca/oracle-ds.xml instead, to /server/default/deploy dir.

              Next, we need to modify the oracle-ds.xml configuration file. The <driver-class/> and <connection-url/> settings for Oracle are as follows:


              Class: oracle.jdbc.OracleDriver
              URL: jdbc:oracle:thin:@<host>:<port>:<database>

              In the Connection URL setting, <host> is the HOST value specified in the /network/ADMIN/tnsnames.ora file, and <port> is the PORT value specified in the tnsnames.ora file, and <database> is the database name.


              For a Entity EJB (CMP) modify the standardjbosscmp-jdbc.xml or jbosscmp-jdbc.xml configuration file, setting the <datasource> and <datasource-mapping> elements to use Oracle:
              <jbosscmp-jdbc>
                 <defaults>
                    <datasource>java:/OracleDS</datasource>
                    <datasource-mapping>Oracle9</datasource-mapping>
                 </defaults>
              </jbosscmp-jdbc>
              Modify login-config.xml to use Oracle. Add the following <application-policy> element to login-config.xml:
              <application-policy name = "OracleDbRealm"> 
                 <authentication> 
                    <login-module code =  
                "org.jboss.resource.security.ConfiguredIdentityLoginModule" 
                                          flag = "required"> 
                       <module-option name = "principal"></module-option> 
                       <module-option name = "userName">oe</module-option> 
                       <module-option name = "password">pw</module-option> 
                       <module-option name ="managedConnectionFactoryName">  
                                 jboss.jca:service=LocalTxCM,name=OracleDS 
                       </module-option> 
                    </login-module> 
                 </authentication> 
              </application-policy>
              By modifying the oracle-ds.xml, standardjbosscmp-jdbc.xml, and login-config.xml files, the JBoss 4.0 server is configured to be used with a Oracle database.

              Edited by: dvohra on Apr 2, 2009 7:11 AM