下午好。无法通过 isql 连接到 oracle。
[08004][unixODBC][Oracle][ODBC][Ora]ORA-12154: TNS:could not resolve the connect identifier specified
[ISQL]ERROR: Could not SQLConnect
/etc/odbc.ini
[mthbz]
Driver= ORACLE
DSN= mthbz
ServerName= mth
UserID= dan
Password= dan
/etc/odbcinst.ini
[ORACLE]
Description = Oracle ODBC Connection
Driver = /usr/lib/oracle/12.2/client64/lib/libsqora.so.12.1
Setup =
FileUsage =
/usr/lib/oracle/12.2/client64/network/admin/tnsnames.ora
MTHBZ =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.98.10.20)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = mth)
)
)
环境
ORACLE_HOME=/usr/lib/oracle/12.2/client64
ODBCINI=/etc/odbc.ini
LD_LIBRARY_PATH=/usr/lib/oracle/12.2/client64/lib:/usr/lib64:/usr/lib:/usr/lib/oracle/12.2/client64/bin
ODBCSYSINI=/etc
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/oracle/12.2/client64/bin:/usr/lib/oracle/12.2/client64/bin
根据评论回答需要修复 ODBC:
中指定的
ServerName
别名来自TNS
,并已指定SERVICE_NAME