db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <de...@segel.com>
Subject RE: ClassFormatError while performing a SQL insert
Date Thu, 07 Sep 2006 17:25:16 GMT


> -----Original Message-----
> From: Leslie Software [mailto:lesliesoftware@yahoo.com]
> Sent: Thursday, September 07, 2006 12:07 PM
> To: Derby Discussion
> Subject: Re: ClassFormatError while performing a SQL insert
> 
> Iteresting.  I though that was a strange error to be getting when running
> SQL.  Does that mean that Derby is generating Java code from the SQL to do
> the actual work?
> 
> Ian
> 
No.
It means that your java code has a method that is longer than 64K.
Note: It's not the class but the method which is limited to the 64K.

I think Daniel pointed you in the right direction. That is, that you should
consider using a prepared statement to perform the insert in a loop.

Looking back at your initial post, it looks like you're hard coding the
insert manually in your code. That is to say, with all of your data manually
hardwired in to the method, the method exceeds 64KB in length.

This is *not* a good idea. (Imagine if you need to change a value being
inserted. You'll then have to open up the source code, modify and then
recompile.)

Just a simple suggestion, you may want to consider putting your values in to
a character delimited flat file. Then in your code, you open the file, read
line by line in to a buffer, parse the buffer and insert the data via a
prepared statement.

Note: if you use commas to separate your fields, you'll have to track your
quotations. Try using a '|' (pipe character) as your delimeter.

Its just a suggestion which will make your code a tad easier to maintain.

But hey! What do I know? ;-)

-G


> ----- Original Message ----
> From: Bryan Pendleton <bpendleton@amberpoint.com>
> 
> > java.lang.ClassFormatError: Invalid method Code length 69936 in class
> 
> There is a hard limit in the JDK class-file format of 64K, and there are
> some known issues in Derby which can cause the generated code to exceed
> these limits.
> 
> <snip>
> 
> 




Mime
View raw message