Creating the Initial Inventory

Now that we have the table created, we need to populate it. Normally, this would have been done long before we ever got to the point of even having *.xml files to work with, but we're going to give this table a base of the information in the products.xml file. Later, we'll look at adjusting it based on vendor information and orders, and then updating the products.xml file accordingly.

Let's start with the basics. In Listing 8.4, we'll create the application to access the database.

Listing 8.4. CreateInventory.java: Connect to the Database
 0:import java.sql.*; 1: 2:public class CreateInventory { 3: 4: public static void main(String[] args) { 5: 6: try { 7: Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); 8: } catch ...

Get XML and Java™ from scratch 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.