Does JDBC Prepared statement have benefits with MySQL
Posted by: Mike Connell
Date: July 28, 2005 06:08PM

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

Options: ReplyQuote


Subject
Written By
Posted
Does JDBC Prepared statement have benefits with MySQL
July 28, 2005 06:08PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.