Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

7.3.2. Installing the JDBC Driver and Deploying the DataSource

The Oracle JDBC drivers can be found in the directory $ORACLE_HOME/jdbc/lib. Older versions, which may be more familiar to some users, had rather uninformative names like classes12.zip but at the time of writing the latest driver version can be found in the file ojdbc14.jar. There is also a debug version of the classes with _g appended to the name which may be useful if you run into problems. Again, you should copy one of these to the lib directory of the JBoss default configuration. The basic driver class you would use for the non-XA setup is called oracle.jdbc.driver.OracleDriver. The XADataSource class, which we’ll use here, is called oracle.jdbc.xa.client.OracleXADataSource.
For the configuration file, make a copy of the oracle-xa-ds.xml example file and edit it to set the correct URL, username and password.
<datasources> 
    <xa-datasource> 
        <jndi-name>XAOracleDS</jndi-name> 
        <track-connection-by-tx>true</track-connection-by-tx> 
        <isSameRM-override-value>false</isSameRM-override-value> 
        <xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class> 
        <xa-datasource-property name="URL">
            jdbc:oracle:thin:@monkeymachine:1521:jboss 
        </xa-datasource-property> 
        <xa-datasource-property name="User">jboss</xa-datasource-property> 
        <xa-datasource-property name="Password">password</xa-datasource-property> 
        <exception-sorter-class-name>
            org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter 
        </exception-sorter-class-name> 
        <no-tx-separate-pools/> 
    </xa-datasource> 
                    
    <mbean code="org.jboss.resource.adapter.jdbc.vender.oracle.OracleXAExceptionFormatter" 
           name="jboss.jca:service=OracleXAExceptionFormatter"> 
        <depends optional-attribute-name="TransactionManagerService">
            jboss:service=TransactionManager 
        </depends> 
    </mbean> 
</datasources>
We’ve used the Oracle thin (pure java) driver here and assumed the database is running on the host monkeymachine and that the database name (or SID in Oracle terminology) is jboss. We’ve also assumed that you’ve created a user jboss with all the sufficient privileges. You can just use dba privileges for this example.
SQL> connect / as sysdba 
Connected. 
SQL> create user jboss identified by password; 
User created. 
SQL> grant dba to jboss; 
Grant succeeded.
Now copy the file to the deploy directory. You should get the following output.
11:33:45,174 INFO  [WrapperDataSourceService] Bound connection factory for resource adapter
for ConnectionManager 'jboss.jca:name=XAOracleDS,service=DataSourceBinding to JNDI name
'java:XAOracleDS'
If you use the JNDIView service from the JMX console as before, you should see the name java:/XAOracleDS listed.

 
 
  Published under the terms of the Open Publication License Design by Interspire