1

I need to write a Stored Proc/ Function which reads data from a worksheet of Excel workbook. How do I do it in DB2 ? I am using AIX os.

Tried Read Excel from DB2 but wont work on my OS. Also tried

Import from FileName.csv of DEL COMMITCOUNT 1000 insert into TableName 

but invain.

Community
  • 1
  • 1
Cannon
  • 2,725
  • 10
  • 45
  • 86
  • http://nesj.net/blog/2011/08/import-data-in-an-excel-file-to-a-db2-table/ – David Jan 11 '13 at 16:26
  • Have you tried anything yet? psst...@DavidStratton, you should get some points for this in an answer. – StoriKnow Jan 11 '13 at 16:27
  • 1
    It took all of ten seconds to google. I don't want the points. If buffer_overflow uses it, he can post it as the answer and accept it. – David Jan 11 '13 at 16:30

2 Answers2

0

You have several options, the cleanest is probably to write a Java Stored Procedure, utilising the Apache POI library, if you intend to read Excel workbooks (.xls or .xlsx) rather than plain CSV formatted text files.

Not as clean but just as effective you can write a Perl / Python / PHP script to read the file and return a line at a time, and invoke the script from a stored procedure, see: Making Operating System Calls from SQL

arober11
  • 1,969
  • 18
  • 31
0

Its be better to convert your excel file to flat file like csv if possible. Because DB2 not natively know excel file. Its csv file that can processed natively using IMPORT, LOAD or INGEST tools from DB2

fritz
  • 121
  • 4