i need to design few servlets and jsp's for login and register of user.
i want to know one thing, should i use callable statement for this, i tried to read it via google, but failed to get anything for "when to use callable statement".
i m doing this only for my learning exercise. most of the times i used statement and prepared statement for this, but now i think to use callable statement just for learning, should i use, any good reason why to use??
You'll use CallableStatement when you're invoking a stored function which returns a value, or stored function or procedure which uses OUT parameters. The CallableStatement interface provides methods to register the output parameters with their proper type and obtain their value after execution.
No, there is no advantage as far as I know. Both of these handle bind variables (the parameters) in the same way and therefore provide the exact same protection from SQL injection attacks. (That is, when you use them correctly. It is still possible to be subject to SQL injection if you use PreparedStatement or CallableStatement and just stuff in parameters by String concatenation.)