NJS-045 DPI-1047: 64-bit Oracle Client library cannot be loaded 에러 발생 시 아래와 같이 해결
https://blog.kimsfactory.com/entry/Ubuntu-1604-%EC%9A%B0%EB%B6%84%ED%88%AC-%EC%98%A4%EB%9D%BC%ED%81%B4-%ED%81%B4%EB%9D%BC%EC%9D%B4%EC%96%B8%ED%8A%B8-%EC%84%A4%EC%B9%98-sqlplus-php56-php70-oracle-client-install
[Ubuntu 16.04] 우분투 오라클 클라이언트 설치 - sqlplus php5.6 php7.0 oracle client install
이전에 포스팅 했던 Ubuntu Server 16.04.1 LTS LAMP (Apache2, Mysql5.5, PHP5/7) 설치하기 를 기본으로 오라클 클라이언트 설치를 진행해본다.. [Ubuntu 16.04] 우분투 오라클 클라이언트 설치 - sqlplus php5.6..
blog.kimsfactory.com
1. download oracle instantclient rpm
https://oracle.github.io/odpi/doc/installation.html
ODPI-C Installation — ODPI-C v3.3.0
To use ODPI-C in your own project, download its source from GitHub. A sample Makefile is provided if you wish to build ODPI-C as a shared library. Otherwise, add the ODPI-C source code to your project. On Windows, Visual Studio 2008 or higher is required.
oracle.github.io
# example
wget http://yum.oracle.com/repo/OracleLinux/OL7/oracle/instantclient/x86_64/getPackage/oracle-instantclient19.3-basic-19.3.0.0.0-1.x86_64.rpm
2. install alien
apt-get install alien
3. install oracle instantclient rpm
alien -i ./oracle-instantclient19.3-basic-19.3.0.0.0-1.x86_64.rpm
4. install django-db-connection-pool, cx_Oracle
pip install django-db-connection-pool==1.0.1 cx_Oracle==7.2.0
5. setting django
DATABASES = {
'oracle': {
'ENGINE': 'django.db.backends.oracle',
'NAME': os.environ.get('ORACLE_DB_NAME', 'DB명'),
'USER': os.environ.get('ORACLE_DB_USER', 'USER명'),
'PASSWORD': os.environ.get('ORACLE_DB_PASSWORD', '패스워드'),
'HOST': os.environ.get('ORACLE_DB_HOST', '서버IP'),
'PORT': os.environ.get('ORACLE_DB_PORT', '서버포트'),
'POOL_OPTIONS': {
'POOL_SIZE': 10,
'MAX_OVERFLOW': 10
}
}
}
6. use oracle connection
from django.db import connections
sql = 'SELECT 1 FROM DUAL'
cursor = connections['oracle'].cursor()
row = cursor.fetchone()