Saturday, 15 September 2012

java - Intermittent state of executing multiple queries using a Statement object -


I am performing several SQL statements using single connections and statement objects as two processes.

  • Pre-Process (Preprocess. Java)
  • Post Processes (Post Processes. Java)
  • My procedure steps are as follows:

    1. During performing the expected SQL statement using the statement object created during the pre-process.
    2. Creating a Contribution Object and Set Auto Comit ()
    3. Then I pass the same Statement Object and execute the required SQL Statement for the post process.
    4. Finally close the transaction ( connection.commit (); ) and close Connection, Statement Objects.

    My problem is this:

    Sometimes the post execution statements are not reflected in the database that is, if I include any records in post-processing Or update, they are not available in the records database.

    But post-process execution is working fine without exception.

    The probability of this case is out of 1/5 (which means that I used to expect 4x work but its problematic 1 time).

    Can anyone tell any problem?

    I am using Jdk 1.7 and Postgresql version 9.3.


    No comments:

    Post a Comment