Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Upload the Excel data in the Oracle Database

 
sudha swami
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I want to upload the excel data into the oracle Table using SQL Script. The table has already the data, when i upload the excel basically it should overwrite the data in the table.
regards
sudha
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you trying to persist the excel document as a whole, or extract the excel document's contents and upload them?

If its the former you are trying to do, you need to use a BLOB data type. Check Oracle's JDBC documentation which has an example.

If its the later, then your first step is to extract the contents for the excel document. For this you'll need something like Apache POI. Once you have the contents, the JDBC code should be fairly straight forward.
 
Scott Selikoff
author
Saloon Keeper
Posts: 4014
18
Eclipse IDE Flex Google Web Toolkit
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you're looking for a magic solution that will upload excel sheet into a database in one line of code, you can pretty much stop looking. Keep in mind, databases are far more structured than excel files. For example, excel files can have header lines, footers, and filled with all different calculations on a single sheet. Databases, on the other hand, are organized primarily as field-specified tables with zero headers/footers/calculations (unless you count triggers/SP/views but we'll ignore them for now).

In short, databases are highly structured and that structure needs to be added to the excel file during the conversion. There's no (useful) general tool that will add structure and convert to a database automatically, so the conversions have to be specified by hand (or via some code-assisting tool, for example xml based readers).

So if you have a program that writes the contents of an excel file to System.out.println() for example, you just need to convert the output into sets of SQL statements that correspond to your database structure.
[ October 02, 2007: Message edited by: Scott Selikoff ]
 
Michael Ku
Ranch Hand
Posts: 510
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have used Jexcel in the past to read in a Excel file on the server and persist the entries to a DB
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic