• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

getting data from Excel

 
Ranch Hand
Posts: 527
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am trying to read records an excel file and insert into
Oracle database using
jdbc dbc:excel driver.

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
excelCon = DriverManager.getConnection
("jdbc dbc:exceldsn");
Statement excelStmt = excelCon.createStatement();
I kept my data in the first sheet.So I read data using the
command
excelRs=excelStmt.executeQuery("select * from [Sheet1
$]");
I read the data in the columns using the command
excelRs.getString(1);
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
a
2
2
2
2
2
the format for these columns is Text as in format cells
options.
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?
 
Ranch Hand
Posts: 165
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic