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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T01:17:11+00:00 2026-05-28T01:17:11+00:00

Oracle JDBC supports two distinct models for update batching: Standard Batching and Oracle Specific

  • 0

Oracle JDBC supports two distinct models for update batching: Standard Batching and Oracle Specific Batching.

According to oracle 11g JDBC Developer Guide, in any single application, you can use one model or the other, but not both. Oracle JDBC driver will throw exceptions when you mix these.

In my standalone application, the above statement does not hold true. I want to know if I am missing something.

In my application I create a OracleDataSource and do the following


    connection = datasource.getConnection();
    preparedStatement = connection.prepareStatement("update CAR set CAR_NAME=?, OBJECT_VERSION=? where CAR_ID=?");
    for(Car car : cars) {
       preparedStatement.setString(1, car.getName());
       preparedStatement.setInt(2, car.getVersion() + 1);
       preparedStatement.setLong(3, car.getId());
       preparedStatement.addBatch();
    }

System.out.println("Update Batch : " + Arrays.toString(preparedStatement.executeBatch())); for(Car car : cars) { car.setName("v car " + car.getId()); } //Oracle Update Batching connection.setAutoCommit(false); PreparedStatement preparedStatement = connection.prepareStatement("update CAR set CAR_NAME=?, OBJECT_VERSION=? where CAR_ID=?"); //Change batch size for this statement to 3 ((OraclePreparedStatement)preparedStatement).setExecuteBatch (10); for(Car car : cars) { preparedStatement.setString(1, car.getName()); preparedStatement.setInt(2, car.getVersion() + 1); preparedStatement.setLong(3, car.getId()); System.out.println("Execute Update Count " + preparedStatement.executeUpdate()); } System.out.println("Update Count : " + ((OraclePreparedStatement)preparedStatement).sendBatch()); // JDBC sends the queued request connection.commit(); preparedStatement.close();

The above code runs well and I could see both the update batches using different batching models getting executed well. Is there anything which I missed out or my interpretation of jdbc developer guide is incorrect?

Thanks in advance

  • 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-28T01:17:12+00:00Added an answer on May 28, 2026 at 1:17 am

    Yes, they write the truth 🙂
    But this aply to one instance of PreparedStatement

    I looked at decompile sources of OraclePreparedStatement:

    public void addBatch() throws SQLException {
      synchronized(connection){
        setJdbcBatchStyle();
        processCompletedBindRow(currentRank + 2, currentRank > 0 && sqlKind.isPlsqlOrCall());
        currentRank++;
      }
    }
    
    final void setJdbcBatchStyle() throws SQLException {
      if(m_batchStyle == 1){
            SQLException sqlexception =    DatabaseError.createSqlException(getConnectionDuringExceptionHandling(), 90, "operation cannot be mixed with Oracle-style batching");
            sqlexception.fillInStackTrace();
            throw sqlexception;
        } else{
            m_batchStyle = 2;
            return;
        }
    }
    

    So, they realy check mixing of batch modes for instance of OraclePreparedStatement

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

Sidebar

Related Questions

I suddenly noticed that Oracle JDBC driver that I was using With Oracle 11g
I have DAO code which contains some JDBC with Oracle-specific syntax, for example: select
I'm using Oracle's ojdbc5.jar and noticed that it includes two JDBC driver classes. What
I have a weird problem where two web apps with Oracle JDBC driver will
Oracle JDBC connection with Weblogic 10 datasource mapping, giving problem java.sql.SQLException: Closed Connection I
I want to add the oracle jdbc driver to my project as dependency (runtime
I am using Oracle 9 JDBC Thin Driver - the connection string I have
When connecting to Oracle the JDBC driver identifies itself as JDBC Thin Client to
I am using Oracle 9 and JDBC and would like to encyrpt a clob
How do I check for an open connection in jdbc for oracle database? Note:

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.