简体   繁体   English

如何在 Wine 中为 BlackBox Component Builder 设置 ODBC?

[英]How to set up ODBC for BlackBox Component Builder in Wine?

I run BlacBox Component Builder under Wine/Ubuntu.我在 Wine/Ubuntu 下运行 BlacBox Component Builder。 I need to set up ODBC in order to access databases (PostgresQL in my case) in BBCB programs (Component Pascal).我需要设置 ODBC 以访问 BBCB 程序(Component Pascal)中的数据库(在我的例子中是 PostgresQL)。 They have a unique and wonderful SQL access library that allows to accept SELECT results directly into a record variable (analogous to structures in the C world or class instances in C++).他们有一个独特而美妙的 SQL 访问库,允许将 SELECT 结果直接接受到记录变量中(类似于 C 世界中的结构或 C++ 中的类实例)。 Such record is called an interactor.这样的记录称为交互者。 No preprocessor is used, and query parameters are taken directly out of program variables (Like so: "SELECT * FROM users WHERE name = :u.name AND age < :maxage", where u is a program variable of type RECORD and .name is it's field, maxage is also a program variable).没有使用预处理器,直接从程序变量中取出查询参数(例如:“SELECT * FROM users WHERE name = :u.name AND age < :maxage”,其中u是 RECORD 和 .name 类型的程序变量是它的字段, maxage也是一个程序变量)。 Anyway, very convenient from a programmer's perspective.无论如何,从程序员的角度来看非常方便。

However, BBCB does not have any native DB drivers for Linux, so I have to use the Windows BBCB version in Wine.但是,BBCB 没有任何适用于 Linux 的本机 DB 驱动程序,因此我必须在 Wine 中使用 Windows BBCB 版本。 Some years ago, I was able to set up unixodbc in Ubuntu, and unixodbc's DSNs became immediately available in Wine.几年前,我能够在 Ubuntu 中设置 unixodbc,并且 unixodbc 的 DSN 立即在 Wine 中可用。 Not this time around.这次不是。

So, the question is, How do I set up ODBC in Ubuntu so that it's DSNs would be visible in Wine?所以,问题是,如何在 Ubuntu 中设置 ODBC 以便它的 DSN 在 Wine 中可见?

I found the trick!我找到了诀窍!

BBCB is a 32-bit app, so obviousely it makes calls to 32-bit WINE/winapi functions, and they seemingly can't talk to the unixodbc/64bit. BBCB 是一个 32 位的应用程序,所以很明显它会调用 32 位的 WINE/winapi 函数,而且它们似乎无法与 unixodbc/64 位通信。

The trick was to install :i386 versions of unixodbc and the DB odbc driver, then create a 32-bit wine prefix, and then run my app from there.诀窍是安装 :i386 版本的 unixodbc 和 DB odbc 驱动程序,然后创建一个 32 位的 wine 前缀,然后从那里运行我的应用程序。 In greater detail:更详细地说:

  1. If not already done, dpkg --add-architecture i386如果还没有完成, dpkg --add-architecture i386
  2. sudo apt install unixodbc:i386 sudo apt 安装 unixodbc:i386
  3. install database driver for odbc for your database server;为您的数据库服务器安装 odbc 的数据库驱动程序; in my case, sudo apt install postgresql-odbc:i386就我而言, sudo apt install postgresql-odbc:i386
  4. Assuming ~/.wine32 does not exist: WINEPREFIX=~/.wine32 WINEARCH=win32 wine wineboot (some manuals insist you have to have a wine 64-bit prefix before this)假设 ~/.wine32 不存在: WINEPREFIX=~/.wine32 WINEARCH=win32 wine wineboot (一些手册坚持在此之前你必须有一个 wine 64 位前缀)
  5. Now copy BlackBox from it's previous location, or install anew, into the ~/.wine32 prefix, and from now on run BB as follows: WINEPREFIX=~/.wine32 WINEARCH=win32 <program.exe-file-location>现在将 BlackBox 从它以前的位置复制或重新安装到 ~/.wine32 前缀中,然后按如下方式运行 BB: WINEPREFIX=~/.wine32 WINEARCH=win32 <program.exe-file-location>

Now BB's SqlOdbc module can perfectly see the DSNs I set up in unixodbc.现在BB的SqlOdbc模块可以完美的看到我在unixodbc中设置的DSN。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM