scql icon indicating copy to clipboard operation
scql copied to clipboard

怎样在scql中使用odbc方式连接数据库

Open deanzxl opened this issue 1 month ago • 1 comments

Issue Type

CCL

Have you searched for existing issues?

Yes

Link to Relevant Documentation

No response

Question Details

目前使用的scql版本是0.5.0b2。现在需要连接指定数据库,只能通过odbc方式进行连接,修改了engine/bazel/poco.BUILD,将ENABLE_DATA_ODBC设置为ON,其余未动,提前在编译镜像中通过yum install unixODBC,unixODBC-devel安装了编译所需要的库以及头文件,运行scql-engine的编译时报错,提示如下:
/root/.cache/bazel/_bazel_root/eceb46742416a02f6a0f8d92bc74468c/sandbox/processwrapper-sandbox/121/execroot/scql/external/org_pocoproject_poco/Data/ODBC/include/Poco/Data/ODBC/Unicode.h:31:10: fatal error: sqlext.h: No such file or directory
   31 | #include <sqlext.h>
经过查找,在/usr/include下包含所需要的头文件,是不是编译的时候没有将/usr/include包含进去,向上查找日志,发现以下编译命令:
/root/miniconda3/bin/gcc -DPOCO_ENABLE_CPP11 -DPOCO_ENABLE_CPP14 -DPOCO_HAVE_FD_EPOLL -DPOCO_OS_FAMILY_UNIX -DPOCO_STATIC -DTHREADSAFE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_REENTRANT -D_THREAD_SAFE -D_XOPEN_SOURCE=500 -I/root/.cache/bazel/_bazel_root/eceb46742416a02f6a0f8d92bc74468c/sandbox/processwrapper-sandbox/121/execroot/scql/external/org_pocoproject_poco/Data/ODBC/include -I/root/.cache/bazel/_bazel_root/eceb46742416a02f6a0f8d92bc74468c/sandbox/processwrapper-sandbox/121/execroot/scql/external/org_pocoproject_poco/Data/ODBC/src -I/root/.cache/bazel/_bazel_root/eceb46742416a02f6a0f8d92bc74468c/sandbox/processwrapper-sandbox/121/execroot/scql/external/org_pocoproject_poco/Data/include -I/root/.cache/bazel/_bazel_root/eceb46742416a02f6a0f8d92bc74468c/sandbox/processwrapper-sandbox/121/execroot/scql/external/org_pocoproject_poco/Foundation/include -U_FORTIFY_SOURCE -fstack-protector -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer -g0 -O2 -D_FORTIFY_SOURCE=1 -DNDEBUG -ffunction-sections -fdata-sections -std=c++14 -DBOOST_NO_CXX98_FUNCTION_BASE -fno-canonical-system-headers -Wno-builtin-macro-redefined -D__DATE__=\"redacted\" -D__TIMESTAMP__=\"redacted\" -D__TIME__=\"redacted\" -fdiagnostics-color=always -fopenmp -fPIC -std=c++17 -O3 -DNDEBUG -std=gnu++14 -MD -MT Data/ODBC/CMakeFiles/DataODBC.dir/src/ConnectionHandle.cpp.o -MF Data/ODBC/CMakeFiles/DataODBC.dir/src/ConnectionHandle.cpp.o.d -o Data/ODBC/CMakeFiles/DataODBC.dir/src/ConnectionHandle.cpp.o -c /root/.cache/bazel/_bazel_root/eceb46742416a02f6a0f8d92bc74468c/sandbox/processwrapper-sandbox/121/execroot/scql/external/org_pocoproject_poco/Data/ODBC/src/ConnectionHandle.cpp
In file included from /root/.cache/bazel/_bazel_root/eceb46742416a02f6a0f8d92bc74468c/sandbox/processwrapper-sandbox/121/execroot/scql/external/org_pocoproject_poco/Data/ODBC/include/Poco/Data/ODBC/ODBC.h:56,
                 from /root/.cache/bazel/_bazel_root/eceb46742416a02f6a0f8d92bc74468c/sandbox/processwrapper-sandbox/121/execroot/scql/external/org_pocoproject_poco/Data/ODBC/include/Poco/Data/ODBC/ConnectionHandle.h:21,
                 from /root/.cache/bazel/_bazel_root/eceb46742416a02f6a0f8d92bc74468c/sandbox/processwrapper-sandbox/121/execroot/scql/external/org_pocoproject_poco/Data/ODBC/src/ConnectionHandle.cpp:15:
/root/.cache/bazel/_bazel_root/eceb46742416a02f6a0f8d92bc74468c/sandbox/processwrapper-sandbox/121/execroot/scql/external/org_pocoproject_poco/Data/ODBC/include/Poco/Data/ODBC/Unicode.h:31:10: fatal error: sqlext.h: No such file or directory
   31 | #include <sqlext.h>
这里的包含目录确实没有/usr/include。
如何在scql中编译poco时将/usr/include传入?

deanzxl avatar Oct 27 '25 09:10 deanzxl

Stale issue message. Please comment to remove stale tag. Otherwise this issue will be closed soon.

github-actions[bot] avatar Nov 26 '25 09:11 github-actions[bot]