I am already connected to my database:
Connection con = DriverManager.getConnection(
"jdbc:mysql://instance23389.db.xeround.com:15296/Inventory","user","password");
PreparedStatement Statement = con.prepareStatement("Select * from inventory");
ResultSet result = Statement.executeQuery();
while(result.next()) {
//What to put here?
}
This is the arraylist I want stored in that database:
static ArrayList<Product> Chart=new ArrayList<Product>();
And that has these objects stored in the arraylist:
double Total;
String name;
double quantity;
String unit;
double ProductPrice;
What is the general code I need to use to get the arraylist to be stored in the MySQL database?
What is the general code I need to use to get the arraylist out of the MySQL database?
This is a template of what to use for retrieving & populating the Arraylist
productListIn the meantime, I invite you to have a look at:
http://www.jdbc-tutorial.com/