Installing JDBC for Jboss EAP 6.3

2019-08-20 04:33发布

问题:

I am trying to make a Oracle Database Express 11 datasource for jboss EAP 6.3.

I tried to follow this guide but it tells me to "copy the archive ojdbc5.jar to the lib directory in the default server configuration" which confuses me because I have no such directory. In search of such directory I found this page but the file tree there is absolutely different from mine.

How do I install JDBC and where should I put the files from the "Setting up Oracle datasource" guide?

回答1:

JBoss-EAP 6.3 uses JBoss-AS 7.4.0 Final Communtity Version.

So you are looking into JBoss AS 5 and AS 4.

For Setting Up Oracle DataSource in Jboss EAP 6.3 you need to do the following steps

  1. You need to Create Datasource under Datasources element in your standalone configuration file as follows
<datasource jta="true" jndi-name="your jndiName" pool-name="poolname" enabled="true" use-java-context="true" use-ccm="true">
    <connection-url>database URL</connection-url>
    <driver-class>oracle.jdbc.OracleDriver</driver-class>
    <driver>oracleDriver</driver>
    <pool>
    <min-pool-size>2</min-pool-size>
    <max-pool-size>20</max-pool-size>
    <prefill>true</prefill>
    </pool>
    <security>
    <user-name>username</user-name>
    <password>password</password>
    </security>
    </datasource>
  1. Secondly you need to add the Driver Element under Drivers in your config file. Something like this.
<drivers>
    <driver name="oracleDriver" module="com.oracle"/>
    </drivers>

Make Sure that driverName in the driver element and that of driver element in your Datasource Element is same.

  1. Third Step is to paste the ojdbc5.jar to the folder in your modules directory under jboss directory. For that You need to create directories com/oracle/main under modules/system/layers/base/ [in this path paste the copied jar file] and also need to create module.xml file under main directory

The contents of module.xml is as follows:

<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.0" name="com.oracle">
<resources>
<resource-root path="ojdbc6.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
</dependencies>
</module>

Please make sure that module name in above module.xml file and name specified for the attribute module for the driver element in your standalone config file are same.

Ya

I think these Steps will help you to configure Datasource in Jboss-EAP 6.3

Thanks



回答2:

The first Tutorial yoiu mentioned is for JBossAS 5 the second one even for JBossAS4!

Check out this one here: https://access.redhat.com/documentation/en-US/JBoss_Enterprise_Application_Platform/6.3/pdf/Administration_and_Configuration_Guide/JBoss_Enterprise_Application_Platform-6.3-Administration_and_Configuration_Guide-en-US.pdf

Especially Chapter 6. There is also an example Oracle Datasource within this pdf