Thursday, May 5, 2011

JSP : Database Connectivity



Why have a chapter about database connectivity in a book on Servlets and
JSP? Databases are widely used in business today. Just about every real-world
application will use databases in some form or another. The advertised mindset
in J2EE is to build an application that uses an EJB layer to hide database con-
nectivity. In practice this can work, but it is often more problematic than it is

helpful. In this book we are taking the approach that you should not have to use
EJB and that instead you should know more about database connectivity. By
taking this approach, you will be able to build complete Web Applications
without having to worry about a slew of other J2EE specifications. However, if
one day you decide those other specifications are needed, you will be more than
prepared for them. In this chapter we will briefly introduce databases and SQL,
but the focus will be on JDBC and successfully using Java to manipulate a
database. You will be expected to pick up a good book on SQL if you want to be
a database guru.
This session we discusses the following topics:
• What a database, relational database, and SQL are.
• CRUD (Creating, Reading, Updating, and Deleting database tables).
• JDBC (Java Database Connectivity).
• javax.sql.DataSource: an abstract method for obtaining a reference
to a database.
• java.sql.Connection: Java representation of a database connection.
• java.sql.Statement: Executing queries against a database.
• java.sql.ResultSet: Obtaining results of a database query

• Optimally using JDBC.
• JDBC Web Application design patterns.






No comments:

Post a Comment