FoxPro-> MySQL

发布于 2024-10-07 19:13:01 字数 355 浏览 9 评论 0原文

我正在为使用 FoxPro 桌面数据库系统的客户构建一个网站。

数据库和网站之间应该共享的数据本质上是成员列表(相当扁平的结构:他们的联系方式、一些标志字段等)

他们希望对这些成员详细信息所做的任何更改都能通过以下方式自动同步到网站(mysql数据库)。它不需要完全即时,但过程需要简单。

我的问题是这里可以使用的最简单的方法是什么?他们愿意做出一些妥协以节省开发时间/成本。

FoxPro 有没有一种简单的方法可以直接与我的在线 MySQL 数据库对话?

FoxPro 可以创建 XML 或 CSV 类型文件并将其传递给 Web 脚本吗? (然后我用它解析和更新MySQL)

任何建议表示赞赏。

I'm building a website for a client that uses a FoxPro desktop database system.

The data that should be shared between the database and website is essentially a list of members (fairly flat structure: their contact details, a few flag fields etc)

They'd like any changes that are made to these member details to be automatically synched through to the website (mysql database). It doesn't need to be totally instant but the process needs to be easy.

My question is what are the simplest approaches that could be used here? they are willing to compromise a bit to save development time/cost.

Is there an easy way for FoxPro could talk directly to my online MySQL database?

Could FoxPro create an XML or CSV type file and pass it to a web script? (which i then parse and update MySQL with)

Any suggestions appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

笙痞 2024-10-14 19:13:01

您可以使用 Visual FoxPro 中的 ODBC 或 OLE DB。使用 ODBC 通常相当简单。

You could use either ODBC or OLE DB from Visual FoxPro. Using ODBC is typically fairly straightforward.

对你而言 2024-10-14 19:13:01

Foxpro 有一个内部函数 CURSORTOXML,它将获取一个表并将其转换为 XML
它在帮助文件中有相当详细的记录,但这里有一个简单的使用示例

LOCAl lcXML,lnRecords

use my_table

lnRecords=CURSORTOXML('my_table','lcXML',0)

? lnRecords
? lcXML

希望这会有所帮助

Foxpro has an intrinsic function CURSORTOXML, which will take a table and convert it to XML
It is fairly well documented in the help files, but here is a simple example of its use

LOCAl lcXML,lnRecords

use my_table

lnRecords=CURSORTOXML('my_table','lcXML',0)

? lnRecords
? lcXML

Hope this helps

情深如许 2024-10-14 19:13:01

试试这个:

  1. 在您的 Web 服务器上创建一个共享文件夹。
  2. 创建数据的 CSV 并保存在共享文件夹中。
  3. 创建一个 Cron 作业/调度程序来解析数据并将其转储到 Mysql。

这对我有用。

Try this:

  1. Create a Shared Folder on your Web Server.
  2. Create a CSV of your Data and save on the Shared Folder.
  3. Create a Cron Jobs/ Scheduler to parse and dump the data to your Mysql.

This works for me.

夏尔 2024-10-14 19:13:01

从这里获取 odbc 驱动程序: https://dev.mysql.com/downloads/connector/ odbc/

您可能还需要 Microsoft Visual C++ 2010 Redistributable Package (x86) vcredist_x86.exe

使用此代码建立 mysql 连接

PUBLIC server,port,db,uid,pw
server="" & use mysql ip
port="" & port mysql is open on
db="" & db name
uid="" & user anme
pw="" & password

mysql = SQLSTRINGCONNECT('Driver={MySQL ODBC 5.3 Unicode Driver};Server=' + server + ';Port=' + port + ';Database=' + db + ';uid=' + uid + ';Pwd=' + pw + ';',.T.)
IF VARTYPE(mysql) == 'L' OR m.mysql < 0
    MESSAGEBOX('MySQL Connection Failed. Logging will be disabled for this session.',16,'MySQL Error',3500)
ENDIF

下面是一个向 mysql 表进行插入的示例。我用它来将用户操作记录到 mysql 中。

IF VARTYPE(mysql) != 'L' AND m.mysql >= 0
    SQLPREPARE (;
        m.mysql;
        ,'INSERT INTO logging (computer,operator,application,program,version,action) VALUES (;
            ?COMPUTERNAME ;
            ,?OPERATOR ;
            ,?thisApplication ;
            ,?thisProgram ;
            ,?thisVersion ;
            ,?logMessage;
            );';
        )
    SQLEXEC(m.mysql)
ENDIF

Get the odbc driver from here: https://dev.mysql.com/downloads/connector/odbc/

You may also need Microsoft Visual C++ 2010 Redistributable Package (x86) vcredist_x86.exe

Use this code to establish the mysql connection

PUBLIC server,port,db,uid,pw
server="" & use mysql ip
port="" & port mysql is open on
db="" & db name
uid="" & user anme
pw="" & password

mysql = SQLSTRINGCONNECT('Driver={MySQL ODBC 5.3 Unicode Driver};Server=' + server + ';Port=' + port + ';Database=' + db + ';uid=' + uid + ';Pwd=' + pw + ';',.T.)
IF VARTYPE(mysql) == 'L' OR m.mysql < 0
    MESSAGEBOX('MySQL Connection Failed. Logging will be disabled for this session.',16,'MySQL Error',3500)
ENDIF

Here's an example to do an insert into a mysql table. I use it for logging user actions into mysql.

IF VARTYPE(mysql) != 'L' AND m.mysql >= 0
    SQLPREPARE (;
        m.mysql;
        ,'INSERT INTO logging (computer,operator,application,program,version,action) VALUES (;
            ?COMPUTERNAME ;
            ,?OPERATOR ;
            ,?thisApplication ;
            ,?thisProgram ;
            ,?thisVersion ;
            ,?logMessage;
            );';
        )
    SQLEXEC(m.mysql)
ENDIF
小霸王臭丫头 2024-10-14 19:13:01

您可以使用 XML 通过 HTTP REQUEST 向 Web 应用程序发送信息。
要在 FoxPro 中创建/读取 XML,可以使用 CURSORTOXML/XMLTOCURSOR。

在您的 Web 应用程序中,您可以创建 Web 服务来接收/发送 XML 数据。

如果您想要其他数据类型,可以使用 JSON 数据。使用 QDFOXJSON https://qdfoxjson.codeplex.com/

You can use XML for sending information to web application by HTTP REQUEST.
to create/read XML in foxpro, you can use CURSORTOXML/XMLTOCURSOR.

In your web application, you can create a web service to receive/send XML data.

If you want another data type, you can use JSON data. Use QDFOXJSON https://qdfoxjson.codeplex.com/

千纸鹤带着心事 2024-10-14 19:13:01

我想说你最快/最简单的选择可能是通过夜间脚本执行以下操作:

  1. 将 FoxPro 数据导出为 XML
  2. 使用 Python 或 Java 之类的工具将数据推送到 MySQL 数据库

但从长远来看,您最好完全放弃 FoxPro初始导入;)

I'd say your quickest/easiest bet is probably to do the following via a nightly script:

  1. export your FoxPro data to XML
  2. push the data into the MySQL database using something like Python or Java

In the long run though, you're probably better off totally ditching FoxPro after the initial import ;)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文