Sorry wrong zone
Main Topics
Browse All Topicsjava.sql.SQLException: Data truncation: Column was set to data type implicit default; NULL supplied for NOT NULL column 'option2' at row 4
option1 in same field is of exact same type.Why is this happening? I have set sql mode to traditional and have previously updated the table including option 2.
UPDATE users SET option1 =?,option2 =?,option3 =?,option4 =?,option5 =?,option6 =?,option7 =?,option8 =?,option9 =?,option10 =?,option11 =? WHERE userName= '"+registerTeam.getUserNam
Any ideas?
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
CREATE TABLE `users` (
`User_ID` int(6) NOT NULL auto_increment,
`firstName` char(10) NOT NULL default '',
`lastName` char(10) NOT NULL default '',
`email` char(20) NOT NULL default '',
`userName` char(20) NOT NULL default '',
`password1` char(10) NOT NULL default '',
`password2` char(10) NOT NULL default '',
`option1` varchar(20) NOT NULL default '',
`option2` varchar(20) NOT NULL default '',
`option3` varchar(20) NOT NULL default '',
`option4` varchar(20) NOT NULL default '',
`option5` varchar(20) NOT NULL default '',
`option6` varchar(20) NOT NULL default '',
`option7` varchar(20) NOT NULL default '',
`option8` varchar(20) NOT NULL default '',
`option9` varchar(20) NOT NULL default '',
`option10` varchar(20) NOT NULL default '',
`option11` varchar(20) NOT NULL default '',
PRIMARY KEY (`User_ID`)
) TYPE=MyISAM;
+-------+-----------------
--------------------------
--------------------------
--------------------------
--------------------------
| users | CREATE TABLE `users` (
`User_ID` int(6) NOT NULL auto_increment,
`firstName` char(10) NOT NULL default '',
`lastName` char(10) NOT NULL default '',
`email` char(20) NOT NULL default '',
`userName` char(20) NOT NULL default '',
`password1` char(10) NOT NULL default '',
`password2` char(10) NOT NULL default '',
`option1` varchar(20) NOT NULL default '',
`option2` varchar(20) NOT NULL default '',
`option3` varchar(20) NOT NULL default '',
`option4` varchar(20) NOT NULL default '',
`option5` varchar(20) NOT NULL default '',
`option6` varchar(20) NOT NULL default '',
`option7` varchar(20) NOT NULL default '',
`option8` varchar(20) NOT NULL default '',
`option9` varchar(20) NOT NULL default '',
`option10` varchar(20) NOT NULL default '',
`option11` varchar(20) NOT NULL default '',
PRIMARY KEY (`User_ID`)
) ENGINE=MyISAM AUTO_INCREMENT=7 DEFAULT CHARSET=latin1 |
The output from printStack is
java.sql.SQLException: Data truncation: Column was set to data type implicit default; NULL supplied for NOT NULL column 'option2' at row 4
row 4 being the row holding username i need to add details to
Well - yes - I am suggesting that you prove that your validate against NULL is working.. It is just a matter of putting a System.out.println()
This is what I could come up with to recreate your error (somewhat):
mysql> create table users (`firstName` char(10) NOT NULL default '');
Query OK, 0 rows affected (0.17 sec)
mysql> insert into users values ('xxxxxxxxxxxxxx');
ERROR 1406 (22001): Data too long for column 'firstName' at row 1
mysql> insert into users values (NULL);
ERROR 1048 (23000): Column 'firstName' cannot be null
mysql> insert into users values (NULL+'xxxxxxxxxxxxx');
ERROR 1292 (22007): Truncated incorrect DOUBLE value: 'xxxxxxxxxxxxxxx'
mysql> insert into users values (1+1234567890);
Query OK, 1 row affected (0.41 sec)
mysql> insert into users values (1+12345678999);
ERROR 1406 (22001): Data too long for column 'firstName' at row 1
mysql> insert into users values (12345678999);
ERROR 1406 (22001): Data too long for column 'firstName' at row 1
mysql> insert into users values (1234567899);
Query OK, 1 row affected (0.05 sec)
mysql> insert into users values (1234567899+'aa');
ERROR 1292 (22007): Truncated incorrect DOUBLE value: 'aa'
mysql> insert into users values ('a'+1234567899+'aa');
ERROR 1292 (22007): Truncated incorrect DOUBLE value: 'aa'
mysql> select * from users;
+------------+
| firstName |
+------------+
| 1234567891 |
| 1234567899 |
+------------+
3 rows in set (0.00 sec)
mysql> update users set firstname = NULL;
ERROR 1263 (22004): Column was set to data type implicit default; NULL supplied for NOT NULL column 'firstName' at row 1
mysql>
See the last update query...... I think that is what is happening in your case.
Business Accounts
Answer for Membership
by: anokun7Posted on 2007-05-12 at 21:33:06ID: 19080309
Are you sure this is sql server? All my research pointed this to a mysql error message.
Thanks,