Announcement Announcement Module
Collapse
No announcement yet.
Spring batch- Postgresql prepared statement error Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring batch- Postgresql prepared statement error

    Hi,
    In my use case I have to insert information in postgresql tables.I am using the ibatis to insert to tables, but when I am trying to run the job, I am getting prepared statement error(ERROR: prepared statement "S_1" already exists). I tried to google out the answer and found there is an issue in Postgresql driver, but it is suggested in one of the link to deallocate the previous prepared statement, but I could not find the how to implement the deallocation through batch. Any help would be appreciated.

    EDIT:The version of Batch I am using is 2.0.4

    Thanks
    Vishal
    Last edited by vishalravishankar; Mar 15th, 2013, 01:49 PM. Reason: additional information

  • #2
    What ItemWriter are you using for this?

    Comment


    • #3
      Originally posted by mminella View Post
      What ItemWriter are you using for this?
      I am using IbatisBatchItemWriter.

      Comment


      • #4
        After some googling, this seems to be a postgres issue. Are you using the PgBouncer connection pool (or can you post your configuration)? If so, this post seems to be in line with your issue: http://stackoverflow.com/questions/7...already-exists

        Comment


        • #5
          Yes, its the same issue as mentioned in the link.is there any way out from spring batch where we can manage connection in batch instead from postgresql.

          Comment


          • #6
            We definitely don't want to get into mucking with connections under iBatis. My advice would be to either use a different connection pool that supports prepared statements or go to session pooling. Session pooling may be ok in batch since we open one session per call to the itemWriter (essentially honoring the same boundaries as transaction pooling would) but I'll admit I haven't tried it.

            The Wiki page for PgBouncer states that the connection pool does not support prepared statements in transaction pooling mode: http://wiki.postgresql.org/wiki/PgBouncer

            Comment

            Working...
            X