views:

225

answers:

4

I'm gettting the following exception when performing an insert to an Oracle Databse using JDBC.

java.sql.SQLRecoverableException: Io exception: Unexpected packet

What could cause this and how can I recover from it?

The application I'm writing performs an aweful lot of updates the the databse in rapid succession. Judging from the exception I'd assume it's a network issue, however the Database is on the same box as my Application.

I don't have a stack trace and this is one of those irritating "Works on my machine" problems" where it Borks when I put it on a client site.

Unfortunately I've got to throw together something that will fix this/diagnose but the client site only throws data to my app between 5pm and 9 pm when I'm out of the office...

I've got a few hours to work out my contingencies though...

Any thoughts.

Problem solved:

It was a synchronization issue.

+4  A: 

Are you per any chance using multiple threads and forgot synchronization?

Bombe
yes, probably. I'll see if that's the root cause.
Omar Kooheji
+1  A: 

Sounds like a driver problem, is there an updated driver for the server version you're using? Also, make sure you don't have older versions of the ojdbc jar in your classpath.

Jason Day
A: 

Any unclosed cursors/resultssets?

aldrinleal
There are no result sets, it's an insert only system. Another system recives the data... assuming it ever gets there... :(
Omar Kooheji
A: 

How many inserts in a batch?

Under some conditions, its advisable to have a commit-threshold in a transaction. If you're doing transactions, you should keep aware of that.

btw, any stack traces?

aldrinleal