Meaningless Drivel is fun!*
The moose likes JDBC and the fly likes Data mapping problems ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Data mapping problems ?" Watch "Data mapping problems ?" New topic
Author

Data mapping problems ?

Jennifer Sohl
Ranch Hand

Joined: Feb 28, 2001
Posts: 455
Hi. I am having a problem updating a file on our AS/400. I am connecting to our AS/400 via JDBC (V3R2 400). My problem is, in my application, I have numerous fields that the user can enter information into. The user is not required to enter info into every field( ie.. not every vendor has a minimum order amount). Right now, I am taking the value of whatever is in the fields and updating the 400 with that info. However, if the user does not key something into a field (like minimum order amount) then I get an error message "SQL0407 - Null value is not allowed for field PCVMIN in table PCVEND".
I want the user to not have to key information into this field, and be able to update the 400 without getting this error message!
What do I need to do? (Min order is a numeric field).
Any help is greatly appreciated. (I am using VA for Java 3.5.3 if that makes any difference).
Thanks in advance!

Jamie Robertson
Ranch Hand

Joined: Jul 09, 2001
Posts: 1879

why don't you set a default value, or allow null in the database field? It sounds like you are violating a database constraint of "NOT NULL"
Jamie
Jennifer Sohl
Ranch Hand

Joined: Feb 28, 2001
Posts: 455
Thanks for the reply. If I set the database field to ALWNULL...
I get an error message when trying to run an update program on the AS/400 that tells me a data mapping error has occurred, and an unexpected null value was found.
( I had to write a program to output zeros into numeric fields that had blanks in some of our old records).
Any other suggestions?
Fred Abbot
Ranch Hand

Joined: Jun 01, 2000
Posts: 300
make a default value for the fields
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Data mapping problems ?
 
Similar Threads
Struts validation
JTextFields not allowing entry?
Problem with null field
Limiting the length of text in JTable column
Getting "Password can not be less than 6 characters" error message even i enter more than 6 chars