因为工作需要,需要使用ODBC访问oracle,下面是ODBC访问Oracle的具体配置 1.下载unixODBC和Oracle简易客户端软件包 1.1下载地址: Http://www.unixodbc.o
因为工作需要,需要使用ODBC访问oracle,下面是ODBC访问Oracle的具体配置
1.下载unixODBC和Oracle简易客户端软件包
1.1下载地址:
Http://www.unixodbc.org/
1.1.1下载文件:
unixODBC-2.3.0.tar.gz
2 Oracle ODBC Driver
2.1下载地址:
http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html
2.1.1下载文件:
instantclient-sqlplus-linux.x64-12.2.0.1.0.zip
instantclient-basic-linux.x64-12.2.0.1.0.zip
instantclient-sdk-linux.x64-12.2.0.1.0.zip
instantclient-jdbc-linux.x64-12.2.0.1.0.zip
instantclient-odbc-linux.x64-12.2.0.1.0-2.zip
instantclient-basiclite-linux.x64-12.2.0.1.0.zip
instantclient-tools-linux.x64-12.2.0.1.0.zip
将这些软件包上传到/soft目录
3.安装unixODBC(root用户)
#cd /soft
#tar xvf unixODBC-2.3.0.tar.gz
#cd /soft/unixODBC-2.3.0
#./configure
#make
#make install
(默认是被安装到/usr/local)
4.安装Oracle ODBC(root用户)
#cd /soft/
#unzip instantclient-sqlplus-linux.x64-12.2.0.1.0.zip
#unzip instantclient-basic-linux.x64-12.2.0.1.0.zip
#unzip instantclient-sdk-linux.x64-12.2.0.1.0.zip
#unzip instantclient-jdbc-linux.x64-12.2.0.1.0.zip
#unzip instantclient-odbc-linux.x64-12.2.0.1.0-2.zip
#unzip instantclient-basiclite-linux.x64-12.2.0.1.0.zip
#unzip instantclient-tools-linux.x64-12.2.0.1.0.zip
[root@dmks instantclient_12_2]# ./odbc_update_ini.sh /usr/local
*** ODBCINI environment variable not set,defaulting it to HOME directory!
更新操作完成后,会在/usr/local/etc/odbcinst.ini增加Oracle12C的驱动描述信息。
[root@dmks etc]# cat odbcinst.ini
[DM7 ODBC DRIVER]
Description = ODBC DRIVER FOR DM7
Driver = /dm_home/dmdbms/bin/libdodbc.so
[Oracle 12c ODBC driver]
Description = Oracle ODBC driver for Oracle 12c
Driver = /soft/instantclient_12_2/libsqora.so.12.1
Setup =
FileUsage =
CPTimeout =
CPReuse =
并且会在HOME目录下也就是/root,生成.odbc.ini文件,修改.odbc.ini文件
[root@dmks ~]# cat .odbc.ini
[OracleODBC-12c]
Application Attributes = T
Attributes = W
BatchAutocommitMode = IfAllSuccessful
BindAsFLOAT = F
CloseCursor = F
DisableDPM = F
DisableMTS = T
Driver = Oracle 12c ODBC driver
DSN = OracleODBC-12c
EXECSchemaopt =
EXECSyntax = T
Failover = T
FailoverDelay = 10
FailoverRetryCount = 10
FetchBufferSize = 64000
ForceWCHAR = F
Lobs = T
Longs = T
MaxLargeData = 0
MetadataIdDefault = F
QueryTimeout = T
ResultSets = T
ServerName = shardcat 与tnsnames.ora文件中的服务器一致
SQLGetData extensions = F
Translation DLL =
Translation Option = 0
DisableRULEHint = T
UserID =
StatementCache=F
CacheBufferSize=20
UseOCIDescribeAny=F
SQLTranslateErrors=F
MaxTokenSize=8192
AggregateSQLType=FLOAT
5.测试ODBC连接Oracle
[root@dmks ~]# isql OracleODBC-12c system xxzx7817600 -v
+---------------------------------------+
| Connected! |
| |
| sql-statement |
| help [tablename] |
| quit |
| |
+---------------------------------------+
SQL> select * from v$version;
+---------------------------------------------------------------------------------+-----------------------------------------+
| BANNER | CON_ID |
+---------------------------------------------------------------------------------+-----------------------------------------+
| Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production | 0 |
| PL/SQL Release 12.2.0.1.0 - Production | 0 |
| CORE 12.2.0.1.0 Production | 0
| TNS for Linux: Version 12.2.0.1.0 - Production | 0 |
| NLSRTL Version 12.2.0.1.0 - Production | 0 |
+---------------------------------------------------------------------------------+-----------------------------------------+
到此使用odbc连接Oracle的操作完成,还是很简单的。
--结束END--
本文标题: Linux Use ODBC Connect Oracle
本文链接: https://lsjlt.com/news/49255.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
2024-03-01
2024-03-01
2024-03-01
2024-03-01
2024-03-01
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0