Jay SenSharma

Jay SenSharma

Are you facing JDBC related issues in your WebLogic Environment the Please Keep the following tips always in mind.

Point-1). Set the Maximum Capacity of the connection pool at least equal to the Execute Thread Count.

Point-2). Configure Inactive Connection Timeout to specify how long (in seconds) a connection can be inactive before it is reclaimed to the pool.

Point-3). The connection leak profiling option shows leaked connections from the connection pool. BEA recommends that you do not use this option in production; it uses extra resources and typically slows connectionpool operations.

Point-4). If possible, size database connection pools so that they never increase the number of connections: set Initial Capacity equal to Maximum Capacity.

Point-5). Use Test Reserved Connections only if you can afford the overhead of testing connections as part of normal request processing.

Point-6). Avoid using a production table for “Test Table Name”, use a dummy table (ex. dual).

Point-7). Use the statement cache to improve performance of prepared and callable statements.

Point-8). Select the least-recently-used (LRU) algorithm for the cache; this removes rarely-used statements from the cache.

Point-9). Connection Creation Retry Frequency can be used to retry for establishing connections to the database, if database is not reachable when creating connection pool or starting WebLogic Server.

Point-10). If database is restarted when WebLogic Server is running, Test Frequency can be increased from 0, so that all the connections are closed and reopened to re-establish valid physical connection. After all the connections are recreated changing it back to 0 will disable the testing.

Point-11). When using DataSource objects for a connection pool, use the Honors Global Transaction option to create a TxDataSource.

Point-12). The only time you should use a non-Tx Data Source is when you want to do some work on the database that you do not want to include in the current transaction.

Point-13). When configuring a connection pool to use with WebLogic JMS JDBC Store, use non-XA database drivers.

Point-14). Always close the ResultSet, Statement and Connection objects insode the finally{} Block in the following order:

try {
        // YOUR JDBC Code here
    } finally {
            try { 
                  if(resultSet != null) 
            } catch(Exception e) {

            try { 
                  if(statement != null) 
            } catch(Exception e) {

            try { 
                  if(connection != null) 
            } catch(Exception e) {


Use the following command to make sure that you are able to connect to the DataBase Box from the WLS Server Box…

Step1). Add JDBC Driver also in the Classpath or Better run “setWLSEnv.sh”

Step2). Use WLS DB Ping utility:

java -classpath /bea103/wl_server103/server/lib/weblogic.jar utils.dbping ORACLE_THIN <dbUserName> <dbPasswoes> <dbURL>


java -classpath /bea103/wl_server103/server/lib/weblogic.jar utils.dbping ORACLE_THIN scott tiger databaseHostName:1521:P15215h

While using WLST/JMX to get Connection from DatSource if you get the Following Exception:

java.lang.UnsupportedOperationException: java.lang.UnsupportedOperationException: Remote JDBC disabled

Then Please Add the Following JAVA_OPTION in your Servers StartScript:


Example WLST Script to Get Connection from WLS DataSource:

uname = "weblogic"
pwd = "weblogic1"
url = "t3://localhost:7101"

def diagnoseWebConfig(object) :

from java.sql import *
from javax.sql import *
from javax.naming import *
from java.util import *

connect(uname, pwd, url)
JNDI_FACTORY = "weblogic.jndi.WLInitialContextFactory"
serverUrl ="t3://localhost:7001"

env = Hashtable()
env.put(Context.PROVIDER_URL, serverUrl)
ic = InitialContext(env)

print "nt Got Connection From TestDS : "+con

if __name__== "main":

Jay SenSharma

If you enjoyed this post, please consider leaving a comment or subscribing to the RSS feed to have future articles delivered to your feed reader.