I use the MySQL database and the Tomcat 4.1.18 web server. I try to insert a record to a table message_thread in the MySQL database. The first column of that table is for the ID of each recored. I created that column (field) with INTEGER AUTO_INCREMENT. Therefore, I did not mention that field in the method that inserts records. I got an internal server error and the root cause is:
[ January 05, 2004: Message edited by: JiaPei Jen ]
try changing "stmt.execute();" to "stmt.executeUpdate();". Small difference, but I've seen some driver implementations flub the execute method. Besides, you're doing an insert anyways, so use the appropriate executeUpdate method! This may not be the cause, but it's an easy check. Jamie
Joined: Nov 19, 2000
I have changed the statement to:
The error message is the same. Let me ask this -- if we try to insert a null into a field that is defined as "NOT NULL", will we get an error message saying "trying to insert a null value into a field that is not supposed to be a null"? or an exception is thrown to us like what I got?
just check in the database whether to the field u r entering the null value is a not null field like it might be declared as a primary key, just check this thing, just intimate if it is solved prior. thnx bhramaresh
subject: What Would Cause A Method That Inserts Records To Throw An Exception?