Go Oracle Driver Setting - Linux
Go Oracle Driver Setting How To
Go - Lang : Oracle Access used by go-oci8 on Linux
Official URL
#1. Instant Client 설치 instantclient-basic-linux.x64-11.2.0.4.0.zip instantclient-sdk-linux.x64-11.2.0.4.0.zip
unzip 으로 모두 압축해제 ( tar xvpf )
#2. root권한으로 심볼릭 링크 생성 cd /home/pjkwon/Go/instantclient_11_2 ln -s libclntsh.so.11.1 libclntsh.so
#3. root권한으로 oci8.pc 생성
vi /usr/lib/pkgconfig/oci8.pc
prefix=/home/pjkwon/Go/instantclient_11_2
libdir=${prefix}
includedir=${prefix}/sdk/include/
Name: OCI
Description: Oracle database engine
Version: 11.2
Libs: -L${libdir} -lclntsh
Libs.private:
Cflags: -I${includedir}
#4. home디렉토리 .bash_profile 생성
PATH=$PATH:$HOME/.local/bin:$HOME/bin
export PKG_CONFIG_PATH=/usr/lib/pkgconfig
export GOPATH=/home/pjkwon/Go
export PATH=$PATH:/usr/local/go/bin
export ORACLE_HOME=/home/pjkwon/Go/instantclient_11_2
export PATH=$PATH:$ORACLE_HOME
export LD_LIBRARY_PATH=$ORACLE_HOME
export NLS_LANG=American_America.KO16MSWIN949
export TNS_ADMIN=$ORACLE_HOME/network/admin
export ORACLE_SID=ORCL
#5. go-oci8 설치
cd $GOPATH/src
go get github.com/mattn/go-oci8
#6. Example 실행
cd $GOPATH/src/github.com/mattn/go-oci8/_example
go run oracle.go scott/tiger@localhost:1521/orcl