Soci库linux下的编译方法
Soci库的linux编译方法
1、下载soci库源码
2、在目标机器上配置数据库环境
以oracle为例:(其他数据库只需要简单安装客户端即可)
下载oracle客户端安装包
oracle-instantclient-basic-12.1.0.5-1.i386.rpmoracle-instantclient-devel-12.1.0.5-1.i386.rpmoracle-instantclient-sqlplus-12.1.0.5-1.i386.rpm
按如上的顺序安装三包
# rmp -ivh 带安装包名
C)配置环境变量
# vi /etc/profile 编辑如下
export ORACLE_HOME=/usr/lib/oracle/12.1/client
export LD_LIBRARY_PATH=:$ORACLE_HOME/lib:/usr/local/lib:$LD_LIBRARY_PATH:.
export SQLPATH=/usr/lib/oracle/12.1/client/network/admin
export TNS_ADMIN=/usr/lib/oracle/12.1/client/network/admin
export PATH=$PATH:${ORACLE_HOME}bin:.
export ORACLE_SID=PLAT
D)配置监听文件
#cd /usr/lib/oracle/12.1/client/network/admin
拷贝如下三文件到上面目录
listener.ora sqlnet.ora tnsnames.ora
编辑文件内容如下:
listener.ora文件:
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = XTPLAT)
(ORACLE_HOME = /usr/lib/oracle/12.1/client)
(PROGRAM = extproc)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.3.220)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
)
)
sqlnet.ora文件:
SQLNET.AUTHENTICATION_SERVICES= (NONE)
NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)
tnsnames.ora文件:
XTPLAT =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.3.220)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = XTPlat)
)
)
EXTPROC_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
)
(CONNECT_DATA =
(SID = PLSExtProc)
(PRESENTATION = RO)
)
)
E) 环境变量没设置好
#sqlplus openVone/openVone@XTPLAT
能出现如下:
[root@localhost admin]# sqlplus openVone/openVone@XTPLAT
SQL*Plus: Release 12.1.0.2.0 Production on Fri Apr 24 10:49:59 2015
Copyright (c) 1982, 2014, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL>
配置ok
3、解压soci源码soci-x.y.z到目