I am a java beginner. I have the below file that reads excel file. Excel file has nine columns and I created a DB Table with 9 columns. I would like to read the excel file except the first row and write to database table. How to achieve this.
There are probably several ways to do this, but personally, I would create a JavaBean that represents each of the columns in your database record, populate that bean with the values you've pulled from the spreadsheet, and then pass that bean to a DAO that will do the insert or update.
That's just my two cents worth. I'll be interested in seeing what other solutions are recommended.
"The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do." -- Ted Nelson
Yes, there are many different ways of arranging for your data to be written to a database.
But none of those ways are going to care that you got that data from an Excel spreadsheet. In other words, the fact that your data came from Excel is irrelevant. Once you've got it out of Excel, just pick one of those ways and write the data to the database.
If you don't know any ways of writing to a database, let me recommend the JDBC tutorial.
Joined: Sep 23, 2012
Thank for the reply. I know how to use JDBC to insert values. Please help me how to save each cell value into a variable in order to insert them. Thank you.