Home > Articles > Data

  • Print
  • + Share This
Like this article? We recommend

Updating the Database

Inserting data into a Derby database is as easy as writing some JDBC code, and Listing 2 illustrates two insertions.

Listing 2 Data insertion

s.execute("INSERT INTO " + ComponentTable +
s.execute("INSERT INTO " + PrincipalTable +

The code in Listing 2 inserts a row into each of our two database tables. Notice that I created the row in ComponentTable first; in PrincipalTable, I inserted the same value as the foreign key.

Let’s now pull some data from the database.

  • + Share This
  • 🔖 Save To Your Account