Jump to content
xisto Community
Sign in to follow this  
welcome77in

New MySQL Server & Blank Fields Problem With Jsp empty fields and data trancation error

Recommended Posts

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 querye.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 serverAutoincreament done automatically by Mysql and other blank field automatically taken default value given in the table.

Edited by miCRoSCoPiC^eaRthLinG (see edit history)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.