8.1.1 Create Data Source

This topic helps to create data source.

The method for creating data sources is explained under the following headings.

Prerequisites

To create the data source, the OCI needs to be enabled. For this, download Oracle Instant Client and install it. The details are given below:

Table 8-1 Oracle Instant Client

Package Download Location Remarks
Oracle Instant Client Package https://www.oracle.com/database/technologies/instant-client/downloads.html Install Oracle Instant Client in a local directory. While configuring Weblogic for Windows or Unix/Linux box, the user needs to provide the directory path where Instant Client is installed.

The user needs to do the data source configuration with the OCI driver enabled. The configurations are given below.

  • Oracle Weblogic on Windows Box:
    • Set {ORACLE_HOME} in the environment variable.
    • Update the Environment Variable Path as {ORACLE_HOME}/Instance Client. This is required to load all the .dll files.
    • Ensure that the ojdbc*.jar file in {WL_HOME}/server/lib/ojdbc*.jar is the same as the file {ORACLE_HOME}/jdbc/lib/ojdbc*.jar. This is required for ensuring compatibility.
    • Update PATH in StartWebLogic.bat or setDomainEnv.bat. This must be the directory path where Oracle Instant Client is installed.
  • Oracle Weblogic on Unix/Linux Box:
    • Set {ORACLE_HOME} in the environment variable.
    • Update the environment variable LD_LIBRARY_PATH as {ORACLE_HOME}/lib. This is to load all the .so files.
    • Ensure that the ojdbc*.jar file in {WL_HOME}/server/lib/ojdbc*.jar is the same as the file {ORACLE_HOME}/jdbc/lib/ojdbc*.jar. This is to ensure compatibility.
    • Update LD_LIBRARY_PATH in StartWeblogic.sh or setDomainEnv.sh. This must be the directory path where Oracle Instant Client is installed.
    • If you are still not able to load the .so files, then you need to update the EXTRA_JAVA_PROPERTIES by setting Djava.library.path as {ORACLE_HOME}/lib in StartWebLogic.sh or setDomainEnv.sh.
To create the data source, follow the steps given below:
  1. Login to the WebLogic Remote Console of the WebLogic application server.
  2. In the Edit Tree, go to Services, then Data Sources, Click New.
  3. Specify a name for the new data source. For Ex: fcjdevDS_XA
  4. On the Create a New JDBC Data Source screen, specify the fields.
  5. In the JNDI Names field, enter the JNDI path to the location where this JDBC data source will be bound. Applications look up the data source on the JNDI tree by this name when reserving a connection.
  6. Choose the server instances or clusters where you want to deploy the data source.
  7. Select Generic Data Source from the Data Source Type drop-down list.
  8. From the Database Type drop-down list, select the database management system (DBMS) of the database that you want to connect to. For Ex: jdbc/fcjdevDS_XA
  9. From the Database Driver drop-down list, select a XA or non-XA JDBC driver
    • For XA Enabled Data Source: Oracle’s Driver (Thin XA) for Instance Connections, Versions Any (oracle.jdbc.xa.client.OracleXADataSource)
    • For Non-XA Enabled Data Source: Oracle’s Driver (Thin) for Instance Connections, Versions Any (oracle.jdbc.OracleDriver)
  10. Enter the connection details for the database that you want to connect to:
    • Database Name: Specify the name of the database you want to connect to.
    • Host Name: Specify the DNS name or IP address of the server that hosts the database.
    • Port: Specify the port on which the database server listens for connections requests.
    • Database User Name: Specify the database user account name that you want to use for connections in the data source.
    • Password: Specify the password for the database user account.
  11. Click Create.
  12. Follow the above steps to create all the data sources listed in Resources To Be Created

Note:

For *GTXN datasources - Global Transactions Protocol should be updated as “LoggingLastResource” under the Transaction tab.