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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T21:13:28+00:00 2026-06-04T21:13:28+00:00

If I create a preparedstatement using a JDBC connection which has autocommit off, do

  • 0

If I create a preparedstatement using a JDBC connection which has “autocommit off”, do I need to call commit() to make the transaction permanent or only the prepare call is enough? Note that I only want to prepare a statement and keep it for later execution.

Many thanks!

  • 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-04T21:13:29+00:00Added an answer on June 4, 2026 at 9:13 pm

    The answer is: yes you have to call commit.

    The “prepare” step does not do anything that is relevant for transaction handling on the server.

    You have to call executeUpdate() (or execute()) to start a transaction (assuming the used SQL does in fact start a transaction)

    Using a PreparedStatement without auto-commit requires the following steps:

    1. Prepare the statement
    2. Set the parameter values
    3. call executeUpdate() (or execute() depending on the type of statement)
    4. call Connection.commit()

    To make things clearer: calling prepareStatement() does not require a commit().

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

Sidebar

Related Questions

I am using Play! framework 1.2.4 and I have a question regarding JDBC connection.
I'm using JDBC for very simple database connectivity. I have created my connection/statement and
When I create a prepared statement like this in java (using JDBC): pStmt =
I have to create an index on a field of a table using PreparedStatement.
I have a JDBC connection to an Oracle database. I create a Statement. The
I have a jdbc code in which I have used transaction management in code.
Create facebook app Using a cURL to post a message from an App but
I want to create a login page using Servlet & JSP. I ve created
I'm using the JDBC template and want to read from a database using prepared
I was going to try using JDBC and an sqlite driver to save information

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.