Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7954169
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T03:20:45+00:00 2026-06-04T03:20:45+00:00

I am getting a Oracle JDBC connection from a connection pool using a data

  • 0

I am getting a Oracle JDBC connection from a connection pool using a data source object.
And using the connection to insert some logs into DB from java (via java static method).
Since there will be around 10 to 20 inserts per user, what I am doing is, I am commiting the connection at request level in Filter and closing the connection at session level (via Session Listener’s sessionDestroyed() method)
I did not get any error in testing but in production environment, I am getting few error as follows,

java.sql.SQLException: execute, Exception = null (one scenario)
java.sql.SQLException: close, Exception = null (for another scenario)

How to avoid these errors? Can I instead commit and close the connection in java static method, instead of commiting at request level and closing at session level?

But what amuses me is that, those errors are occuring inspite of having the below logic in my java static method,

if (con.isClosed() || con == null) {
 DBConnectionHelper connHelper = DBConnectionHelper.createInstance();
    con=connHelper.getConnection("ds");
    con.setAutoCommit(false);
}

So I am checking for the above, and so there is no way connection can be closed when I am trying for execute, am I right?
But not sure and confused why its occuring.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T03:20:47+00:00Added an answer on June 4, 2026 at 3:20 am

    I’m guessing your con object is null?

    Consider the following block:

    if (con.isClosed() || con == null) {
     DBConnectionHelper connHelper = DBConnectionHelper.createInstance();
        con=connHelper.getConnection("ds");
        con.setAutoCommit(false);
    }
    

    First you ask if the connection is closed. Then you see if its null. If con really is null, you will get a NullpointerException.

    Switch the checks and see if it helps anything 🙂

    if (con == null || con.isClosed()) {
     DBConnectionHelper connHelper = DBConnectionHelper.createInstance();
        con=connHelper.getConnection("ds");
        con.setAutoCommit(false);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am getting the following error when inserting data into my oracle database. java.sql.SQLException:
Reasons for java.sql.SQLException: Closed Connection from Oracle?? java.sql.SQLException: Closed Connection at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112) at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146)
I am getting the following error: java.sql.SQLException: Exhausted Resultset at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134) at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179) at
I'm trying to understand different ways of getting table data from Oracle stored procedures
I'm getting the following excpetion: java.sql.SQLException: Protocol violation at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:145) at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:190) at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:286)
We have been getting this Oracle connection pool exception a lot recently for our
I am using Spring JdbcTemplate/SimpleJdbcTemplate in combination with an Oracle datasource (oracle.jdbc.pool.OracleDataSource) via JNDI
I'm currently wrestling with an Oracle SQL DATE conversion problem using iBATIS from Java.
I'm trying to do some basic queries using the groovy.sql.Sql object, and I'm getting
I am able to connect to Oracle 10g (using ojdbc14.jar driver) with java. But

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.