• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 892
  • Last Modified:

java program to read excel/text and checks oracle database and emails missing records

I am looking for a java sample example which reads excel or text file and
 iterate through the records by forming hash map or other object. Forms a query and queries againest oracle database
and generates excel report of any missing records compared to excel/ text file records.Emails the missingrecords report.

I saw this example


But it is not complete on what I was looking. It is inserting instead of 'select' to check missing records.

It mentioned like

int k=stat.executeUpdate("insert into login(username,password) value('"+username+"','"+password+"')");

 is login is the name of the table with columns names username,password in the paranthesis?

 Any ideas, suggestions, sample code, links, source code highly appreciated. Thanks in advance
2 Solutions
Amitkumar PSr. ConsultantCommented:
Here is the example to read the data from excel by using apache poi..

>>But it is not complete on what I was looking.

You may not be able to find exactly what you're looking for. However, that example provides a solid starting point. You will basically have 3 steps:
a) read the spreadsheet
b) query the database
c) email results

>>is login is the name of the table with columns names username,password in the paranthesis?

You can find the documentation for executeUpdate here, you can easily see that it will not be useful in your situation. Instead, you will want to use executeQuery, which returns a ResultSet.  

Check out this link

Ideally, you'll want to use a PrepareStatement to build your query, then supply the parameters based on your spreadsheet data.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now