Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » BatchUpdateException: invalid batch command: invalid SELECT batch command 0 (What is the cause of BatchUpdateException: invalid batch command: invalid SELECT batch command 0 )
BatchUpdateException: invalid batch command: invalid SELECT batch command 0 [message #546353] Mon, 12 July 2010 10:20 Go to next message
muralirama  is currently offline muralirama
Messages: 6
Registered: July 2010
Junior Member
Hi,
I would like to post a question on Eclipselink. Using Eclipsllink and Oracle weblogic app server we get every now and then (but not always) following error during some object updates by Eclipselink. Could somebody tell if there is any configuration or data issue that could cause this kind of error? Since there is no direct sql query update used and this is not always happening there is nothing suspect on the update query itself. I could see that Eclipselink does batch update when many fields of an object is updated where this error is thrown. Once this error is thrown then no other updates woirk in the application unless the application (app server) is restarted. Could someone please answer this question or direct me to procedure where I could post and get answer?

Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.0.0.v20091127-r5931): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.BatchUpdateException: invalid batch command: invalid SELECT batch command 0
Error Code: 17080
Query: UpdateObjectQuery(some.package.dao.toplink.FsrShortFormImpl@5030ba9)
at weblogic.ejb.container.internal.EJBRuntimeUtils.throwTransac tionRolledback(EJBRuntimeUtils.java:200)
at weblogic.ejb.container.internal.EJBRuntimeUtils.throwRemoteE xception(EJBRuntimeUtils.java:93)
at weblogic.ejb.container.internal.BaseRemoteObject.postInvoke1 (BaseRemoteObject.java:659)
at weblogic.ejb.container.internal.StatelessRemoteObject.postIn voke1(StatelessRemoteObject.java:60)
at weblogic.ejb.container.internal.BaseRemoteObject.postInvokeT xRetry(BaseRemoteObject.java:441)
at some.package.sf269.Sf269ServiceEJB_ojxlf1_EOImpl.processFSRU pdate(Sf269ServiceEJB_ojxlf1_EOImpl.java:506)
... 36 more
Caused by: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.0.0.v20091127-r5931): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.BatchUpdateException: invalid batch command: invalid SELECT batch command 0
Error Code: 17080
Query: UpdateObjectQuery(some.package.dao.toplink.FsrShortFormImpl@5030ba9)

Thanks
- murali
Re: BatchUpdateException: invalid batch command: invalid SELECT batch command 0 [message #546388 is a reply to message #546353] Mon, 12 July 2010 11:40 Go to previous messageGo to next message
James Sutherland is currently offline James Sutherland
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

This error is being thrown from you database or JDBC driver, what database are you using?

It seems you are using batch writing, your driver/database may have an issue with this, try turning batch writing off.

Please also include the log of the transaction before the exception occurs.


James : Wiki : Book : Blog : Twitter
Re: BatchUpdateException: invalid batch command: invalid SELECT batch command 0 [message #546412 is a reply to message #546388] Mon, 12 July 2010 12:55 Go to previous messageGo to next message
muralirama  is currently offline muralirama
Messages: 6
Registered: July 2010
Junior Member
James,
Thanks for the response. Oracle 11g2 is the database used and for persistance eclipselink is used. Nothing is done to set the update as batch update in the code but the eclipselink does the batch update when a persistant object is updated in the code. I would like to know where (jn which config file) to disable batch update in eclipselink. I could not find any file persistance.xml and is there any file where the configuration setting (like which file to look for the configuration mapping for batch update etc) is done? Also I thought batch update is an efficient way to do update instead of making DB call for each field update in an object right? If that is the case why do we want to disable that feature. Also I had seen in online postings that Eclipselink takes care of synchronizing issue and will prevent a Select query executed while an update is in progress. If that is the case then how could the 'BatchUpdateException' happen?
Thanks
- murali
Re: BatchUpdateException: invalid batch command: invalid SELECT batch command 0 [message #547143 is a reply to message #546353] Thu, 15 July 2010 12:51 Go to previous messageGo to next message
James Sutherland is currently offline James Sutherland
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

Batch writing is off by default, so if it is being used, you have configured it somwhere. Check your persistence.xml or SessionCustomizer.

Batch writing should work with Oracle 11g2, are you using the correct JDBC driver version for your database version? Are you using thin or oci?

Please include the full exception stack trace including the caused by, and the log on finest of the transaction. Also include your persistence.xml, or if not using JPA, your sessions.xml or other configuration.



James : Wiki : Book : Blog : Twitter
Re: BatchUpdateException: invalid batch command: invalid SELECT batch command 0 [message #547162 is a reply to message #547143] Thu, 15 July 2010 14:10 Go to previous messageGo to next message
muralirama  is currently offline muralirama
Messages: 6
Registered: July 2010
Junior Member
James,
We use RAC driver as that is the configuration in production (unix). I could not post everything (like complete stack, files) due to the nature of this project. I found that in our code by default we do not turn on bacth writing but through code in one class we turn it on when some functionality is executed. Once that functionality is executed (through user interaction on GUI) the batch writing is enabled and stays on until server is restarted. From that point onwards calling some specific updates (using Eclipselink) on objects throws BatchUpdateException. Since I am able to reproduce the issue on my windows machine now I tried debugging by setting breakpoints in the method that throws this exception. Unfortunatley as it is in Eclipselink level, I could not probe deep in to find what actually causes this exception. Do you know if Eclipselink (or Toplink) persisitance mechanism require something else to be set or taken care during object updates with batch write enabled?
Thanks
- murali
Re: BatchUpdateException: invalid batch command: invalid SELECT batch command 0 [message #550831 is a reply to message #547162] Wed, 04 August 2010 09:23 Go to previous message
James Sutherland is currently offline James Sutherland
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

The error seems to be a database/driver issue.

Without the full stack trace there is little more I can do.

If you are turning batch writing on for just one process, it is odd that you do not turn it back off when that process is done.

Check your SQL and see if the error is a valid error, i.e. the database should have thrown an error for one of the SQL's in the batch.

You could try resetting the JDBC connection or connection pool when the error occurs to attempt to avoid the error reoccurring.


James : Wiki : Book : Blog : Twitter
Previous Topic:EclipseLink 2.1 Upgrade failure
Next Topic:Existing managed object being inserted
Goto Forum:
  


Current Time: Thu Apr 17 14:31:35 EDT 2014

Powered by FUDForum. Page generated in 0.03765 seconds