Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 889
Malvon Avatar asked Dec 03 '13 20:12

Malvon


People also ask

How do I create a datasource in WebSphere?

On the WebSphere Application Server administrative console, click Data sources. Click New to create a new data source. Enter the Data source name and the JNDI name, and choose the authentication alias from the drop-down list in Component-managed authentication alias.

What is JDBC in WebSphere application server?

Configuring JDBC data sources in IBM WebSphere Application Server. A data source is an object that enables a Java Database Connectivity (JDBC) client, such as an application server, to establish a connection with a database.

What is the JDBC URL for Oracle?

Connection URL: The connection URL for the oracle10G database is jdbc:oracle:thin:@localhost:1521:xe where jdbc is the API, oracle is the database, thin is the driver, localhost is the server name on which oracle is running, we may also use IP address, 1521 is the port number and XE is the Oracle service name.

Is Oracle client required for JDBC connection?

The JDBC Thin driver does not require Oracle client software to be installed, but does require the server to be configured with a TCP/IP listener. We recommend all of our customers to use JDBC Thin driver as most of the new features are developed only on JDBC Thin driver.


1 Answers

  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");

like image 119
Malvon Avatar answered Dec 09 '22 03:12

Malvon