Reading and Writing Customers from the Database

Now you're ready to add the code to find, add, and modify customers. This means reading and writing from the database, which means that you're going to have to create SQL statements to read and write the objects. However, embedding the SQL directly into Java source is both messy and unstable because it requires that you recompile the class every time the SQL statement needs to be changed.

Using Resource Bundles

The ResourceBundle class can be used (and will be used later in the book) to provide different messages depending on locale, but it can also be used for the more mundane purpose of reading value out of a property file. In this case, you'll create a property file called com.bfg.customer.SQLQueries ...

Get MySQL™ and JSP™ Web Applications: Data-Driven Programming Using Tomcat and MySQL now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.