Does JDBC Prepared statement have benefits with MySQL
Hi,
This is a repost from the MyISAM forum. Trying to determine if JDBC
passes statement variables thru to MySQL or not (maybe a setting??).
Examples of Prepared statement useage - case 1, and not - case 2...
<begin
case 1
-------
select token_id, amount from token where account_id = ':variable';
set :variable = '1234', execute, fetch results, and process.
select token_id, amount from token where account_id = ':variable';
set :variable = '5678', execute, fetch results, and process.
case 2
-------
select token_id, amount from token where account_id = '1234';
execute, fetch results, and process.
select token_id, amount from token where account_id = '5678'
execute, fetch results, and process.
end>
in case 1 the JDBC ":variable" is substituted with the value so the statement doesn't have to
be reprepared. I do not think with MyISAM there is savings using case1 vs case2.
Can anyone address this authoritately as to if Prepared statements actually make it
down to MySQL in JDBC? Thanks