C#运用nzload.exe导入数据
来源:互联网 发布:淘宝联盟怎么登录 编辑:程序博客网 时间:2024/05/24 15:37
public void NzLoadFile(List<string> fileNames)
{
string targetFile, targetTable;
foreach (var fileName in fileNames)
{
try
{
targetFile = ValidateFile(fileName);
if (targetFile == null)
continue;
targetTable = getTargetTable(targetFile);
//string arguments = "-maxErrors 100 -host fxodwnet2d.nam.nsroot.net -u qsdb_dev_admin -pw password -db qsdb_dev -outputDir \"" + outputLog + "\" -t \"" + targetTable + "\" -df \"" + @targetFile + "\" -datestyle YMD -y2Base 2000 -dateDelim \"\" -delim \",\"";
string arguments = "-maxErrors \"" + maxErrors + "\" -host \"" + host + "\" -u \"" + user + "\" -pw \"" + password + "\" -db \"" + database + "\" -outputDir \"" + outputDir + "\" -t \"" + targetTable + "\" -df \"" + @targetFile + "\" -datestyle YMD -y2Base 2000 -dateDelim \"\" -delim \",\"";//时间形式yyyymmdd
string arguments=string arguments = "-maxErrors 100 -host 11111.nam.nsroot.net -u dev_sys -pw password -db dev -t tablename -df \"" + targetFile + "\" -outputDir \"" + outputLog + "\" -datestyle YMD -dateDelim \"-\" -timeStyle 24HOUR -timeDelim \":\" -delim \",\" ";//时间形式yyymmdd hh:mm:ss
StartProcessNzLoad(processName, arguments);
}
catch (IOException ex)
{
ourLogger.Error (string.Format("Nzload file {0} errors. Message-{1}", fileName, ex.Message));
}
}
}
/// <summary>
/// start the nzload process to import data into Netezza
/// </summary>
private void StartProcessNzLoad(string processName, string arguments)
{
Process nzload = new Process();
//nzload.StartInfo = new ProcessStartInfo(@"C:\Program Files\IBM Netezza Tools\7.0.2.4\nzadmin\Bin\nzload.exe", str);
nzload.StartInfo = new ProcessStartInfo(processName, arguments);
nzload.StartInfo.UseShellExecute = false;
nzload.StartInfo.RedirectStandardInput = true;
nzload.StartInfo.RedirectStandardOutput = true;
nzload.StartInfo.CreateNoWindow = false;
nzload.Start();
while (!nzload.HasExited)
{
Thread.Sleep(50);
}
{
string targetFile, targetTable;
foreach (var fileName in fileNames)
{
try
{
targetFile = ValidateFile(fileName);
if (targetFile == null)
continue;
targetTable = getTargetTable(targetFile);
//string arguments = "-maxErrors 100 -host fxodwnet2d.nam.nsroot.net -u qsdb_dev_admin -pw password -db qsdb_dev -outputDir \"" + outputLog + "\" -t \"" + targetTable + "\" -df \"" + @targetFile + "\" -datestyle YMD -y2Base 2000 -dateDelim \"\" -delim \",\"";
string arguments = "-maxErrors \"" + maxErrors + "\" -host \"" + host + "\" -u \"" + user + "\" -pw \"" + password + "\" -db \"" + database + "\" -outputDir \"" + outputDir + "\" -t \"" + targetTable + "\" -df \"" + @targetFile + "\" -datestyle YMD -y2Base 2000 -dateDelim \"\" -delim \",\"";//时间形式yyyymmdd
string arguments=string arguments = "-maxErrors 100 -host 11111.nam.nsroot.net -u dev_sys -pw password -db dev -t tablename -df \"" + targetFile + "\" -outputDir \"" + outputLog + "\" -datestyle YMD -dateDelim \"-\" -timeStyle 24HOUR -timeDelim \":\" -delim \",\" ";//时间形式yyymmdd hh:mm:ss
StartProcessNzLoad(processName, arguments);
}
catch (IOException ex)
{
ourLogger.Error (string.Format("Nzload file {0} errors. Message-{1}", fileName, ex.Message));
}
}
}
/// <summary>
/// start the nzload process to import data into Netezza
/// </summary>
private void StartProcessNzLoad(string processName, string arguments)
{
Process nzload = new Process();
//nzload.StartInfo = new ProcessStartInfo(@"C:\Program Files\IBM Netezza Tools\7.0.2.4\nzadmin\Bin\nzload.exe", str);
nzload.StartInfo = new ProcessStartInfo(processName, arguments);
nzload.StartInfo.UseShellExecute = false;
nzload.StartInfo.RedirectStandardInput = true;
nzload.StartInfo.RedirectStandardOutput = true;
nzload.StartInfo.CreateNoWindow = false;
nzload.Start();
while (!nzload.HasExited)
{
Thread.Sleep(50);
}
}
参数参考:http://www-01.ibm.com/support/knowledgecenter/SSULQD_7.1.0/com.ibm.nz.load.doc/c_load_sample_nzload_usage.html
0 0
- C#运用nzload.exe导入数据
- 运用C#读取导入的Excel部分数据为空的解决方法
- 运用命令行导出导入mysql数据
- C# excel数据导入
- C#导入Excel数据
- C#编程数据导入
- C#导入Excel表数据
- C# 实现批量导入数据
- C#中Excel数据导入
- 运用exp 导出oracle数据与 运用imp 将dmp格式数据导入数据库
- 用批处理调用php.exe把csv数据导入mysql
- C#中将DataTable数据集导入 Excel
- C# 下用 xml 导入导出数据
- 使用C#导入导出数据到Excel
- C# 上传Excel导入数据 SqlBulkCopy
- C# sql数据的导入导出
- C#实现客户端数据导入导出
- C#将excel数据导入dataset
- response常见应用(中文数据乱码解决,中文文件下载,随机图片等)
- jquery easyui如何通过idField获取某行?
- 循环水处理剂:循环水处理剂作用
- Mybatis--初学者
- 封装类DataProtocol 实现后台与页面的数据交互
- C#运用nzload.exe导入数据
- 白话数字签名(2)——软件&设备
- Unity性能优化文章收集
- 17-2-4 统计单词个数的错误程序
- EL表达式出现乱码问题!
- POJ2965解题报告(BFS,位压缩)
- request、response 中文乱码问题与解决方式
- 仿QQ会员右下角提示框c#实现
- 第十六周 OJ:分数序列2/1, 3/2, 5/3, 8/5, 13/8, …