Join David Gassner for an in-depth discussion in this video Using the exercise files, part of Java: Database Integration with JDBC.
If you're a Premium Member of the lynda.com online training library, or you're watching this video series on a disc, you'll have access to the exercise files that accompany this course. I have copied the exercise files to my Desktop, but you can place them anywhere on your hard disk. The main exercise files for the course are divided into chapters, and within each chapter there are folders that are designed as projects that can be imported into Eclipse. They were created with Eclipse 4.2 or Juno but should be importable in older versions as well.
You will need Java 7 installed to use any of these projects. To import any Project go in to Eclipse. From the menu, select File > Import, then from the Import dialog under General, select Existing Projects into Workspace > Browse and choose the Root folder for the project you want to Import. I'll start with my Desktop where I have installed the exercise files, then I'll go to Exercise Files/03_Connections for chapter 3, and I'll choose the project JDBCExceptions.
I'll then follow the rest of the buttons to import the project into Eclipse. You should then be able to open the project in the Package Explorer view open the Source folder and its packages and open any of the classes. I have opened the Main class from this particular application with either the main class or the project selected, you should then be able to run the application by clicking the run button and the result will show up in the console view. If you have the editor maximized like this then the Console view will appear on the right. To get rid of it, click into the Console view and back on the editor.
You can also debug by clicking an icon on the toolbar. And if there are any errors or breakpoints, you'll go into the debug perspective, and you might be prompted with a dialog before that happens. You can also run or debug using keyboard shortcuts. To find out about these keyboard shortcuts go to the Run menu. The keyboard shortcuts differ between operating systems, look here to find out the keyboard shortcut for your operating system. I have also provided some free exercise files that are available to everybody, regardless of membership status.
These exercise files contain code, database scripts, and libraries. The code folder includes a single project that I'll describe later in the course. The database folder includes scripts for both MySQL and HSQLDB and one text file that contains to MySQL stored procedures that I'll use later in the course. The libs folder contains to open source Java libraries. These are drivers, one for HSQLDB, and one for MySQL.
You can also download the latest version of these JAR files from the vendor sites. But to simplify things, I have included them in these Free exercise files. So that's a look at the exercise files that accompany the course. The Free exercise files are available to all, and the Main exercise files are available to Premium Members or those who have purchased the DVD. If you don't have access to these Main exercise files you can follow along with your own Java code.
Author David Gassner explains how to choose a JDBC driver and connect to one or more databases. He also provides detailed instructions on reading, selecting, and updating data; calling stored procedures; managing data via JavaBean classes or with prepared statements; and working with metadata.
- Importing a MySQL database
- Connecting to databases
- Handling JDBC exceptions
- Looping through result sets
- Limiting the number of fetched rows
- Filtering data with prepared statements
- Calling stored procedures
- Inserting, updating, and deleting rows with prepared statements
- Using a persistent database connection
- Committing and rolling back transactions