java调用SSIS java调用dtsx包 代码+图示
来源:互联网 发布:淘宝打假人 编辑:程序博客网 时间:2024/05/22 06:07
今天,主管让研究SSIS,网上找了些资料,用VS2005,做了一个简单的资料导入功能。有了.dtsx文件
可是要怎么应用到我的java web程序呢。苦于网上资料很少,去微软的msdn上提问了,也无果。
去google上搜索,翻了好多页,终于找到了,不过是英文的,翻译出来,啊哈,看到了,代码如下:
/**
* Copyright (c) eBizprise, Inc All Rights Reserved.
*/
package com.ebizprise.project.newhoemwork.common;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.DataInputStream;
/**
* java 调用SSIS
* SSISCaller
* @author Jack.Wang
* @version 1.0, Created on 2011-2-25 下午04:57:20
*/
public class SSISCaller {
public static void main(String[] args) {
try {
// create the execution process
Process executionProcess = Runtime.getRuntime().exec("dtexec /f \"f:/temp/dts/Package.dtsx\"");//这个地方要写你做好的dtsx文件的路径
// create the output reader
BufferedReader output = new BufferedReader(new InputStreamReader(new DataInputStream(
executionProcess
.getInputStream())));
String readStr;
while ((readStr = output.readLine()) != null) {
System.out.println(readStr);
}
output.close();
// wait for the process to terminate
executionProcess.waitFor();
// check the exit value
if (executionProcess.exitValue() == 0) {
System.out.println("SSIS execution succeeded\n");
} else {
System.out.println("SSIS execution failed\n");
}
} catch (Throwable e) {
System.out.println(e.getMessage());
}
}
// end of main
}
哇嘎嘎,果然,执行成功了。
这时候,看到有乱码出现,找到代码中的:
BufferedReader output = new BufferedReader(new InputStreamReader(new DataInputStream(
executionProcess.getInputStream())));
修改为:
BufferedReader output = new BufferedReader(new InputStreamReader(new DataInputStream(
executionProcess.getInputStream()),"gbk"));
乱码问题解决了
- java调用SSIS java调用dtsx包 代码+图示
- .net 调用dtsx 包
- 动态调用SSIS包
- C#调用SSIS包
- 前台程序调用SSIS包
- 使用C#调用SSIS包
- java调用天气预报调用代码
- Java调用天气预报调用代码
- .NET程序调用SSIS中的DTS包
- .NET程序调用SSIS中的DTS包
- .NET程序调用SSIS中的DTS包
- 谈如何使用C#调用SSIS包
- SSIS包的三种调用方式
- .NET程序调用SSIS中的DTS包
- Java 代码调用ANT
- C#调用java代码
- Java 代码调用ANT
- delphi调用java代码
- Boost官方库async_tcp_echo_server.cpp示例
- RTOS最新资料大全
- mongodb 聚合函数
- jquery submit()不能提交表单的解决方法
- Xcode报错:Could not instantiate class named NSLayoutConstraint解决办法
- java调用SSIS java调用dtsx包 代码+图示
- error RS102 too stale to catch up
- Java开源项目:Quartz
- Ubuntu下为Firefox安装Adobe Flash Player
- mongodb 查询结果保存为结果集以及根据条件导出数据
- mongodb 模糊查询以及$type使用
- android 环境搭建
- Linux常用命令
- oracle应用实例