New mysql server doesn’t take blank field through JSP code.
If you write this code in jsp it will show error.
<%
String sqlInsertDateIntoTable = “insert into TableName values( “”, ‘”+request.getParameter(“inputFieldName”)+”’,’”+request.getParameter(“inputFieldName2”)+”’,’’)”;
stm.executeUpdate(sqlInsertDateIntoTable);
%>
This code shows error , But in old alpha version of mysql allow the blank field for autoincreaments.
Error shows of “Data truncation“
This can be easily remove by just write or add or table values in your query
e.g
<%
String sqlInsertDateIntoTable = “insert into TableName (Name,Address) values(‘”+request.getParameter(“inputFieldName”)+”’,’”+request.getParameter(“inputFieldName2”)+”’)”;
stm.executeUpdate(sqlInsertDateIntoTable);
%>
This code will save u from data trancation error and allow empty or default value of table in Mysql server
Autoincreament done automatically by Mysql and other blank field automatically taken default value given in the table.
| |
|
Welcome to AstaHost - Dear Guest | |



