You can think of a stored procedure as a method that exists within a db. i.e. code that lives in your db that you can execute. The language that they are written in (SPL) usually depends on the db vendor. For example, the syntax of an Oracle sp is different than an Informix sp. The benefits are: They execute quickly because they are an integral part of the db and are therefore optimized; They make it easy to encapsulate multiple queries/updates into one procedure. PreparedStatements are part of the JDBC spec and are used to execute ANY kind of a statement against a db. Commonly, they are used to execute a "SELECT" or "UPDATE" statement, but they can even be used to execute a stored procedure! (although CallableStatements are better for executing stored procedures). When you call connection.prepareStatement(SQL), you are basically saying "I intend to execute this statement against this connection". They are very useful if you are executing the same statement multiple times, just with different parameters. Since you only "prepare" the statement once and then just change the input params as needed, the db has to check the sytax, build the query plan, etc., only once. I think I went too far. To recap... A stored procedure is compiled, db-specific code that resides within a db. A PreparedStatement is just an efficient way in Java to execute any kind of an SQL statement.
Blake Minghelli<br />SCWCD<br /> <br />"I'd put a quote here but I'm a non-conformist"