O'Reilly logo

XML and Java™ from scratch by Nicholas Chase

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

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

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