因?yàn)楣ぷ餍枰?,需要使用ODBC訪問(wèn)Oracle,下面是ODBC訪問(wèn)Oracle的具體配置
1.下載unixODBC和Oracle簡(jiǎn)易客戶端軟件包
1.1下載地址:
創(chuàng)新互聯(lián)長(zhǎng)期為超過(guò)千家客戶提供的網(wǎng)站建設(shè)服務(wù),團(tuán)隊(duì)從業(yè)經(jīng)驗(yàn)10年,關(guān)注不同地域、不同群體,并針對(duì)不同對(duì)象提供差異化的產(chǎn)品和服務(wù);打造開放共贏平臺(tái),與合作伙伴共同營(yíng)造健康的互聯(lián)網(wǎng)生態(tài)環(huán)境。為民勤企業(yè)提供專業(yè)的網(wǎng)站設(shè)計(jì)制作、網(wǎng)站設(shè)計(jì),民勤網(wǎng)站改版等技術(shù)服務(wù)。擁有十年豐富建站經(jīng)驗(yàn)和眾多成功案例,為您定制開發(fā)。
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
(默認(rèn)是被安裝到/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!
更新操作完成后,會(huì)在/usr/local/etc/odbcinst.ini增加Oracle12C的驅(qū)動(dòng)描述信息。
[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 =
并且會(huì)在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文件中的服務(wù)器一致 SQLGetData extensions = F Translation DLL = Translation Option = 0 DisableRULEHint = T UserID = StatementCache=F CacheBufferSize=20 UseOCIDescribeAny=F SQLTranslateErrors=F MaxTokenSize=8192 AggregateSQLType=FLOAT
5.測(cè)試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的操作完成,還是很簡(jiǎn)單的。