JBoss EAP 6.1 Getting an Oracle Data source to work

One good starting point to help understand this process is the question asked on the JBoss forum “how to add oracle datasource in JBossEAP6.1“.

Some details in the StackOverflow question “jboss-eap-6.1 oracle driver definition when installed as deployment” highlight some of the key steps.

(Note that MiddleWare Magic has an AS7 (EAP 6.1 equivalent) guide here.

For EAP 6.1:

  • From the c:\dev\jboss-eap-6.1\bin directory – run the command “standalone” from the command line.
  • For the initial definition you can put the ojdbc.jar into the folder: “C:\dev\jboss-eap-6.1\modules\system\layers\base\oracle\jdbc\main”
  • Note that you have to create the oracle/jdbc/main elements of the folder path
  • Include a module.xml
    <module xmlns="urn:jboss:module:1.1" name="com.oracle">
     <resource-root path="ojdbc6.jar"/>
     <module name="javax.api"/>
  • Note that the ojdbc6.jar is slightly different to what is shown in the images on the first link.
  • For the active deployment – put ojdbc6.jar into the folder: “C:\dev\jboss-eap-6.1\standalone\deployments”
  • Restart the server so that the oracle driver appears in the list of options (otherwise only H2 will be there).
  • Once updated the c:\dev\jboss-eap-6.1\standalone\configuration\standalone.xml file will have a

    section that will have an entry like the following:

     <datasource jta="false" jndi-name="java:jboss/OracleDS" pool-name="OracleDS" enabled="true" use-ccm="false">

    The need for the validation and statement sections is not fully clear.

  • To test this – use a simple jsp page:
    <%@page contentType="text/html"
      DataSource ds = null;
      Connection con = null;
      PreparedStatement pr = null;
      InitialContext ic;
      try {
         ic = new InitialContext();
         ds = (DataSource) ic.lookup("java:jboss/OracleDS");
         con = ds.getConnection();
         out.println("<br> About to select from dual <br>");
         pr = con.prepareStatement("SELECT * from dual");
         ResultSet rs1 = pr.executeQuery();
         while (rs1.next()) {
             out.println("<br> " + rs1.getString("DUMMY") + " | ");
      } catch (Exception e) {
        out.println("Exception thrown " + e);
      } finally {
      if (con != null) {
  • This should display the following on a simple html page.
      About to select from dual
    X |


This entry was posted in Uncategorized and tagged , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s