2.3. Configuring a datasource for Oracle DB


Oracle is one of the main players in the commercial database field and most readers will probably have come across it at some point. You can download it freely for non-commercial purposes from http://www.oracle.com/technology/products/database/xe/index.html
In this section, we'll connect the server to Oracle Database 11g Express Edition using the latest JDBC driver (11g) available at http://www.oracle.com/technology/software/tech/java/sqlj_jdbc/index.html
To make the JDBC driver classes available to the JBoss Enterprise Application Platform, copy the archive ojdbc6.jar to the lib directory in the default server configuration (assuming that is the server configuration you’re running).
Then create a text file in the deploy directory called oracle-ds.xml with the following datasource descriptor :
<?xml version="1.0" encoding="UTF-8"?>
<datasources>
	<local-tx-datasource>
		<jndi-name>DefaultDS</jndi-name>
		<connection-url>jdbc:oracle:thin:@localhost:1521:xe</connection-url>
		<driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
		<user-name>SYSTEM</user-name>
		<password>jboss</password>
		<valid-connection-checker-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleValidConnectionChecker</valid-connection-checker-class-name>
		<metadata>
			<type-mapping>Oracle9i</type-mapping>
		</metadata>
	</local-tx-datasource>
</datasources>
Copy to Clipboard Toggle word wrap
The datasource is pointing at the database/SID called xe provided by default with Oracle XE.
Of course, you need to update the connection url attributes as well as the username/password combination to match your environment setup.
Back to top
Red Hat logoGithubredditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust. Explore our recent updates.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

Theme

© 2025 Red Hat