[Notes: This is an excerpt (Section 25.7) of Chapter 25, Accessing Databases with JDBC, from our best-selling textbook Java How to Program, 6/e. This tutorial may refer to other chapters or sections of the book that are not included here. When you purchase this book you also get free access to the Web-based Java Multimedia Cyber Classroom, 6/e, for six months. The Cyber Classroom includes audio descriptions of the examples in Chapters 1-14, solutions to approximately one-half of the end-of-chapter exercises, interactive true/false self-assessment questions and a searchable Web-based e-book. Permission Information: Deitel, Harvey M. and Paul J., JAVA HOW TO PROGRAM, ©2005, p. 1207. Electronically reproduced by permission of Pearson Education, Inc., Upper Saddle River, New Jersey.]
Java RowSet Tutorial, Setup Part 3: Creating Database books in MySQL
For each MySQL database we discuss in this book, we provide a SQL script that will set up the database and its tables. These scripts can be executed with a command-line tool called mysql that is part of the MySQL installation. In the examples directory for this chapter on the CD that accompanies this book, you will find the SQL script books.sql.To create the books database:
1. Open a Command Prompt and change to the C:\mysql\bin directory. [Note: If you installed MySQL on a directory other than C:\mysql, replace C:\mysql with your MySQL installation directory.]
2. Start the database server by executing the command
C:\mysql\bin>mysqld
3. Copy the SQL script books.sql to the C:\mysql\bin directory. [Note: If you installed MySQL on a directory other than C:\mysql, replace C:\mysql with your MySQL installation directory.]
4. Open a new Command Prompt and change to the C:\mysql\bin directory. [Note: If you installed MySQL on a directory other than C:\mysql, replace C:\mysql with your MySQL installation directory.]
5. Create the books database by executing the command
C:\mysql\bin>mysql -h localhost -u jhtp6 -p < books.sql

