02-07-2012, 03:51 PM
Database Programming
Database Programming.ppt (Size: 635 KB / Downloads: 44)
JDBC API
The JDBC API supports both two-tier and three-tier models for database access.
Two-tier model -- a Java applet or application interacts directly with the database.
Three-tier model -- introduces a middle-level server for execution of business logic:
the middle tier to maintain control over data access.
ResultSet
A ResultSet provides access to a table of data generated by executing a Statement.
Only one ResultSet per Statement can be open at once.
The table rows are retrieved in sequence.
A ResultSet maintains a cursor pointing to its current row of data.
The 'next' method moves the cursor to the next row.
you can’t rewind
About Prepared Statements
Allows you to pass runtime parameters to the SQL statements to query and modify the data in a table.
Also used for queries that are executed many times.
Complied and prepared only once by JDBC.
Helps in reducing the load on the database server and thus improving the performance of the application.
Instead of values, use ‘?’.
Hence, Prepared Statements can be thought of as statements that contain placeholders to be substituted later with actual values.