• 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

http://www.roseindia.net/tutorial/java/poi/insertExcelFileData.html

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+"')");

>>login(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
0
gudii9
Asked:
gudii9
2 Solutions
 
Amitkumar PSr. ConsultantCommented:
Here is the example to read the data from excel by using apache poi..

http://www.kodejava.org/examples/461.html
0
 
gatorvipCommented:
>>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?
Correct.

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
http://docs.oracle.com/cd/B28359_01/appdev.111/b28765/querdata.htm

Ideally, you'll want to use a PrepareStatement to build your query, then supply the parameters based on your spreadsheet data.
0
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