Home » Performance » MySQL » prepared statements in MySQL
prepared statements in MySQL [message #1959] Fri, 28 September 2007 15:02 Go to next message
mikec  is currently offline mikec
Messages: 22
Registered: September 2007
Junior Member
Is there any advantage to using prepared statements in Java for DML in the following
scenario:

get a connection, prepare a statement, substitute the variable value, execute, close the
statement - repeat this process over and over.

Don’t you need to not close so that you don’t have to re-prepare the statement
in order to gain any performance advantage?
Re: prepared statements in MySQL [message #1972 is a reply to message #1959 ] Sun, 30 September 2007 20:16 Go to previous message
sterin  is currently offline sterin
Messages: 324
Registered: March 2007
Location: Sweden
Senior Member
That is correct, you need to hold the handle for the prepared statement and re-execute it with just different values each time.

prepare statement
LOOP:
  execute statement with different values
END:
close statement.
Previous Topic:MySQL Replication: Is it possible to ignore possible errors on slave?
Next Topic:How can I create the database through query if the database name has blank spaces in it
Goto Forum:
  


Current Time: Thu Jul 9 20:08:34 EDT 2009

Total time taken to generate the page: 0.01084 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 2.7.7.
Copyright ©2001-2007 FUD Forum Bulletin Board Software

MySQL is a trademark of Sun Microsystems.
InnoDB is a trademark of Oracle Corp.

Percona Performance Forums are a service of Percona, Inc.
Not affiliated with Sun Microsystems or Oracle Corp.