Data source configuration for Java when using IBM WebSphere

A data source is a named connection to a database. You must specify a data source within the web application server to publish a feature service to ArcGIS Spatial Data Server for the Java platform. Typically, the data source object is configured with a naming service based on the Java Naming and Directory Interface (JNDI) API.

TipTip:

If you will be configuring multiple data sources, use data source names that reflect the properties of the data source. For example, you could include the server, database, and user names in the data source name. This will help you to identify the data sources without having to look up the properties in the web application server files or consoles.

Use the IBM WebSphere Administration Console to create your data source and JDBC provider.

The JDBC drivers installed with WebSphere may not be the versions of the jar files supported with ArcGIS Spatial Data Server. No PostgreSQL JDBC driver is installed with WebSphere. In these cases, you must place the correct JDBC driver in the WebSphere Application Server root directory and create a new JDBC provider. You can create the JDBC provider when you configure your data source, or create it prior to setting up your data source. The instructions in this topic create the JDBC provider at the same time that the data source is configured.

Adding your DBMS jar file

Place the JDBC driver for your database in the lib directory of WAS_INSTALL_ROOT.

Configure a data source

DB2

Use the WebSphere Administration Console to create a DB2 data source, create a JDBC provider, and set custom properties for the data source.

Creating the data source and JDBC provider

The following steps describe creating a DB2 data source and JDBC provider in the WebSphere Administration Console.

Steps:
  1. Log in to the IBM WebSphere Administration Console as the administrative user.
  2. Expand JDBC under Resources, and click Data sources.
  3. Click New to create a new data source.

    The Create a data source page opens.

  4. Type a name for your data source and JNDI.
    NoteNote:

    The data source name and JNDI name values must be the same. However, the JNDI name must begin with jdbc/. For example, you could type atoll_spdb_sdsu for the data source name and jdbc/atoll_spdb_sdsu for the JNDI name.

  5. You can set up security aliases or accept the defaults on the Setup security aliases page, then click Next.
  6. Click Next.
  7. Click Create new JDBC provider.
  8. Click Next.
  9. Choose DB2 from the Database Type drop-down list.
  10. Choose DB2 Using IBM JCC Driver for the Provider Type.
  11. Choose Connection pool data source for the Implementation type.
  12. Provide a name and description for your DB2 JDBC provider, then click Next.
  13. Type the path to and name of the DB2 jar file to set the $DB2_JCC_DRIVER_PATH WebSphere variable.
  14. If you have set the $DB2_JCC_DRIVER_NATIVEPATH WebSphere variable, you can leave the Native library path blank.
  15. Click Next.
  16. Choose the version of the DB2 JDBC driver from the Value drop-down list for Driver type.
  17. Type the name of the database you will use for the data source in the Database name text box.
  18. Type the name of the server where DB2 is installed in the Server name text box.
  19. Type the port number through which the database is communicating in the Port number text box.
  20. Check Use this data source in container managed persistence (CMP).
  21. Click Next.
  22. You can set up security aliases or accept the defaults on the Setup security aliases page, then click Next.
  23. Review the summary information for your data source, then click Finish.

The data source appears in the data source list in the WebSphere Administration Console.

Setting custom properties

Most properties of the data source were set when you created it. However, you must set the user name and password properties of the data source from the Custom properties page in the WebSphere Administration Console.

From the data source list in the WebSphere Administration Console, open the data source you just created, then open the Custom properties page to define properties of the data source.

Steps:
  1. Click the data source to open it.
  2. Under Additional Properties, click Custom properties.

    The Custom properties page opens.

  3. You must add values for the connecting user and user password. You will add these, one at a time, from the Configuration tab.
  4. Click New under Preferences.

    The Configuration tab opens.

  5. Type user in the Name text box and the name of the database user to be used for the database connection in the Value text box.
  6. Click OK on the Configuration tab to create the property.
  7. Repeat steps 3 through 5 to create a custom property for the user password. Type password in the Name text box and the database user's password in the Value text box.

Oracle

Use the WebSphere Administration Console to create an Oracle data source, create a JDBC provider, and set custom properties for the data source.

Creating the data source and JDBC provider

The following steps describe creating an Oracle data source and JDBC provider in the WebSphere Administration Console.

Steps:
  1. Log in to the IBM WebSphere Administration Console as the administrative user.
  2. Expand JDBC under Resources, and click Data sources.
  3. Click New to create a new data source.

    The Create a data source page opens.

  4. Type a name for your data source and JNDI.
    NoteNote:

    The data source name and JNDI name values must be the same. However, the JNDI name must begin with jdbc/. For example, you could type porcupine_osid_pubu for the data source name and jdbc/porcupine_osid_pubu for the JNDI name.

  5. Click Next.
  6. Click Create new JDBC provider.
  7. Click Next.
  8. Choose Oracle from the Database Type drop-down list.
  9. Choose Oracle JDBC Driver from the Provider type drop-down list.
  10. Choose Connection pool data source from the Implementation type drop-down list.
  11. Provide a name and description for your JDBC provider and click Next.
  12. Type the path to and name of the Oracle JDBC driver to set the WebSphere $ORACLE_JDBC_DRIVER_PATH variable.
  13. Click Next.
  14. The value for the URL should be prepopulated. Be sure it is correct for you data source.
  15. Choose Oracle11g data store helper from the Data store helper class name drop-down list.
  16. Check Use this data source in container managed persistence (CMP).
  17. Click Next.
  18. You can set up security aliases or accept the defaults on the Setup security aliases page, then click Next.
  19. Review the summary information for your data source, then click Finish.

The data source appears in the data source list in the WebSphere Administration Console.

Setting custom properties

Most properties of the data source were set when you created it. However, you must set the user name and password properties of the data source from the Custom properties page in the WebSphere Administration Console.

From the data source list in the WebSphere Administration Console, open the data source you just created, then open the Custom properties page to define properties of the data source.

Steps:
  1. Click the data source to open it.
  2. Under Additional Properties, click Custom properties.

    The Custom properties page opens.

  3. You must add values for the connecting user and user password. You will add these, one at a time, from the Configuration tab.
  4. Click New under Preferences.

    The Configuration tab opens.

  5. Type user in the Name text box and the name of the database user to be used for the database connection in the Value text box.
  6. Click OK on the Configuration tab to create the property.
  7. Repeat steps 3 through 5 to create a custom property for the user password. Type password in the Name text box and the database user's password in the Value text box.

PostgreSQL

PostgreSQL is not a certified JDBC driver on WebSphere. Therefore, you must configure a user-defined JDBC provider when you configure your data source to point to a PostgreSQL database.

Setting the JDBC driver environment variable

First, set the JDBC driver variable.

Steps:
  1. Log in to the IBM WebSphere Administration Console as the administrative user.
  2. Navigate to Environment > Websphere Variables and find the User-defined_JDBC_DRIVER_PATH variable.
  3. Set the User-defined_JDBC_DRIVER_PATH variable to WAS_INSTALL_ROOT/lib.

Creating the data source and JDBC provider

Next, create a new data source and define the JDBC provider.

Steps:
  1. Expand JDBC under Resources, and click Data sources.
  2. Click New to create a new data source.

    The Create a data source page opens.

  3. Type a name for your data source and JNDI.
    NoteNote:

    The data source name and JNDI name values must be the same. However, the JNDI name must begin with jdbc/. For example, you could type laverne_pgdb_lri2 for the data source name and jdbc/laverne_pgdb_lri2 for the JNDI name.

  4. Click Next.
  5. Click Create new JDBC provider.
  6. Click Next.
  7. Choose User-defined from the Database Type drop-down list.
  8. Type org.postgresql.ds.PGConnectionPoolDataSource in the Implementation class name text box.
  9. Provide a name and description for your user-defined JDBC provider, then click Next.
  10. Provide the path to and name of the PostgreSQL jar file on the WebSphere server and click Next.
  11. Type a data store helper class name.
  12. Check Use this data source in container managed persistence (CMP) and click Next.
  13. You can set up security aliases or accept the defaults on the Setup security aliases page, then click Next.
  14. Review the summary information for your data source, then click Finish.

The data source appears in the data source list in the WebSphere Administration Console.

Setting custom properties

You created a user-defined JDBC provider for your PostgreSQL data source, so there are several properties you must set manually. Do this from the Custom properties page in the WebSphere Administration Console.

From the data source list in the WebSphere Administration Console, open the data source you just created, then open the Custom properties page to define properties of the data source.

Steps:
  1. Click the data source to open it.
  2. Under Additional Properties, click Custom properties.

    The Custom properties page opens.

  3. You must add values for the database name, server name, database port number, connecting user, and user password. You will add these, one at a time, from the Configuration tab.
  4. Click New under Preferences.

    The Configuration tab opens.

  5. Provide values for the following configuration properties:

    Name

    Value

    databaseName

    <name of your PostgreSQL database used for the data source>

    serverName

    <name of the server where the PostgreSQL database cluster is installed>

    portNumber

    <port through which the PostgreSQL database cluster communicates>

    user

    <login role name used for connections>

    password

    <password for the login role>

  6. Click OK on the Configuration tab to create the properties.

Related Topics

8/21/2012