File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes getting data from Excel Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "getting data from Excel" Watch "getting data from Excel" New topic

getting data from Excel

Anil Vupputuri
Ranch Hand

Joined: Oct 31, 2000
Posts: 527
I am trying to read records an excel file and insert into
Oracle database using
jdbc dbc:excel driver.

excelCon = DriverManager.getConnection
("jdbc dbc:exceldsn");
Statement excelStmt = excelCon.createStatement();
I kept my data in the first sheet.So I read data using the
excelRs=excelStmt.executeQuery("select * from [Sheet1
I read the data in the columns using the command
this returns me the data correctly when ever I keep uniform
data in the excel sheet
like either numbers or characters.
But it is returning me null when data is mixed with numbers and characters alternatively.
I formatted all the cells in the excel sheet uniformly using
all the categories.But none helped me.
The pattern in which this happens is not unique.
for example if the first column of my excel sheet has the data
the format for these columns is Text as in format cells
In this example I get null,2,2,2,2,2 as results when I try
to read using
getString method of ResultSet.
but some times I do get the correct result without changing
the code but changing the
data in the excel sheet.
Any ideas?

SCJP 1.5, SCEA, ICED (287,484,486)
Matthew X. Brown
Ranch Hand

Joined: Nov 08, 2000
Posts: 165
I don't see any resolution to your problem. I'm having an identical problem, with zero resulting in a null in the result set. Did you resolve the issue, or did you simply reformatt/manipulate the data?
I agree. Here's the link:
subject: getting data from Excel
It's not a secret anymore!