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 7014845
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T22:34:27+00:00 2026-05-27T22:34:27+00:00

I have a oracle stored proc that needs to be called from my Java

  • 0

I have a oracle stored proc that needs to be called from my Java program. I had used CallableStatement to pass parameters to the stored proc. I am using oracle thin driver (configured in web logic server against the relevant jndi entry).This stored proc does not have any OUT values. This stored proc accepts a numeric value and does a lot of updates in the db based on the value received.

I get a connection object and then call this stored proc in loop (20 times for passing 20 numbers). When I directly call this stored proc from an oracle client , the execution gets completed in 2-3 seconds. However the behaviour is not predictable from my java code. Some of the calls take even 30-40 seconds to get completed.

I tried to use PreparedStatement instead of CallableStatement and could see marginal performance improvement (though the behaviour is still inconsistent).

  1. Is it OK in my case to use PreparedStatement instead of CallableStatement given that the storedproc does not have any OUT parameters?
  2. Is there any reason why PreparedStatement has some performance gain over CallableStatement or is it something that I might have observed incorrectly?
  3. Is there a better approach for solving this performance issue?
  • 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-05-27T22:34:28+00:00Added an answer on May 27, 2026 at 10:34 pm

    From your comment, you have prepareCall inside your loop. An advantage of prepared statements (and callable statements) is that you can prepare it once, and then swap out the values passed in the parameters; there is overhead each time the call is prepared, so if you could bring that outside of your loop, you may find that run time decreases. You may find that turning off AutoCommit also helps, as there is overhead with each commit.

    conn.setAutoCommit(false);
    CallableStatement stmt = conn.prepareCall(sql);
    while(true) {
        stmt.setInt(1, value);
        stmt.execute();
    }
    conn.commit();
    conn.setAutoCommit(true);
    

    (conn.setAutoCommit(true) does commit, but I find it clearer to be explicit).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have to improve some code where an Oracle stored procedure is called from
I have one oracle stored proc that will select customers based on a condition
I have a Java Program that will import data from a DB2 table to
I have a VB.Net function which executes a Oracle Stored Proc and returns a
I have the following iBatis mapping for an Oracle Stored Procedure that returns a
I have a .net web application that makes heavy use of oracle stored procedures.
I have a bit of .NET code that retrieves the results from an Oracle
I have an Oracle stored procedure that returns a BLOB in an output parameter:
We have an Oracle database that contains IP addresses stored as decimal integers -
I'm trying to call an Oracle stored procedure that accepts no input parameters. However,

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.