WebLogic Server JDBC for Database connection : Step by Step

This is in continuation of my last post on Database Connectivity (JDBC) in WebLogic Server here , In today’s post I am going to cover step by step JDBC configuration using Administration Console.

1. Login to WebLogic Server Administration console (default port 7001)
http://hostname:port/console

2. Select Data Sources under JDBC in Services section
.

.

3. Click on New button on right side as shown above

4. Enter JDBC Name, JNDI Name, Database & Driver type as shown below

.

. 

5. In next screen, enter database connection pool details i.e.
Database Name
Host Name (on which database is running)
— PortNumber (on which database listener is listening)
Database User Name
&
Password (for database user)

. 

6. In next screen you test connection by clicking on “Test Configuration” as shown below

.

. 

7.Finally you select target servers (Administration and Managed Server in that domain) for that Datasource.

. 

8. On clicking Finish button, you should see datasource as listed below

.

To create Multi Datasource

Steps mentioned above are to create single Datasource. To create Multi Datasource first create two or more Datasource as mentioned above (I created JDBC1 & JDBC2)  then select Multi Datasources from console as shown below
.

.

2. Click on New button above, In next screen select Name of Multi Datasource and JNDI
.

.

3. Select Algorithm Typefor Multi Datasource i.e. Failover or Load Balancing

4. Select Datasource which you want to make part of Multi Datasource as shown below

.

.

5. Finally click on Finish to see Multi Data Sources

JDBC tuning in WebLogic and lot more coming soon…

Did you get a chance to download Free Interview Questions related to WebLogic? If not, download it here http://k21academy.com/weblogic-interview-question

weblogic banner

Learn Oracle Weblogic Server Administration

If you want to learn Oracle WebLogic Server Administration with tons of additional features like Live Interactive Sessions, Life time access to membership portal, Free re-taking sessions for next one year, Dedicated Machine to practice, On Job Support and much more

Click here to know more

 

About the Author Atul Kumar

Oracle ACE, Author, Speaker and Founder of K21 Technologies & K21 Academy : Specialising in Design, Implement, and Trainings.

follow me on:

Leave a Comment:

30 comments
Matthias says November 7, 2008

Thank you for this good summary.
I believe there is one critical limitation you did not mention. While you can deploy an application with an ID using the deployer role, surprisingly it requires an admin role to create the associated JDBC conenction pools (and Datasources). Have you found a way around it?

Reply
arungoin says May 16, 2010

Hi Atul,

A nice intro on data source configuration. thank you, by the way we are facing one problem from OC4J time, i.e. changing password of data source user mandates server restart, is it possible to get ride of this.

I tried Datasource -> Control
Shutdown/ Start but still no hope.

Thanks
Arunachalam.C
Lead Consultant BPEL
Emaar Business Park, Building 3, Level 4
IT Department,
PO Box 9440,
Dubai, United Arab Emirates
Direct tel: + 971 4 3673878
Mobile: + 971 507882908

Reply
Paul says May 28, 2010

Hi Atul,
This is good doc. Thanks for taking efforts to put this together.
I have a question:
I am trying to to connect from OmniPortlet to SQL Server database. I think, I have to register the database driver in provider.xml .
But when I search for this file, I see many provider.xml files in middleware home. The doc says modify the file from “OmniPortlet_WAR_DIRECTORY/WEB-INF/providers/omniPortlet” directory. Do you know exactly which provider.xml to modify. I am looking for exact file location on windows server.
Thanks for your time.

Reply
Ajit says August 19, 2010

Hi Atul,

I installed Weblogic, but i don’t see Teradata in the drop down list of databases. Is there any workaround to connect teradata database.

Thanks
Aj

Reply
Atul Kumar says August 19, 2010

@ Aj,
You would need teradat related jar files in classpath. Check steps here

http://www.teradata.com/DownloadCenter/Topic9448-98-1.aspx#beawl10.3

Reply
Ajit says August 20, 2010

Hi Atul,

My final goal of connecting teradata from weblogic was to install OBIEE11g. What are the next steps to follow for successfull installation of 11g. When i run the RCU utility i have only three options for databases(Oracle/Sql Server/DB2). Is there any work around to get Teradata as the drop down option in RCU utility tool.

Reply
Atul says August 20, 2010

@ Ajit,
I don’t think Teradata is certified with RCU check this page for RCU certification http://www.oracle.com/technetwork/middleware/ias/downloads/fusion-requirements-100147.html#CHDJGECA

Contact Oracle Support if you need Tearadata as repository

Reply
Ajit says August 20, 2010

Atul,

Thanks for your response. I know that RCU doesn’t support Teradata. I thought there might be some workaround to connect to Teradata.

May be i need to wait for next release when Oracle will be gracious enough to support all databases rather just 3.

Once again thanks for yours response.

Ajit

Reply
Sridhar says May 5, 2011

Hi Atul

Thank you this doc is very useful

–Sridhar

Reply
» OFSAAI - Oracle Financial Services Analytical Application Infrastructure : Installation Steps Online Apps DBA: One Stop Shop for Apps DBA’s says January 10, 2012

[…] Create JDBC in domain with JNDI as jndi/FICMASTER (For steps on how to create/configure JDBC in WebLogic click here […]

Reply
liliek says February 2, 2012

Hi Atul,
i wanna ask you something bout the connection of weblogic server.
sometimes my apps get error http 500 or connection already closed. so users must refresh or logout n login again.
i think maybe it’s because the connection pool in oracle database or in oracle weblogic server that may this happen.
need advice Atul,
i’m really appreciate for your help

Rgrds

LILIEK

Reply
Atul Kumar says February 5, 2012

@ liliek,
For 500 error , you need to check application logs to find why users get this error (It is difficult to tell reason without looking at logs)

Reply
liliek says March 21, 2012

Hi atul, talking about datasource?
why you need to assign both
admin server and managed server with a datasource?
based on my knowledge, i usually assign just one managed server for one datasource.
may i know why you do that? ( assign one datasource to admin server and managed server )

what will happen if i not put admin server into datasource?

Reply
liliek says March 21, 2012

hi atul

i think because the admin server not receive request from user , managed server does. so that why i’m curious to assign admin server into datasource.

Reply
Atul Kumar says March 21, 2012

@ liliek,
JDBC needs to target to servers that have any application which needs database connection.

If you have any application like apps1 deployed on AdminServer and apps1 need database connection, you then need to target JDBC to AdminServer. If there is no application deployed on AdminServer (that requires database connection) then you don’t need to target JDBC to AdminServer.

Traget of JDBC to AdminServer in above post is just as an example and is not mandatory.

Reply
Harish Kumar Tarala says November 28, 2013

Nice tutorial.thank you Atul

Reply
uma says February 25, 2014

Hi Atul,

From where we can get/find the JNDI name to configure at the data source.

Reply
phan cuong v says February 6, 2015

following is my error:

Message icon – Error Connection test failed.
Message icon – Error IO Error: The Network Adapter could not establish the connectionoracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:743)oracle.jdbc.driver.PhysicalConnection.connect(PhysicalConnection.java:666)oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:566)weblogic.jdbc.common.internal.DataSourceUtil.testConnection0(DataSourceUtil.java:340)weblogic.jdbc.common.internal.DataSourceUtil.access$000(DataSourceUtil.java:22)weblogic.jdbc.common.internal.DataSourceUtil$1.run(DataSourceUtil.java:254)java.security.AccessController.doPrivileged(Native Method)weblogic.jdbc.common.internal.DataSourceUtil.testConnection(DataSourceUtil.java:251)com.bea.console.utils.jdbc.JDBCUtils.testConnection(JDBCUtils.java:751)com.bea.console.actions.jdbc.datasources.createjdbcdatasource.CreateJDBCDataSource.testConnectionConfiguration(CreateJDBCDataSource.java:479)sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)java.lang.reflect.Method.invoke(Method.java:606)org.apache.beehive.netui.pageflow.FlowController.invokeActionMethod(FlowController.java:870)org.apache.beehive.netui.pageflow.FlowController.getActionMethodForward(FlowController.java:809)org.apache.beehive.netui.pageflow.FlowController.internalExecute(FlowController.java:478)org.apache.beehive.netui.pageflow.PageFlowController.internalExecute(PageFlowController.java:306)org.apache.beehive.netui.pageflow.FlowController.execute(FlowController.java:336)…

Reply
kalyan says June 8, 2015

Hello sir, What is the advantage of using Multi Datasource — as of now i am using single data source for my APplication >>
If we provide multi data source what’s the parameters have to implement on wls ?? please guide me regarding..

Reply
Atul Kumar says June 8, 2015

@Kalyan,
Multi Datasource is used when you have Oracle RAC Databases, they provide high availability to database connection .

On the database side you have two database instances (both pointing to same database) , on weblogic side each datasource points to rac instance so if a instance goes down other datasource pointing to second DB instance can take care of it .

Atul

Reply
kalyan says June 23, 2015

Hello sir,
I have created 3 managed server instances in WLS 11g.In those 2 server instances having Different .war (application ) files But Assgined to same DataSource ,
serevr1 – Datasource(A)
server2 – Datasource(A)
can we give this to Practical scenario??>
is this Valid ?? please tell me ..Reply me to
‘nlkalyan.434@gmail.com”

Reply
Binh Thanh Nguyen says July 14, 2015

Thanks, nice tips

Reply
pranay says October 9, 2015

Thanks for the Dsta Source creation info.

How to find out the Multi Datasource creation date .Could any one help me on this..

Reply
    Atul Kumar says October 9, 2015

    @pranay, Not sure if you can find out creation date (just check file creation date for Data source config file at $DOMAIN_HOME/config/jdbc/

    Reply
J says October 14, 2016

I think it is important that the information they need is in the tnsnames.org file, since each network alias may have a SID or Service_Name. As, I eventually found out. Based on the SID or Service_Name will determine what Database Driver you will need to use.
If the Database Driver has a ‘word of Service’ you should use the ‘Oracle’s Driver(Thin XA) for Service connection;Versions:9.01 and later.” For Database Driver with the ‘word Instance connections’ use ‘Oracle’s Driver(Thin XA) for Instance connection;Versions:9.01 and later.”

Reply
Dhilip Ranganathan says October 18, 2016

Hello Atul,

I have an EBS R12.2 environment where the DB listener is SSL enabled. I also have a 11g SOA installation (11.1.0.7 SOA, with 10.3.6 weblogic). I am trying to configure a datasource to connect to the EBS database using the SSL listener. The EBS database is a 4 node RAC instance with SCAN listener. The JDBC thin client URL is set to use the scan listener that is ssl enabled. I am getting the below error.

<Failed to initialize the application 'XXSOAEBSDataSource_DS' due to error weblogic.application.ModuleException: .
weblogic.application.ModuleException:
at weblogic.jdbc.module.JDBCModule.prepare(JDBCModule.java:327)
at weblogic.application.internal.flow.ModuleListenerInvoker.prepare(ModuleListenerInvoker.java:199)
at weblogic.application.internal.flow.DeploymentCallbackFlow$1.next(DeploymentCallbackFlow.java:518)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
at weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:159)
Truncated. see log file for complete stacktrace
Caused By: weblogic.common.ResourceException: weblogic.common.ResourceException: Could not create pool connection. The DBMS driver exception was: IO Error: Connection reset
at weblogic.jdbc.common.internal.ConnectionEnvFactory.createResource(ConnectionEnvFactory.java:285)
at weblogic.common.resourcepool.ResourcePoolImpl.makeResources(ResourcePoolImpl.java:1322)
at weblogic.common.resourcepool.ResourcePoolImpl.makeResources(ResourcePoolImpl.java:1239)
at weblogic.common.resourcepool.ResourcePoolImpl.start(ResourcePoolImpl.java:250)
at weblogic.jdbc.common.internal.ConnectionPool.doStart(ConnectionPool.java:1330)
Truncated. see log file for complete stacktrace

Have tried to debug so far without much luck. Wanted to know if there is something obvious that I may be missing. Please advice.

Thanks,
Dhilip Ranganathan.

Reply
Kristina Mendoza says July 28, 2017

Exactly what I’ve been looking for! Thanks for sharing such guide and summary!

Reply
KaushikR says March 27, 2019

I wanted to configure/create RCU with SSL DB port. as it says invalid port. Is this something known or needs some different steps for installing RCU

Reply
Add Your Reply

Not found