Question: 1. Create a connection to a relational database using SQLite or 2. Create a single database table to hold information. Let's make a simple class

 1. Create a connection to a relational database using SQLite or
2. Create a single database table to hold information. Let's make a

1. Create a connection to a relational database using SQLite or 2. Create a single database table to hold information. Let's make a simple class called Person for this exercise. firstName (String) . age (int e ssn (long) . creditCard (long) Note that once you have the DB created, you don't want to do this again every time you run your test program. The easiest way to deal with this- for this assignment, is to comment out the code that creates the DB creation and the table creation while you experiment with the following Aside: I choose ssn and credit card as fields here so that you might think about the persistent storage of sensitive data. There are some pretty strict laws governing the storage of some data. Please don't use any actual social security numbers or credit card numbers in this exercise.) 3. Demonstrate the insertion of a record into the database Insert several records. 4. Write a method called insertPerson(Person person) that adds a person object to your database. Create another object of type Person, and demonstrate calling your method, passing the object to the method 5. Demonstrate the retrieval of information from the database. Use SQL Select statements, to retrieve a particular Person from the database. 6. Write a method called selectPerson that returns a Person object. This method retrieves the data for a Person from the database. We also need to pass a parameter to identify what person. You can use 'name if you like, or if you find it easier to use the database generated ID that's fine too. This method returns the object that represents that person. This will require that you extract the data that is returned from the database, and call the Person constructor. (Later you will understand that that this is the data-exchange between the relational database and the business layer. )

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!