O'Reilly logo

MySQL™ and JSP™ Web Applications: Data-Driven Programming Using Tomcat and MySQL by James Turner

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required