MySQL 读取 Paradox 数据库文件

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1616939/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 14:20:39  来源:igfitidea点击:

Reading Paradox Database files

mysqlparadoxdata-conversion

提问by MattBelanger

I'm working with a client who has an existing system, built on what is apparently a Paradox database. I've got the database, in the form of a zip file containing .DB, .MB and .PX files, one for each table.

我正在与一个拥有现有系统的客户合作,该系统建立在显然是 Paradox 数据库的基础上。我有一个包含 .DB、.MB 和 .PX 文件的 zip 文件形式的数据库,每个表一个。

I need to take (some) of this data and import it in to a Web application that's using MySQL. Does anybody have a way for me to extract this data, that doesn't involve installing Paradox?

我需要获取(一些)这些数据并将其导入到使用 MySQL 的 Web 应用程序中。有没有人有办法让我提取这些数据,而不涉及安装 Paradox?

If not, does Paradox export in some readable format? Either as SQL or something that can be parsed reasonably easily? The person in charge of this system for my client is a volunteer (they're a non-profit), so I'd like to go to him with a solution - because last time I asked for the data, I got this, which is clearly no good.

如果没有,Paradox 是否以某种可读格式导出?无论是作为 SQL 还是可以相当容易地解析的东西?为我的客户负责这个系统的人是一名志愿者(他们是一个非盈利组织),所以我想去找他一个解决方案 - 因为上次我索要数据,我得到了这个,这显然是不行的。

采纳答案by A. I. Breveleri

Both the Paradox for DOS and Paradox for Windows platforms will export data tables in Delimited Text, Fixed-Length Text, and Lotus 1-2-3 formats. The older Paradox for DOS also writes Lotus Symphony, while the slightly less antique Paradox for Windows does a passable Excel 5.

Paradox for DOS 和 Paradox for Windows 平台都将以定界文本、固定长度文本和 Lotus 1-2-3 格式导出数据表。较旧的 DOS 版 Paradox 也编写了 Lotus Symphony,而稍微不那么古色古香的 Windows 版 Paradox 编写的 Excel 5 还过得去。

However, someone will have to sit down and export the tables one by one, or write a script do to it. Of course you'd need to have Paradox installed to write the script.

但是,必须有人坐下来将表格一张一张地导出,或者编写一个脚本来处理它。当然,您需要安装 Paradox 才能编写脚本。

-Al.

-阿尔。

回答by Name

The wikipedia article about Paradoxlists two other things, that might be interessant, both under GPL license:

关于 Paradox维基百科文章列出了另外两件事,它们可能很有趣,都在 GPL 许可下:

And if you have Delphi and want to write a converter yourself (which would need the BDE to work) you can take a look at this articleor at the source code of ConvertCodeLib on this web site. Both make use of TClientDataset, which can write a CDS (binary format) or an XML file.

如果你有 Delphi 并且想自己编写一个转换器(这需要 BDE 才能工作),你可以看看这篇文章这个网站上 ConvertCodeLib的源代码。两者都使用 TClientDataset,它可以编写 CDS(二进制格式)或 XML 文件。

回答by Michael Steele

You have a few options:

您有几个选择:

  1. Get your hands on the original Paradox software, and use it to export the database into CSVformat. Unfortunately, Borland no longer sells it and the most recent version doesn't run well on Windows XP or above.
  2. Access the database using either a Paradox or dBase/xBase ODBC driver. Paradox and xBase are very similar, so you may be able to extract the data using drivers meant for either of them. You may be able to get a Paradox ODBC driver somewhere on firebirdsql.org.
  3. Use Borland Delphi to write a program which will export the data you need. As someone else mentioned, you can get a free version called Turbo Explorer. You will also have to install the BDE seperately, as it doesn't come with Turbo Explorer.
  1. 获取原始 Paradox 软件,并使用它将数据库导出为CSV格式。不幸的是,Borland 不再销售它,并且最新版本在 Windows XP 或更高版本上运行不佳。
  2. 使用 Paradox 或 dBase/xBase ODBC 驱动程序访问数据库。Paradox 和 xBase 非常相似,因此您可以使用适用于其中任何一个的驱动程序提取数据。您可以在firebirdsql.org 的某处获得 Paradox ODBC 驱动程序。
  3. 使用 Borland Delphi 编写一个程序来导出您需要的数据。正如其他人提到的,您可以获得一个名为Turbo Explorer的免费版本。您还必须单独安装 BDE,因为 Turbo Explorer 没有提供它。

回答by Scott Hildebrand

I've been working on a gigantic data migration from Paradox to MySQL. My general approach has been to export CSV files from Paradox, and then import the CSV files from the MySQL command line. However this system breaks down when there are M (memo) fields in Paradox, because that data doesn't get pulled into the CSV file as expected.

我一直致力于从 Paradox 到 MySQL 的巨大数据迁移。我的一般方法是从 Paradox 导出 CSV 文件,然后从 MySQL 命令行导入 CSV 文件。然而,当 Paradox 中有 M(备忘录)字段时,这个系统就会崩溃,因为该数据没有按预期被拉入 CSV 文件。

Here's my long-winded process for getting Paradox data into MySQL, hopefully it helps somebody!

这是我将 Paradox 数据导入 MySQL 的冗长过程,希望对某人有所帮助!

  • Open Paradox file in Paradox, export to dbase (.dbf) file. What this does is it exports the memo data into dbase's blob format.

  • Open the .dbf file in Paradox. It might be necessary to convert double format to long integer or number before opening in dbfviewer. Double format appears to not be working. Save file.

  • Use this program to open up the dbase file and then export to Excel: http://dbfviewer.org/Export -> XLS-File … this opens it in Excel

  • Now we need to create a macro because Excel doesn't have any native way to enclose CSV fields with quotes or anything else. I've pasted the macro below, but here are the reference sites that I found. One site had better instructions but corrupted text: http://www.mrexcel.com/forum/showthread.php?320531-export-as-csv-file-enclosed-quoteshttp://www.markinns.com/articles/full/export_excel_csvs_with_double_quotes/

  • In Excel replace all " with ' by CTRL-F, replace... any " in records will mess stuff up

  • In Excel press ALT - F11 to open up macros Insert -> Module Create this macro to save CSV files enclosed with double quotes:

    Sub CSVFile()

    Dim SrcRg As Range
    Dim CurrRow As Range
    Dim CurrCell As Range
    Dim CurrTextStr As String
    Dim ListSep As String
    Dim FName As Variant
    FName = Application.GetSaveAsFilename("", "CSV File (*.csv), *.csv")
    
    If FName <> False Then
    ListSep = Application.International(xlListSeparator)
    If Selection.Cells.Count > 1 Then
    Set SrcRg = Selection
    Else
    Set SrcRg = ActiveSheet.UsedRange
    End If
    Open FName For Output As #1
    For Each CurrRow In SrcRg.Rows
    CurrTextStr = ""
    For Each CurrCell In CurrRow.Cells
    CurrTextStr = CurrTextStr & """" & CurrCell.Value & """" & ListSep
    Next
    While Right(CurrTextStr, 1) = ListSep
    CurrTextStr = Left(CurrTextStr, Len(CurrTextStr) - 1)
    Wend
    Print #1, CurrTextStr
    Next
    Close #1
    End If
    End Sub
    
  • Then Run -> Run Macro

  • Set up target MySQL db schema with text fields where we want the blobs to go

  • In MySQL command line here's an example of how to do the import:

    LOAD DATA LOCAL INFILE 'C:/data.csv' INTO TABLE table_name FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\r\n' (column1, column2)

  • 在 Paradox 中打开 Paradox 文件,导出到 dbase (.dbf) 文件。它的作用是将备忘录数据导出为 dbase 的 blob 格式。

  • 在 Paradox 中打开 .dbf 文件。在 dbfviewer 中打开之前,可能需要将 double 格式转换为长整数或数字。双格式似乎不起作用。保存存档。

  • 使用此程序打开 dbase 文件,然后导出到 Excel:http: //dbfviewer.org/Export-> XLS-File ... 这将在 Excel 中打开它

  • 现在我们需要创建一个宏,因为 Excel 没有任何本机方式来用引号或其他任何东西将 CSV 字段括起来。我已经粘贴了下面的宏,但这里是我找到的参考站点。一个站点有更好的说明但文本已损坏:http: //www.mrexcel.com/forum/showthread.php? 320531-export-as-csv-file-enclosed- quoteshttp://www.markinns.com/articles/完整/export_excel_csvs_with_double_quotes/

  • 在 Excel 中,用 CTRL-F 替换所有 " 与 ',替换......记录中的任何 " 都会搞砸

  • 在 Excel 中按 ALT - F11 打开宏 插入 -> 模块 创建此宏以保存用双引号括起来的 CSV 文件:

    子 CSVFile()

    Dim SrcRg As Range
    Dim CurrRow As Range
    Dim CurrCell As Range
    Dim CurrTextStr As String
    Dim ListSep As String
    Dim FName As Variant
    FName = Application.GetSaveAsFilename("", "CSV File (*.csv), *.csv")
    
    If FName <> False Then
    ListSep = Application.International(xlListSeparator)
    If Selection.Cells.Count > 1 Then
    Set SrcRg = Selection
    Else
    Set SrcRg = ActiveSheet.UsedRange
    End If
    Open FName For Output As #1
    For Each CurrRow In SrcRg.Rows
    CurrTextStr = ""
    For Each CurrCell In CurrRow.Cells
    CurrTextStr = CurrTextStr & """" & CurrCell.Value & """" & ListSep
    Next
    While Right(CurrTextStr, 1) = ListSep
    CurrTextStr = Left(CurrTextStr, Len(CurrTextStr) - 1)
    Wend
    Print #1, CurrTextStr
    Next
    Close #1
    End If
    End Sub
    
  • 然后运行 ​​-> 运行宏

  • 使用我们希望 blob 所在的文本字段设置目标 MySQL 数据库架构

  • 在 MySQL 命令行中,这是一个如何进行导入的示例:

    LOAD DATA LOCAL INFILE 'C:/data.csv' INTO TABLE table_name FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\r\n' (column1, column2)

回答by Jerry Coffin

MS has instructionsfor using the MS Jet driver to read data from files produced by Paradox 3-5. That can act as (at least) an ODBC driver, so you can use it to read a Paradox file from just about anything that knows how to use ODBC.

MS具有指令用于使用所述MS的Jet驱动程序读取从由悖论3-5产生的文件数据。它可以充当(至少)一个 ODBC 驱动程序,因此您可以使用它从几乎任何知道如何使用 ODBC 的东西中读取 Paradox 文件。

回答by mk12

Using MS Access 2007 you can import Paradox 7 and below using the BDE distribution included with the free Paradox Database Editor program (google it). Use a connection such as:

使用 MS Access 2007,您可以使用免费的 Paradox 数据库编辑器程序(google it)中包含的 BDE 分发版导入 Paradox 7 及以下版本。使用连接,例如:

DoCmd.TransferDatabase acImport, "ODBC Database", _
    "Paradox 3.X;HDR=NO;IMEX=2;ACCDB=YES;DATABASE=C:\apache\Archive;TABLE=Messages#db", _
    acReport, DailyArchiveName, "MyDatabase"

回答by Larry Lustig

Paradox is a native format for the Borland Database Engine, which is included with various Delphi programming products. Ownership has changed hands at least once recently, but at one point there were free "Express" versions of Delphi available that would let you write a simple program to export this stuff. If a free version is no longer available, the lowest available SKU should include BDE functionality.

Paradox 是 Borland 数据库引擎的原生格式,它包含在各种 Delphi 编程产品中。所有权最近至少易手过一次,但曾经有免费的“Express”版本的 Delphi 可以让您编写一个简单的程序来导出这些东西。如果不再提供免费版本,最低可用 SKU 应包含 BDE 功能。