0

Oracle JDBC connection with Weblogic 10 datasource mapping, giving problem java.sql.SQLException: Closed Connection

I am using weblogic 10 JNDI datasource to create JDBC connections, below is my config

<?xml version="1.0" encoding="UTF-8"?>
<jdbc-data-source xmlns="http://www.bea.com/ns/weblogic/90" xmlns:sec="http://www.bea.com/ns/weblogic/90/security" xmlns:wls="http://www.bea.com/ns/weblogic/90/security/wls" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.bea.com/ns/weblogic/920 http://www.bea.com/ns/weblogic/920.xsd">
  <name>XL-Reference-DS</name>
  <jdbc-driver-params>
    <url>jdbc:oracle:oci:@abc.XL.COM</url>
    <driver-name>oracle.jdbc.driver.OracleDriver</driver-name>
    <properties>
      <property>
        <name>user</name>
        <value>DEV_260908</value>
      </property>
      <property>
        <name>password</name>
        <value>password</value>
      </property> 
      <property>
        <name>dll</name>
        <value>ocijdbc10</value>
      </property>
      <property>
        <name>protocol</name>
        <value>oci</value>
      </property> 
      <property>
        <name>oracle.jdbc.V8Compatible</name>
        <value>true</value>
      </property>
      <property>
        <name>baseDriverClass</name>
        <value>oracle.jdbc.driver.OracleDriver</value>
      </property>
    </properties>
  </jdbc-driver-params>
  <jdbc-connection-pool-params>
    <initial-capacity>1</initial-capacity>
    <max-capacity>100</max-capacity>
    <capacity-increment>1</capacity-increment>
    <test-connections-on-reserve>true</test-connections-on-reserve>
    <test-table-name>SQL SELECT 1 FROM DUAL</test-table-name>
  </jdbc-connection-pool-params>
  <jdbc-data-source-params>
    <jndi-name>ReferenceData</jndi-name>
    <global-transactions-protocol>OnePhaseCommit</global-transactions-protocol>
  </jdbc-data-source-params>
</jdbc-data-source>

When I run a bulk task where there are lots of connections made and closed, sometimes it gives connection closed exception for any of the task in the bulk task.

Below is detailed exception'

java.sql.SQLException: Closed Connection
 at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:111)
 at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:145)
 at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:207)
 at oracle.jdbc.driver.OracleStatement.ensureOpen(OracleStatement.java:3512)
 at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3265)
 at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:3367)

Any ideas?

1
  • 1
    Assuming some connections are working, it's probably not a config problem. Could be the code of your bulk task - is it not running through a single block of opening and closing connections? Commented Mar 15, 2010 at 9:00

2 Answers 2

2

You can change <global-transactions-protocol> parameter to none and execute the code:

<jdbc-data-source-params>
    <jndi-name>ReferenceData</jndi-name>
    <global-transactions-protocol>none</global-transactions-protocol>
</jdbc-data-source-params> 
Sign up to request clarification or add additional context in comments.

Comments

0

Problem was due to connection sharing across code.... bad programming.... :( corrected it.... thanks

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.