How to Setup an Oracle JDBC Data Source on WebSphere Application Server 7 Step-by-Step

Malvon picture Malvon · Dec 3, 2013 · Viewed 46.1k times · Source

How do you setup an Oracle JDBC data source on WebSphere Application Server 7 using Admin Console?

Answer

Malvon picture Malvon · Dec 3, 2013
  1. Login to the Admin Console of the running server, i.e. Window -> Show Views -> Servers | right click the server -> Run Administration -> Run Administrative Console

  2. Environment -> WebSphere variables

  3. Find “ORACLE JDBC DRIVER PATH” Name out of the list (second page) and click its link

  4. Set its “Value” to the “directory” (not the actual path + filename) where your ojdbc6.jar resides on your file system

    We can set this path externally, either a stand alone ojdbc6.jar or find it with Oracle client packages, i.e. C:\app\\product\11.2.0\client_1

  5. Click “Apply”, then “Save” (on top)

  6. Back to WAS Admin Console, go to Security -> Global security

  7. On “Authentication” panel, expand “Java Authentication and Authorization Service” -> J2C authentication data

  8. Click “New”

  9. Give it an Alias name, i.e. Alias_Oracle and input our current databases’ credential: User ID = your_db_username, Password = your_db_password

  10. Click “Apply”, then “Save”

  11. Go to Resources -> JDBC -> JDBC providers

  12. Make sure that the right Scope has been selected, i.e. Node=DOMAINHOSTNAMENode01 or something

  13. Click “New” to create a new JDBC provider

    Step 1: Select “Oracle” from “Database type” menu | Provider type = Oracle JDBC Driver | Implementation type = Connection pool data source

    Leave the “Name” as default, i.e. “Oracle JDBC Driver”

    Step 2: if you have setup the ORACLE JDBC DRIVER PATH correctly, it should have the appropriate “Class path” to “ojdbc6.jar” already selected for you Step 3: Summary, click “Finish”

  14. Go to Resources -> JDBC -> Data sources

  15. Make sure the right Scope is selected , i.e. Node=DOMAINHOSTNAMENode01 or something

  16. Click “New”

    Step 1: Data source name = “Oracle JDBC Driver” | JNDI name = “jdbc/OracleDS”

    Step 2: Select “Select an existing JDBC provider” = “Oracle JDBC Driver”

    Step 3: URL = “jdbc:oracle:thin:@hostname:port:db_alias” | Data store helper class name = “Oracle11g data store helper”

    Step 4: Component-managed authentication alias = DOMAINHOSTNAMENode01/Alias_Oracle

    select “DefaultPrincipalMapping”

    Step 5: Summary, click “Finish”

  17. Back on “Data sources” screen, select the newly created data source and “Test connection”. If it succeeds, you are done

  18. You can retrieve the data source programmatically:

    Context initContext = new InitialContext(); dataSource = (DataSource)initContext.lookup("jdbc/OracleDS");