aspose file tools*
The moose likes JDBC and the fly likes MySQL will only accept the first 256 inserts? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "MySQL will only accept the first 256 inserts?" Watch "MySQL will only accept the first 256 inserts?" New topic
Author

MySQL will only accept the first 256 inserts?

Shawn Glisson
Greenhorn

Joined: Feb 13, 2004
Posts: 6
I am attempting to insert over 2000 rows to MySQL. My code all works correctly but from the 2300 inserts, only the first 256 inserts get saved into my table.
Is this a MySQL issue?
I am testing on WinXP Pro, with MySQL 3.23 using connector-J as the driver.
oh and my table is of type MyISAM.
please help
thanks
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30753
    
156

Shawn,
Perhaps the logs are getting full? Try doing a commit after 200 records and then continuing.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Actually, I would imagine that possibly you have an auto-incrementing field who's data type is set to a tiny int which only allows a signed range of -128 to 127 and an unsigned range of 0 to 255. Therfor you are only allowing 256 records to be entered into the table.


GenRocket - Experts at Building Test Data
Shawn Glisson
Greenhorn

Joined: Feb 13, 2004
Posts: 6
I have tried to committhe inserts and no gold. Also my data types for the table i am inserting to consist of 4 chars and 1 decimal(10,2).
I am not sure what the problems is. Is it possible that an array in java can hold no more than 256 elements?
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Originally posted by Shawn Glisson:
I have tried to committhe inserts and no gold. Also my data types for the table i am inserting to consist of 4 chars and 1 decimal(10,2).
I am not sure what the problems is. Is it possible that an array in java can hold no more than 256 elements?

1. Do you have an autoincrementing field?
2. What is it's data type?
Adrian Yan
Ranch Hand

Joined: Oct 02, 2000
Posts: 688
Did you see any error in your log file? Your mysql.log will show the actually sql you are running again. See anything that's out of the ordinary.
If you get an error, please copy and patste to the message.
Shawn Glisson
Greenhorn

Joined: Feb 13, 2004
Posts: 6
I have determined that the problem is not with the db. From a jsp page I call a static method in a seperate class that receives an integer. The integers value is 2373. Here is the static method...

Now when I use the variable as the index for the arrays I only end up with 256 records instead of the 2373 that I need.
BUT
If I replace the variable with a number like 2000, then I get all 2373 records into the table. Of course they are all the same record but it still goes through the loop the necessary amount of times.
Mr. C Lamont Gilbert
Ranch Hand

Joined: Oct 05, 2001
Posts: 1170

Try closing the statement after you execute the update. Otherwise the statement will not close till the garbage collector collects the object. Which it wont any time soon.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: MySQL will only accept the first 256 inserts?