Qt PostgreSQL 範例
=== 測試環境
OS: Windows 7
Qt Verstion: 5.5.0
Compiler: Visual Studio 2013
OS: Arch Linux 4.1.6
Qt Version: 5.5.0
Compiler: GCC 5.2.0
=== 程式範例
=== 錯誤訊息
QSqlDatabase: QPSQL driver not loaded
QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QODBC QODBC3 QPSQL QPSQL7
在 Windows,確認下列檔案
MyAppDir\sqldrivers\qsqlpsql.dll
MyAppDir\libpq.dll
MyAppDir\libeay32.dll
MyAppDir\ssleay32.dll
在 linux,確認 qt project file 加上
INCLUDEPATH+=/usr/include/pgsql
LIBS+=-L/usr/lib -lpq
=== 資料來源
Qt Documentation - SQL Database Drivers
http://doc.qt.io/qt-5/sql-driver.html
Qt: SELECT-Query to PostgreSQL-Server always responses with NULL
http://stackoverflow.com/questions/13633055/qt-select-query-to-postgresql-server-always-responses-with-null
QT5: Failed to load psql driver in windows
http://stackoverflow.com/questions/20884010/qt5-failed-to-load-psql-driver-in-windows
沒有留言:
張貼留言