将大型文本文件导入MS Access数据库 [英] Import large text file to a MS Access database

查看:118
本文介绍了将大型文本文件导入MS Access数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,


i有一个巨大的大文本文件(350.000行),我想导入到

a MS Acccess Database,当然我不喜欢我不想使用Access,但是用C#做



i已经尝试了AddRow方法或Insert,读取每一行

文本文件,问题当然是速度,将所有行/记录添加到数据库需要花费4个多小时。


有什么建议吗?

比你

解决方案

2007年3月3日08:36:21 -0800,mfrsousa写道:


嗨那里,


i有一个巨大的大文本文件(350.000行),我想要的导入到

a MS Acccess数据库,当然我不想使用Access,但是用C#做



i已经尝试过AddRow方法或者Insert,读取每一行

的文本文件,问题当然是速度,将所有行/记录添加到数据库需要花费4小时以上的时间。


有什么建议吗?


比你



多一点信息会有所帮助......你想让每一行都进入自己的行吗

行在数据库中或所有行进入一个字段

-

Bits.Bytes
http://bytes.thinkersroom.com


" mfrsousa" < mf ****** @ gmail.com写信息

新闻:11 ********************* @ t69g2000cwt。 googlegro ups.com ...


i有一个巨大的大文本文件(350.000行)我要导入到

a MS Acccess Database当然我不想使用Access,但是用C#做



i已经尝试过AddRow方法或者插入,读取每个

行文本文件,问题当然是速度,将所有行/记录添加到数据库需要花费4个多小时b / b



首先,没有访问数据库这样的东西。本身 -

Microsoft Access与其他几个Micrsoft应用程序一样,使用Jet

数据库格式...


你说你不想使用Access - 这有什么特别的原因

这个......?我强烈建议你在Access中打开数据库,打开有问题的

表,然后使用获取外部数据导入文本文件

功能和时间需要多长时间 - 我愿意打赌它将是

没有4小时......


显然如果没有安装Access,那么你的选择几乎是限于ADO.NET和Jet OleDb提供商的b $ b。但是,您可能希望

考虑使用批量交易。进口成团,比如说,
10,000条记录 - 过去......

我用这种技术取得了巨大的速度提升......


2007年3月3日08:36:21 -0800,mfrsousa < mf ****** @ gmail.comwrote:


>嗨那里,

我有一个庞大的大文本文件(350.000行)我想导入一个MS Acccess数据库,当然我不想使用Access,但是用C#做它。

我已经尝试了AddRow方法或Insert,读取文本文件的每一行,问题当然是速度,将所有行/记录添加到数据库需要4个多小时。

有什么建议吗?



对于数据库的批量加载,如您所描述的,在关闭受影响的表之前,通常需要更好地关闭索引。开始

负载,然后在批量

加载完成后从头开始重建索引。


rossum


hi there,

i have a huge large text file (350.000 lines) that i want to import to
a MS Acccess Database, of course i don''t want to use Access, but do it
with C#.

i already have tried the AddRow method or Insert, reading each line of
the text file, the problem of course is velocity, it would take more
than 4 hours to add all lines/records to the database.

any suggestion?
than you

解决方案

On 3 Mar 2007 08:36:21 -0800, mfrsousa wrote:

hi there,

i have a huge large text file (350.000 lines) that i want to import to
a MS Acccess Database, of course i don''t want to use Access, but do it
with C#.

i already have tried the AddRow method or Insert, reading each line of
the text file, the problem of course is velocity, it would take more
than 4 hours to add all lines/records to the database.

any suggestion?

than you

A bit more info would help ... do you want each line to go into its own
row in the database or all the lines into one field
--
Bits.Bytes
http://bytes.thinkersroom.com


"mfrsousa" <mf******@gmail.comwrote in message
news:11*********************@t69g2000cwt.googlegro ups.com...

i have a huge large text file (350.000 lines) that i want to import to
a MS Acccess Database, of course i don''t want to use Access, but do it
with C#.

i already have tried the AddRow method or Insert, reading each line of
the text file, the problem of course is velocity, it would take more
than 4 hours to add all lines/records to the database.

First of all, there is no such thing as an "Access database" per se -
Microsoft Access, like several other Micrsoft applications, uses the Jet
database format...

You say you don''t want to use Access - is there any particular reason for
this...? I strongly suggest you open up the database in Access, open the
table in question, then import the text file using the Get External Data
functionality and time how long it takes - I''m willing to bet it will be
nothing like 4 hours...

Obviously if Access isn''t installed, then your options are pretty much
limited to ADO.NET and the Jet OleDb provider. However, you might like to
consider using transactions to "batch" the imports into groups of, say
10,000 records - I''ve achieved massive speed gains with this technique in
the past...


On 3 Mar 2007 08:36:21 -0800, "mfrsousa" <mf******@gmail.comwrote:

>hi there,

i have a huge large text file (350.000 lines) that i want to import to
a MS Acccess Database, of course i don''t want to use Access, but do it
with C#.

i already have tried the AddRow method or Insert, reading each line of
the text file, the problem of course is velocity, it would take more
than 4 hours to add all lines/records to the database.

any suggestion?

For a bulk load of a database, such as you describe, it is often
better to switch off indexing on the affected tables before starting
the load and then rebuilding the indexes from scratch after the bulk
load has finished.

rossum


这篇关于将大型文本文件导入MS Access数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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