Re: Dynamic Sql Statement in SP
Ming Yeung wrote:
> Thanks for reminding me again, I think I will
> create a java function to check all IN-parameters
mm, I gueass I'd just use the earlier suggestion (? style parameters in the statement string, EXECUTE ... USING @p1,@p2 etc)
This way, it will still work when you backport your app to php again ;-)
Seriously, you should make as much effort as you can do to make the procedure self-contained. It should not matter from what context the procedure is called, and applications should not worry about how to escape parameter values. After all, it's the procedure's parameters so it's the procedure's problem. Well then, the procedure should solve it's own problem.
> My Environment:
> - Win 2003
> - mysql-5.0.16-win32
> - Tomcat 5.5.12
> - MyEclipse -> Struts/Servlet
> - J2EE 1.4 SDK & jre1.5.0_06
> - mysql-connector-java-3.1.12
> - Jakarta DBCP
Thanks! I will test for a bit with this DBCP bit (that's the connection pooling stuff right?)
> I'm actually so glad to see MySql's new
> baby(Stored Procedure). I understand I should use
> SP instead of just writting plain Sql statements
> in Java/Php,etc. I hope SP of MySql will get more
> more stable in the next versions...
Me too. SP's are very good for stuff thats shared between apps (code reuse). Also performance might be a consideration: a sequence of database tasks are probably executed more efficiently when this is done on only the serverside, without having the network overhead of sending commands and receiving results/acknowledgements.
CU, good luck