使用unixODBC进行连接

时间:2018-12-17 02:42:59

标签: sap unixodbc

首先提供一些信息:

IgorReinCloud /opt/sap # find . -name *odbc*
./ASE-16_0/lib/pca/libPCAodbc.so
./ASE-16_0/symlib/pca/libPCAodbc.so
./log/odbc.log
./DBISQL-16_0/lib/jodbc4.jar
./DBISQL-16_0/bin/libdbjodbc16.so
./DBISQL-16_0/bin/libdbodbc16_r.so.1
./DBISQL-16_0/bin/libdbodbc16_r.so
./DBISQL-16_0/bin/libdbjodbc16.so.1
./DataAccess/ODBC/samples/odbcloblocator
./DataAccess/ODBC/samples/odbcloblocator/odbcloblocator.cpp
./DataAccess/ODBC/samples/odbcbatch
./DataAccess/ODBC/samples/odbcbatch/odbcbatch.cpp
./DataAccess/ODBC/sp/odbc_mda_1600000.sql
./DataAccess/ODBC/sp/odbc_mda_120.sql
./DataAccess/ODBC/sp/odbc_mda_150.sql
./DataAccess/ODBC/sp/odbc_mda_1600300.sql
./DataAccess/ODBC/sp/odbc_mda_125.sql
./DataAccess/ODBC/sp/odbc_mda_12503.sql
./DataAccess/ODBC/sp/odbc_mda_1570020.sql
./DataAccess/ODBC/sp/odbc_mda_1251.sql
./DataAccess/ODBC/sp/odbc_mda_1502.sql
./DataAccess/ODBC/sp/odbc_mda_157.sql
./DataAccess/ODBC/sp/install_odbc_sprocs
./DataAccess/bin/odbcversion
./DataAccess64/ODBC/samples/odbcloblocator
./DataAccess64/ODBC/samples/odbcloblocator/odbcloblocator.cpp
./DataAccess64/ODBC/samples/odbcbatch
./DataAccess64/ODBC/samples/odbcbatch/odbcbatch.cpp
./DataAccess64/ODBC/dm/lib64/libodbc.so
./DataAccess64/ODBC/dm/include/odbc.h
./DataAccess64/ODBC/dm/include/saodbc.h
./DataAccess64/ODBC/dm/include/unixodbc.h
./DataAccess64/ODBC/sp/odbc_mda_1600000.sql
./DataAccess64/ODBC/sp/odbc_mda_120.sql
./DataAccess64/ODBC/sp/odbc_mda_150.sql
./DataAccess64/ODBC/sp/odbc_mda_1600300.sql
./DataAccess64/ODBC/sp/odbc_mda_125.sql
./DataAccess64/ODBC/sp/odbc_mda_12503.sql
./DataAccess64/ODBC/sp/odbc_mda_1570020.sql
./DataAccess64/ODBC/sp/odbc_mda_1251.sql
./DataAccess64/ODBC/sp/odbc_mda_1502.sql
./DataAccess64/ODBC/sp/odbc_mda_157.sql
./DataAccess64/ODBC/sp/install_odbc_sprocs
./DataAccess64/bin/odbcversion

IgorReinCloud /opt/sap # ls -la /opt/sap/DBISQL-16_0/bin/libdbodbc16_r.so*
lrwxrwxrwx 1 root root       18 Dec 10 00:00 /opt/sap/DBISQL-16_0/bin/libdbodbc16_r.so -> libdbodbc16_r.so.1
-rwxr-xr-x 1 root root 12807188 Oct  6  2017 /opt/sap/DBISQL-16_0/bin/libdbodbc16_r.so.1
IgorReinCloud /opt/sap # 

IgorReinCloud /opt/sap # cat /etc/unixODBC/odbcinst.ini 
[ODBC]
Trace=yes
TraceFile=/tmp/sql.log

[Sybase]
Description=Native Sybase Driver
Driver=/opt/sap/DBISQL-16_0/bin/libdbodbc16_r.so
FileUsage=1

IgorReinCloud /opt/sap # cat /etc/unixODBC/odbc.ini 
[Sybase16]
Driver=Sybase
Description=Sybase 16 Native Driver
Trace=Yes
Server=localhost
Database=draft
TraceLog=/tmp/sql.log

现在来自sql.log:

[ODBC][626][1545013547.689228][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLConnect.c][3751]
        Entry:
            Connection = 0x55bf7486bb50
            Server Name = [Sybase16][length = 8 (SQL_NTS)]
            User Name = [sa][length = 2 (SQL_NTS)]
            Authentication = [******][length = 6 (SQL_NTS)]
        UNICODE Using encoding ASCII 'UTF8' and UNICODE 'UTF16LE'

[ODBC][626][1545013547.691755][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLConnect.c][1138]Can't open lib '/opt/sap/DBISQL-16_0/bin/libdbodbc16_r.so' : file not found

现在我不明白的错误消息。我显然有要使用的库,但是它返回File not found

有人可以说明一下吗?

TIA!

[编辑]

尝试使用

Driver=/opt/sap/DataAccess64/ODBC/dm/lib64/libodbc.so

我遇到了另一个错误:

[ODBC][23752][1545017763.126680][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLConnect.c][3751]
                Entry:
                        Connection = 0x561f041e2b50
                        Server Name = [Sybase16][length = 8 (SQL_NTS)]
                        User Name = [sa][length = 2 (SQL_NTS)]
                        Authentication = [******][length = 6 (SQL_NTS)]
                UNICODE Using encoding ASCII 'UTF8' and UNICODE 'UTF16LE'

                DIAG [IM002] [SAP][ODBC Driver Manager] Unable to load resource file

[ODBC][23752][1545017763.140998][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLConnect.c][4123]
                Exit:[SQL_ERROR]

[/ EDIT]

0 个答案:

没有答案