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

A Quick Look at JDBC and MySQL

After completing the setup instructions in Appendix B,“Getting and Installing MySQL and JDBC,” you should have a working MySQL and JDBC installation in place. Now let's create a small table in MySQL and try getting to it from JSP. Rather than create the table directly by typing to the command line, you'll put the commands in a file and run it so that you can fix things more easily if you make a typo. You'll put all of your SQL scripts in their own directory under CARTAPP to keep them organized. (See Listing 1.8.)

Listing 1.8. employees.sql
 drop table IF EXISTS employees; create table employees ( lname_txt char(50), fname_txt char(50), employee_num integer primary key, address1_txt char(120), address2_txt char(120), ...

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