开发者

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

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" e开发者_JAVA百科ncoding="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?


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> 


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜