【发布时间】:2011-08-16 13:18:47
【问题描述】:
我需要使用 java 将 OBI 报告下载为 csv。当我进入
http://<my_host>:<my_port>/analytics/saw.dll?Go&Action=Download&path=<my_path>&Format=csv
在浏览器中,出现下载弹出窗口,我可以下载文件。
但是,当我尝试使用 java 下载报告时,它会下载一个 html 内容说 “Oracle BI Presentation Services 不支持您的浏览器。”
这是我使用的一段代码:
URL url = new URL("http://<my_host>:<my_port>/analytics/saw.dll?Go&Action=Download&path=<my_path>&Format=csv");
URLConnection urlc = url.openConnection();
urlc.addRequestProperty("User-Agent", "Mozilla/4.0");
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
bos = new BufferedOutputStream(new FileOutputStream("file.csv"), 1024);
bis = new BufferedInputStream(urlc.getInputStream());
byte[] data = new byte[1024];
while ((x = bis.read(data, 0, 1024)) >= 0) {
bos.write(data, 0, x);
}
那么,如何下载报告?
【问题讨论】:
标签: java oracle download business-intelligence obiee