使用 PyQt 连接到 SQL Server



如何使用Qt连接到SQL Server(在Mac上开发)

我一直在尝试首先按照本指南安装 ODBC 驱动程序,但它无法正常工作 http://doc.qt.io/qt-5/sql-driver.html#qodbc

在步骤 2 中,它说运行

qmake -- ODBC_PREFIX=/usr/local/unixODBC

我实际上已经更改了该路径以指向unixODBXC的全新下载

qmake -- ODBC_PREFIX=/Users/userx/Downloads/unixODBC-2.3.7

最终的输出是

Running configuration tests...
Done running configuration tests.
Configure summary:
Qt Sql Drivers:
  DB2 (IBM) .............................. no
  InterBase .............................. no
  MySql .................................. no
  OCI (Oracle) ........................... no
  ODBC ................................... no
  PostgreSQL ............................. no
  SQLite2 ................................ no
  SQLite ................................. yes
    Using system provided SQLite ......... no
  TDS (Sybase) ........................... no
Qt is now configured for building. Just run 'make'.
Once everything is built, Qt is installed.
You should NOT run 'make install'.
Note that this build cannot be deployed to other machines or devices.
Prior to reconfiguration, make sure you remove any leftovers from
the previous build.

然后当我跑make sub-odbc我得到

> make sub-odbc
make: *** No rule to make target `sub-odbc'.  Stop.
export PATH=$PATH:/Users/userx/Qt/5.12.0/clang_64/bin
cd /Users/userx/Qt/5.12.0/Src/qtbase/src/plugins/sqldrivers
qmake -- ODBC_PREFIX=/Users/userx/Downloads/unixODBC-2.3.7
make sub-odbc

我完全按照说明进行操作,但它似乎不起作用,任何指示或建议?

我知道

已经很晚了,但请尝试

export PATH=$PATH:/Users/userx/Qt/5.12.0/clang_64/bin
cd /Users/userx/Qt/5.12.0/Src/qtbase/src/plugins/sqldrivers
echo "" > config.cache
echo "" > config.log
qmake -- ODBC_PREFIX=/Users/userx/Downloads/unixODBC-2.3.7
make sub-odbc

最新更新