Search Blog

Search duranek.blogspot.com

Wednesday, January 18, 2012

PreparedStatement vs Statement

PreparedStatement vs Statement

PreparedStatement'in java ile alakasi yok aslinda. Database server'in yaptigi
bir is. Precompilation yapiyor, execution plan'i hazirlayip cacheliyor, boylece
ileriki execute larda hizli oluyor.

PreparedStatement, ilk ucunu hazirliyor. Yani db ye iki defa gidilir.

The following occurs when a database receives a SQL statement:

1) The database parses the statement and looks for syntax errors.
2)The database validates the user to make sure the user has privileges to execute the statement.
3)The database validates the semantics of the statement.
4)The database figures out the most efficient way to execute the statement 
and prepares a query plan. Once the query plan is 
created, the database can execute the statement.

1)    Performance
2)    SQL injection'i onler. 
3)     Runtime sirasinda Parametre yazabiliriz.
4)    PreparedStatement larin tercih edilmedigi yerler daha cok memory yedigi
    icin embed cihazlar olabilir. Cok az ram'i olan.

No comments: