?
Solved

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

Posted on 2012-08-28
2
Medium Priority
?
888 Views
Last Modified: 2012-09-01
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
Comment
Question by:gudii9
2 Comments
 
LVL 21

Accepted Solution

by:
Amitkumar P earned 1000 total points
ID: 38344067
Here is the example to read the data from excel by using apache poi..

http://www.kodejava.org/examples/461.html
0
 
LVL 20

Assisted Solution

by:gatorvip
gatorvip earned 1000 total points
ID: 38345339
>>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

Featured Post

Free recovery tool for Microsoft Active Directory

Veeam Explorer for Microsoft Active Directory provides fast and reliable object-level recovery for Active Directory from a single-pass, agentless backup or storage snapshot — without the need to restore an entire virtual machine or use third-party tools.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses
Course of the Month16 days, 21 hours left to enroll

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question