使用Java将Excel文件导入Oracle表 [英] Importing Excel file into Oracle table using Java

查看:154
本文介绍了使用Java将Excel文件导入Oracle表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个excel文件,我需要导入并加载到一个oracle表中。是否有可以在java中使用的API来实现这个



我是通过在屏幕上创建浏览选项来选择文件。

解决方案

以下是您需要的解决方案的概述。



如果屏幕上的浏览选项是指网页上的HTML输入标签,如

 < form>< input type =file> 

您需要:



1 - 列表项
将excel文件(从浏览器)上传到服务器直接(http post)或使用更精细的东西,如文件上传器



2 - 在服务器上使用java,从Servlet的HttpRequest对象读取文件,例如, apache文件上传



从这一点起应该在一个java程序中访问一个带有文件内容的字节[]。



3 - 你现在可以读取文件:

- 作为字符串并假定它是CSV

- 或者使用像 Apache POI 这样的东西来阅读excel文件



4 - 解析文件内容后,您可以使用JDBC(使用Oracle jdbc驱动程序)连接到数据库并在数据表中插入数据。 p>

希望有帮助。


I have an excel file, which I need to import and load into an oracle table. Is there an API I can use in java to achieve this

I am selecting the file by creating a browse option on the screen.

解决方案

Here's an overview of the solution you need.

If "browse option on the screen" means a HTML input tag on a web page like

<form><input type="file">

You will need to:

1 - List item Upload the excel file (from the browser) to the server directly (http post) or using something more elaborate like file uploader

2 - On the server, with java, read the file from the HttpRequest object of the Servlet using, for example, apache file upload

From this point you should be in a java program with access to a byte[] with the file content.

3 - You can now read the file:
- as String and assume it's CSV
- or use something like Apache POI to read the excel file

4 - After parsing the file content you can then use JDBC (with the Oracle jdbc driver) to connect to the db and insert the data in the tables.

Hope it helps.

这篇关于使用Java将Excel文件导入Oracle表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆