How do you setup an Oracle JDBC data source on WebSphere Application Server 7 using Admin Console?
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.
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.
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.
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.
Login to the Admin Console of the running server, i.e. Window -> Show Views -> Servers | right click the server -> Run Administration -> Run Administrative Console
Environment -> WebSphere variables
Find “ORACLE JDBC DRIVER PATH” Name out of the list (second page) and click its link
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
Click “Apply”, then “Save” (on top)
Back to WAS Admin Console, go to Security -> Global security
On “Authentication” panel, expand “Java Authentication and Authorization Service” -> J2C authentication data
Click “New”
Give it an Alias name, i.e. Alias_Oracle and input our current databases’ credential: User ID = your_db_username, Password = your_db_password
Click “Apply”, then “Save”
Go to Resources -> JDBC -> JDBC providers
Make sure that the right Scope has been selected, i.e. Node=DOMAINHOSTNAMENode01 or something
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”
Go to Resources -> JDBC -> Data sources
Make sure the right Scope is selected , i.e. Node=DOMAINHOSTNAMENode01 or something
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”
Back on “Data sources” screen, select the newly created data source and “Test connection”. If it succeeds, you are done
You can retrieve the data source programmatically:
Context initContext = new InitialContext(); dataSource = (DataSource)initContext.lookup("jdbc/OracleDS");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With