Jump to content



Welcome to AstaHost - Dear Guest , Please Register here to get Your own website. - Ask a Question / Express Opinion / Reply w/o Sign-Up!

Replying to New MySQL Server & Blank Fields Problem With Jsp


Post Options

    • Can't make it out? Click here to generate a new image

  or Cancel


Topic Summary

sendto

Posted 03 January 2006 - 03:40 PM

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.

Review the complete topic (launches new window)