OSX High Sierra 에 오라클 인스턴트 클라이언트 및 oci8 설치

 

 

1. 오라클 사이트에서 아래 3개 파일 다운로드

 

instantclient-basic-maxos.x64-12.2.0.1.zip

instantclient-sqlplus-maxos.x64-12.2.0.1.zip

instantclient-sdk-maxos.x64-12.2.0.1.zip

 

2. 압축을 푼다.

 

/usr/local/instantclient/12.2.0.1 폴더에 모든 압축을 풀어 놓는다.

 

폴더 구조는 아래와 같다.

 

-rw-rw-rw-@ 1 ellord  staff        400 Jan  9 23:52 BASIC_README

-rw-rw-rw-@ 1 ellord  staff        404 Jan  9 23:53 SQLPLUS_README

-rwxrwxrwx@ 1 ellord  staff      10036 Jan  9 23:52 adrci

-rwxrwxrwx@ 1 ellord  staff      40360 Jan  9 23:52 genezi

-r-xr-xr-x@ 1 ellord  staff        342 Apr 24  2015 glogin.sql

lrwxr-xr-x@ 1 ellord  staff         20 May 31 23:28 libclntsh.dylib -> libclntsh.dylib.12.1

-rwxrwxrwx@ 1 ellord  staff   85621532 Jan  9 23:51 libclntsh.dylib.12.1

-rwxrwxrwx@ 1 ellord  staff    4685408 Jan  9 23:51 libclntshcore.dylib.12.1

-r-xr-xr-x@ 1 ellord  staff    8179072 Jun 28  2017 libnnz12.dylib

lrwxr-xr-x@ 1 ellord  staff         18 May 31 23:28 libocci.dylib -> libocci.dylib.12.1

-rwxrwxrwx@ 1 ellord  staff    1465312 Jan  9 23:44 libocci.dylib.12.1

-rwxrwxrwx@ 1 ellord  staff  124769196 Jan  9 23:52 libociei.dylib

-r-xr-xr-x@ 1 ellord  staff     151748 Aug  8  2017 libocijdbc12.dylib

-r-xr-xr-x@ 1 ellord  staff     237780 Jan  8 05:33 libons.dylib

-rwxrwxrwx@ 1 ellord  staff      84988 Jan  9 23:40 liboramysql12.dylib

-rwxrwxrwx@ 1 ellord  staff    1267088 Jan  9 23:13 libsqlplus.dylib

-r-xr-xr-x@ 1 ellord  staff    1639388 Jul 12  2017 libsqlplusic.dylib

-r--r--r--@ 1 ellord  staff    4036257 Dec 13  2016 ojdbc8.jar

drwxrwxrwx@ 8 ellord  staff        256 Jan  9 23:53 sdk

-rwxr-xr-x@ 1 ellord  staff       8480 Jan  9 23:53 sqlplus

-rwxrwxrwx@ 1 ellord  staff     146084 Jan  9 23:52 uidrvci

 

-r--r--r--@ 1 ellord  staff      74230 Jan 26  2017 xstreams.jar

 

 

3. 링크를 걸어준다.

 

sudo ln -sF /usr/local/instantclient/12.2.0.1/sdk/include/*.h /usr/local/include/

sudo ln -sF /usr/local/instantclient/12.2.0.1/sqlplus /usr/local/bin/

sudo ln -sF /usr/local/instantclient/12.2.0.1/*.dylib /usr/local/lib/

sudo ln -sf /usr/local/instantclient/12.2.0.1/*.dylib.12.1 /usr/local/lib/

sudo ln -sF /usr/local/lib/libclntsh.dylib.12.1 /usr/local/lib/libclntsh.dylib

 

 

 

 

4. sqlplus로 오라클 서버에 접속해 본다.

 

sudo /usr/local/bin/sqlplus 유저명/비밀번호@서버IP:port/SID

 

 

 

5. pecl로 oci8 설치

 

 

sudo pecl install oci8-2.0.10    #php 5.x

 

sudo pecl install oci8                #php 7

 

입력창에서 아래와 같이 입력하고 엔터

 

instantclient,/usr/local/lib

 

 

 

sh-3.2# pecl install oci8

 

Warning: Declaration of PEAR_Installer::download($packages, $options, &$config, &$installpackages, &$errors, $installed = false, $willinstall = false, $state = false) should be compatible with & PEAR_Downloader::download($params) in Installer.php on line 43

 

Warning: Declaration of PEAR_Installer::download($packages, $options, &$config, &$installpackages, &$errors, $installed = false, $willinstall = false, $state = false) should be compatible with & PEAR_Downloader::download($params) in /usr/local/pear/share/pear/PEAR/Installer.php on line 43

WARNING: channel "pecl.php.net" has updated its protocols, use "pecl channel-update pecl.php.net" to update

downloading oci8-2.1.8.tgz ...

Starting to download oci8-2.1.8.tgz (194,154 bytes)

.....done: 194,154 bytes

 

Warning: Declaration of & PEAR_PackageFile_Parser_v2::parse($data, $file, $archive = false, $class = 'PEAR_Packa...') should be compatible with PEAR_XMLParser::parse($data) in v2.php on line 113

 

Warning: Declaration of & PEAR_PackageFile_Parser_v2::parse($data, $file, $archive = false, $class = 'PEAR_Packa...') should be compatible with PEAR_XMLParser::parse($data) in /usr/local/pear/share/pear/PEAR/PackageFile/Parser/v2.php on line 113

 

Warning: Declaration of PEAR_Builder::log($level, $msg) should be compatible with PEAR_Common::log($level, $msg, $append_crlf = true) in Builder.php on line 489

 

Warning: Declaration of PEAR_Builder::log($level, $msg) should be compatible with PEAR_Common::log($level, $msg, $append_crlf = true) in /usr/local/pear/share/pear/PEAR/Builder.php on line 489

11 source files, building

running: phpize

Configuring for:

PHP Api Version:         20160303

Zend Module Api No:      20160303

Zend Extension Api No:   320160303

Please provide the path to the ORACLE_HOME directory. Use 'instantclient,/path/to/instant/client/lib' if you're compiling with Oracle Instant Client [autodetect] : instantclient,/usr/local/lib

building in /private/tmp/pear/install/pear-build-root4n2lSS/oci8-2.1.8

running: /private/tmp/pear/install/oci8/configure --with-oci8=instantclient,/usr/local/lib

checking for grep that handles long lines and -e... /usr/bin/grep

checking for egrep... /usr/bin/grep -E

checking for a sed that does not truncate output... /usr/bin/sed

checking for cc... cc

checking whether the C compiler works... yes

checking for C compiler default output file name... a.out

checking for suffix of executables...

checking whether we are cross compiling... no

checking for suffix of object files... o

checking whether we are using the GNU C compiler... yes

checking whether cc accepts -g... yes

checking for cc option to accept ISO C89... none needed

checking how to run the C preprocessor... cc -E

checking for icc... no

checking for suncc... no

checking whether cc understands -c and -o together... yes

checking for system library directory... lib

checking if compiler supports -R... no

checking if compiler supports -Wl,-rpath,... yes

checking build system type... x86_64-apple-darwin17.5.0

checking host system type... x86_64-apple-darwin17.5.0

checking target system type... x86_64-apple-darwin17.5.0

checking for PHP prefix... /usr

checking for PHP includes... -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib

checking for PHP extension directory... /usr/lib/php/extensions/no-debug-non-zts-20160303

checking for PHP installed headers prefix... /usr/include/php

checking if debug is enabled... no

checking if zts is enabled... no

checking for re2c... no

configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.

checking for gawk... no

checking for nawk... no

checking for awk... awk

checking if awk is broken... no

checking for Oracle Database OCI8 support... yes, shared

checking PHP version... 7.1.14, ok

checking OCI8 DTrace support... no

checking size of long int... 8

checking checking if we're on a 64-bit platform... yes

checking Oracle Instant Client directory... /usr/local/lib

checking Oracle Instant Client SDK header directory... /usr/local/include

checking Oracle Instant Client library version compatibility... 12.1

checking for ld used by cc... /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld

checking if the linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) is GNU ld... no

checking for /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld option to reload object files... -r

checking for BSD-compatible nm... /usr/bin/nm -B

checking whether ln -s works... yes

checking how to recognize dependent libraries... pass_all

checking dlfcn.h usability... yes

checking dlfcn.h presence... yes

checking for dlfcn.h... yes

checking the maximum length of command line arguments... 196608

checking command to parse /usr/bin/nm -B output from cc object... ok

checking for objdir... .libs

checking for ar... ar

checking for ranlib... ranlib

checking for strip... strip

checking for dsymutil... dsymutil

checking for nmedit... nmedit

checking for -single_module linker flag... yes

checking for -exported_symbols_list linker flag... yes

checking if cc supports -fno-rtti -fno-exceptions... yes

checking for cc option to produce PIC... -fno-common

checking if cc PIC flag -fno-common works... yes

checking if cc static flag -static works... no

checking if cc supports -c -o file.o... yes

checking whether the cc linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) supports shared libraries... yes

checking dynamic linker characteristics... darwin17.5.0 dyld

checking how to hardcode library paths into programs... immediate

checking whether stripping libraries is possible... yes

checking if libtool supports shared libraries... yes

checking whether to build shared libraries... yes

checking whether to build static libraries... no

 

creating libtool

appending configuration tag "CXX" to libtool

configure: creating ./config.status

config.status: creating config.h

running: make

/bin/sh /private/tmp/pear/install/pear-build-root4n2lSS/oci8-2.1.8/libtool --mode=compile cc  -I. -I/private/tmp/pear/install/oci8 -DPHP_ATOM_INC -I/private/tmp/pear/install/pear-build-root4n2lSS/oci8-2.1.8/include -I/private/tmp/pear/install/pear-build-root4n2lSS/oci8-2.1.8/main -I/private/tmp/pear/install/oci8 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/usr/local/include  -DHAVE_CONFIG_H  -g -O2   -c /private/tmp/pear/install/oci8/oci8.c -o oci8.lo

mkdir .libs

 cc -I. -I/private/tmp/pear/install/oci8 -DPHP_ATOM_INC -I/private/tmp/pear/install/pear-build-root4n2lSS/oci8-2.1.8/include -I/private/tmp/pear/install/pear-build-root4n2lSS/oci8-2.1.8/main -I/private/tmp/pear/install/oci8 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/usr/local/include -DHAVE_CONFIG_H -g -O2 -c /private/tmp/pear/install/oci8/oci8.c  -fno-common -DPIC -o .libs/oci8.o

/bin/sh /private/tmp/pear/install/pear-build-root4n2lSS/oci8-2.1.8/libtool --mode=compile cc  -I. -I/private/tmp/pear/install/oci8 -DPHP_ATOM_INC -I/private/tmp/pear/install/pear-build-root4n2lSS/oci8-2.1.8/include -I/private/tmp/pear/install/pear-build-root4n2lSS/oci8-2.1.8/main -I/private/tmp/pear/install/oci8 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/usr/local/include  -DHAVE_CONFIG_H  -g -O2   -c /private/tmp/pear/install/oci8/oci8_lob.c -o oci8_lob.lo

 cc -I. -I/private/tmp/pear/install/oci8 -DPHP_ATOM_INC -I/private/tmp/pear/install/pear-build-root4n2lSS/oci8-2.1.8/include -I/private/tmp/pear/install/pear-build-root4n2lSS/oci8-2.1.8/main -I/private/tmp/pear/install/oci8 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/usr/local/include -DHAVE_CONFIG_H -g -O2 -c /private/tmp/pear/install/oci8/oci8_lob.c  -fno-common -DPIC -o .libs/oci8_lob.o

/bin/sh /private/tmp/pear/install/pear-build-root4n2lSS/oci8-2.1.8/libtool --mode=compile cc  -I. -I/private/tmp/pear/install/oci8 -DPHP_ATOM_INC -I/private/tmp/pear/install/pear-build-root4n2lSS/oci8-2.1.8/include -I/private/tmp/pear/install/pear-build-root4n2lSS/oci8-2.1.8/main -I/private/tmp/pear/install/oci8 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/usr/local/include  -DHAVE_CONFIG_H  -g -O2   -c /private/tmp/pear/install/oci8/oci8_statement.c -o oci8_statement.lo

 cc -I. -I/private/tmp/pear/install/oci8 -DPHP_ATOM_INC -I/private/tmp/pear/install/pear-build-root4n2lSS/oci8-2.1.8/include -I/private/tmp/pear/install/pear-build-root4n2lSS/oci8-2.1.8/main -I/private/tmp/pear/install/oci8 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/usr/local/include -DHAVE_CONFIG_H -g -O2 -c /private/tmp/pear/install/oci8/oci8_statement.c  -fno-common -DPIC -o .libs/oci8_statement.o

/bin/sh /private/tmp/pear/install/pear-build-root4n2lSS/oci8-2.1.8/libtool --mode=compile cc  -I. -I/private/tmp/pear/install/oci8 -DPHP_ATOM_INC -I/private/tmp/pear/install/pear-build-root4n2lSS/oci8-2.1.8/include -I/private/tmp/pear/install/pear-build-root4n2lSS/oci8-2.1.8/main -I/private/tmp/pear/install/oci8 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/usr/local/include  -DHAVE_CONFIG_H  -g -O2   -c /private/tmp/pear/install/oci8/oci8_collection.c -o oci8_collection.lo

 cc -I. -I/private/tmp/pear/install/oci8 -DPHP_ATOM_INC -I/private/tmp/pear/install/pear-build-root4n2lSS/oci8-2.1.8/include -I/private/tmp/pear/install/pear-build-root4n2lSS/oci8-2.1.8/main -I/private/tmp/pear/install/oci8 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/usr/local/include -DHAVE_CONFIG_H -g -O2 -c /private/tmp/pear/install/oci8/oci8_collection.c  -fno-common -DPIC -o .libs/oci8_collection.o

/bin/sh /private/tmp/pear/install/pear-build-root4n2lSS/oci8-2.1.8/libtool --mode=compile cc  -I. -I/private/tmp/pear/install/oci8 -DPHP_ATOM_INC -I/private/tmp/pear/install/pear-build-root4n2lSS/oci8-2.1.8/include -I/private/tmp/pear/install/pear-build-root4n2lSS/oci8-2.1.8/main -I/private/tmp/pear/install/oci8 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/usr/local/include  -DHAVE_CONFIG_H  -g -O2   -c /private/tmp/pear/install/oci8/oci8_interface.c -o oci8_interface.lo

 cc -I. -I/private/tmp/pear/install/oci8 -DPHP_ATOM_INC -I/private/tmp/pear/install/pear-build-root4n2lSS/oci8-2.1.8/include -I/private/tmp/pear/install/pear-build-root4n2lSS/oci8-2.1.8/main -I/private/tmp/pear/install/oci8 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/usr/local/include -DHAVE_CONFIG_H -g -O2 -c /private/tmp/pear/install/oci8/oci8_interface.c  -fno-common -DPIC -o .libs/oci8_interface.o

/bin/sh /private/tmp/pear/install/pear-build-root4n2lSS/oci8-2.1.8/libtool --mode=compile cc  -I. -I/private/tmp/pear/install/oci8 -DPHP_ATOM_INC -I/private/tmp/pear/install/pear-build-root4n2lSS/oci8-2.1.8/include -I/private/tmp/pear/install/pear-build-root4n2lSS/oci8-2.1.8/main -I/private/tmp/pear/install/oci8 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/usr/local/include  -DHAVE_CONFIG_H  -g -O2   -c /private/tmp/pear/install/oci8/oci8_failover.c -o oci8_failover.lo

 cc -I. -I/private/tmp/pear/install/oci8 -DPHP_ATOM_INC -I/private/tmp/pear/install/pear-build-root4n2lSS/oci8-2.1.8/include -I/private/tmp/pear/install/pear-build-root4n2lSS/oci8-2.1.8/main -I/private/tmp/pear/install/oci8 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/usr/local/include -DHAVE_CONFIG_H -g -O2 -c /private/tmp/pear/install/oci8/oci8_failover.c  -fno-common -DPIC -o .libs/oci8_failover.o

/bin/sh /private/tmp/pear/install/pear-build-root4n2lSS/oci8-2.1.8/libtool --mode=link cc -DPHP_ATOM_INC -I/private/tmp/pear/install/pear-build-root4n2lSS/oci8-2.1.8/include -I/private/tmp/pear/install/pear-build-root4n2lSS/oci8-2.1.8/main -I/private/tmp/pear/install/oci8 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/usr/local/include  -DHAVE_CONFIG_H  -g -O2   -o oci8.la -export-dynamic -avoid-version -prefer-pic -module -rpath /private/tmp/pear/install/pear-build-root4n2lSS/oci8-2.1.8/modules  oci8.lo oci8_lob.lo oci8_statement.lo oci8_collection.lo oci8_interface.lo oci8_failover.lo -Wl,-rpath,/usr/local/lib -L/usr/local/lib -lclntsh

cc ${wl}-flat_namespace ${wl}-undefined ${wl}suppress -o .libs/oci8.so -bundle  .libs/oci8.o .libs/oci8_lob.o .libs/oci8_statement.o .libs/oci8_collection.o .libs/oci8_interface.o .libs/oci8_failover.o  -L/usr/local/lib -lclntsh  -Wl,-rpath -Wl,/usr/local/lib

dsymutil .libs/oci8.so || :

creating oci8.la

(cd .libs && rm -f oci8.la && ln -s ../oci8.la oci8.la)

/bin/sh /private/tmp/pear/install/pear-build-root4n2lSS/oci8-2.1.8/libtool --mode=install cp ./oci8.la /private/tmp/pear/install/pear-build-root4n2lSS/oci8-2.1.8/modules

cp ./.libs/oci8.so /private/tmp/pear/install/pear-build-root4n2lSS/oci8-2.1.8/modules/oci8.so

cp ./.libs/oci8.lai /private/tmp/pear/install/pear-build-root4n2lSS/oci8-2.1.8/modules/oci8.la

----------------------------------------------------------------------

Libraries have been installed in:

   /private/tmp/pear/install/pear-build-root4n2lSS/oci8-2.1.8/modules

 

If you ever happen to want to link against installed libraries

in a given directory, LIBDIR, you must either use libtool, and

specify the full pathname of the library, or use the `-LLIBDIR'

flag during linking and do at least one of the following:

   - add LIBDIR to the `DYLD_LIBRARY_PATH' environment variable

     during execution

 

See any operating system documentation about shared libraries for

more information, such as the ld(1) and ld.so(8) manual pages.

----------------------------------------------------------------------

 

Build complete.

Don't forget to run 'make test'.

 

running: make INSTALL_ROOT="/private/tmp/pear/install/pear-build-root4n2lSS/install-oci8-2.1.8" install

Installing shared extensions:     /private/tmp/pear/install/pear-build-root4n2lSS/install-oci8-2.1.8/usr/lib/php/extensions/no-debug-non-zts-20160303/

running: find "/private/tmp/pear/install/pear-build-root4n2lSS/install-oci8-2.1.8" | xargs ls -dils

14107085   0 drwxr-xr-x  3 root  wheel      96 Jun  1 00:24 /private/tmp/pear/install/pear-build-root4n2lSS/install-oci8-2.1.8

14107435   0 drwxr-xr-x  3 root  wheel      96 Jun  1 00:24 /private/tmp/pear/install/pear-build-root4n2lSS/install-oci8-2.1.8/usr

14107436   0 drwxr-xr-x  3 root  wheel      96 Jun  1 00:24 /private/tmp/pear/install/pear-build-root4n2lSS/install-oci8-2.1.8/usr/lib

14107437   0 drwxr-xr-x  3 root  wheel      96 Jun  1 00:24 /private/tmp/pear/install/pear-build-root4n2lSS/install-oci8-2.1.8/usr/lib/php

14107438   0 drwxr-xr-x  3 root  wheel      96 Jun  1 00:24 /private/tmp/pear/install/pear-build-root4n2lSS/install-oci8-2.1.8/usr/lib/php/extensions

14107439   0 drwxr-xr-x  3 root  wheel      96 Jun  1 00:24 /private/tmp/pear/install/pear-build-root4n2lSS/install-oci8-2.1.8/usr/lib/php/extensions/no-debug-non-zts-20160303

14107440 352 -rwxr-xr-x  1 root  wheel  176164 Jun  1 00:24 /private/tmp/pear/install/pear-build-root4n2lSS/install-oci8-2.1.8/usr/lib/php/extensions/no-debug-non-zts-20160303/oci8.so

 

Build process completed successfully

Installing '/usr/lib/php/extensions/no-debug-non-zts-20160303/oci8.so'

 

 

 

 

6. /usr/lib/php/extensions/no-debug-non-zts-20160303/ 위치에 oci8.so 가 만들어졌다.

 

 

 

7. MAMP php extensions에 oci8.so 추가

 

/Applications/MAMP/bin/php/php7.1.8/lib/php/extensions/oci8.so

 

 

 

 

8. MAMP를 재시작하고 phpinfo를 찍어본다.

 

 

992C36335B112203317C65

 

 

 

9. 끝.

 

'Mac' 카테고리의 다른 글

원격 타임머신 백업 두번째  (0) 2019.01.08
디스크유틸리티에서 파티션 비활성화 될 때.  (0) 2019.01.08
show hidden files in OSX eclipse  (0) 2019.01.08
OSX JDK9 설치 후 Eclipse 시작에러  (0) 2018.06.07
PECL/PEAR 설치  (0) 2018.06.01
블로그 이미지

엘로드넷

,

맥 이클립스에서 숨김파일 보기

 

1. 프로젝트 익스플로러에서 역삼각형 아이콘을 클릭하면 아래와 같은 메뉴가 나온다.

 

41610489ff56d4ebcccc1a8585b893e0_1534145320_3368.png
 

2. Filters and Customization... 으로 들어간다.

 

기본적으로 아래와 같이 되어 있다.

 

41610489ff56d4ebcccc1a8585b893e0_1534145369_4311.png
 

 

숨김파일(. 으로 시작되는 파일들..) 을 보려면 

.* resources 에 체크 해제한다.

 

 

 

 

체크되어 있는 상태

 

41610489ff56d4ebcccc1a8585b893e0_1534145479_7118.png
 

 

 

체크 해제된 상태.

 

41610489ff56d4ebcccc1a8585b893e0_1534145506_4031.png
 

 

.htaccess 와 같은 파일들이 보인다.

 

 

끝.

 

블로그 이미지

엘로드넷

,

JSP htmlspecialchars

JAVA 2019. 1. 8. 21:53

JSP htmlspecialchars

 

 

StringBuffer sb = new StringBuffer();

for(int i=0; i<content.length(); i++){

char c = content.charAt(i);

  switch (c) {

    case '<' : 

      sb.append("<");

      break;

    case '>' : 

      sb.append(">");

      break;

    case '&' :

      sb.append("&");

      break;

    case '"' :

      sb.append(""");

      break;

    case '\'' :

      sb.append("'");

      break;

    default:

      sb.append(c);

 

}

}



블로그 이미지

엘로드넷

,

JSP 확장자 구하기

JAVA 2019. 1. 8. 21:53

JSP 확장자 구하기 : 

 

String filePath = "/www/test.jsp";
   int pos = filePath.lastIndexOf( "." );
   String fileExt = filePath.substring( pos + 1 );
   out.println("파일확장자는: "+fileExt);



블로그 이미지

엘로드넷

,

로그인 ROLE에 따라 특정 메뉴 보이기/숨기기

 

 

1. pom.xml 확인

<dependency>

<groupId>egovframework.rte</groupId>

<artifactId>egovframework.rte.fdl.security</artifactId>

<version>${egovframework.rte.version}</version>

 

</dependency>

 

2. jsp 파일


<%@ taglib uri="http://www.springframework.org/security/tags" prefix="sec" %>



<!-- 관리자 로그인 중-->

<sec:authorize access="hasRole('ROLE_ADMIN')">

<button>관리자접속중</button>

</sec:authorize>  


<!-- 로그인 전 -->

<sec:authorize access="isAnonymous()">

<button>로그인하세요.</button>

</sec:authorize>


<!-- 사용자 로그인 중 -->

<sec:authorize access="isAuthenticated()">

<button>로그인하세요.</button>

</sec:authorize>




* 추가 표현들


hasRole([role])특정한 롤을 가지고 있는 경우 true
hasAnyRole([role1,role2])복수의 롤을 가지고 있는 경우 true
principalAllows direct access to the principal object representing the current user
authenticationAllows direct access to the current Authentication object obtained from the SecurityContext
permitAllAlways evaluates to true
denyAllAlways evaluates to false
isAnonymous()Returns true if the current principal is an anonymous user
isRememberMe()Returns true if the current principal is a remember-me user
isAuthenticated()Returns true if the user is not anonymous
isFullyAuthenticated()Returns true if the user is not an anonymous or a remember-me user



블로그 이미지

엘로드넷

,

서버환경 : 

Windows Server 2016 64bit

JDK가 설치되어 있어야 한다.

 

 

 

1. 톰캣 다운로드

 

http://tomcat.apache.org

 

64-bit Windows zip 을 다운로드 받는다.

 

5e30bf3087ef5aed6fa37887eea01326_1542681643_656.png
 

 

 

 

2. 압축풀어서 적당한 곳에 위치시킨다.

 

C:\Program Files\Apache Software Foundation 폴더에 

 

apache-tomcat-8.0.531

apache-tomcat-8.0.532

 

와 같이 다른 이름으로 압축을 풀어준다.

 

현재로선 두 폴더의 내용은 동일하다.

 

 

5e30bf3087ef5aed6fa37887eea01326_1542687956_8318.png
 

 

 

 

 

 

3. 첫번째 서버 포트를 구성한다.

 

3.1 server.xml를 수정한다.

 

apache-tomcat-8.0.531/conf/server.xml

 

 

수정할 부분은 아래와 같다.(빨간색)

서버2와 중복되지 않는 것으로 설정한다.

테스트이므로 서버1은 톰캣 기본 설정 그대로 둔다.

 

 

 

<?xml version='1.0' encoding='utf-8'?>

 

<Server port="8005" shutdown="SHUTDOWN">

  <Listener className="org.apache.catalina.startup.VersionLoggerListener" />

 

  <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />

  <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />

  <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />

  <Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />

 

 

  <GlobalNamingResources>

 

    <Resource name="UserDatabase" auth="Container"

              type="org.apache.catalina.UserDatabase"

              description="User database that can be updated and saved"

              factory="org.apache.catalina.users.MemoryUserDatabaseFactory"

              pathname="conf/tomcat-users.xml" />

  </GlobalNamingResources>

 

 

  <Service name="Catalina">

 

 

    <Connector port="8080" protocol="HTTP/1.1"

               connectionTimeout="20000"

               redirectPort="8443" />

  

 

    <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />

 

 

    <Engine name="Catalina" defaultHost="localhost">

 

      <Realm className="org.apache.catalina.realm.LockOutRealm">

 

        <Realm className="org.apache.catalina.realm.UserDatabaseRealm"

               resourceName="UserDatabase"/>

      </Realm>

 

      <Host name="localhost"  appBase="webapps"

            unpackWARs="true" autoDeploy="true">

 

 

        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"

               prefix="localhost_access_log" suffix=".txt"

               pattern="%h %l %u %t "%r" %s %b" />

 

      </Host>

    </Engine>

  </Service>

</Server>


 

 

3.2 startup.bat 파일을 수정한다.

 

apache-tomcat-8.0.531/bin/startup.bat



아래 빨간색과 같이 추가해 준다.

 

 

 

@echo off

rem Licensed to the Apache Software Foundation (ASF) under one or more

rem contributor license agreements.  See the NOTICE file distributed with

rem this work for additional information regarding copyright ownership.

rem The ASF licenses this file to You under the Apache License, Version 2.0

rem (the "License"); you may not use this file except in compliance with

rem the License.  You may obtain a copy of the License at

rem

rem     http://www.apache.org/licenses/LICENSE-2.0

rem

rem Unless required by applicable law or agreed to in writing, software

rem distributed under the License is distributed on an "AS IS" BASIS,

rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

rem See the License for the specific language governing permissions and

rem limitations under the License.

 

rem ---------------------------------------------------------------------------

rem Start script for the CATALINA Server

rem ---------------------------------------------------------------------------

 

 

set "CATALINA_HOME=C:\Program Files\Apache Software Foundation\apache-tomcat-8.0.531"

set "CATALINA_BASE=C:\Program Files\Apache Software Foundation\apache-tomcat-8.0.531"

set "SERVER_NAME=Server1"

set "JAVA_HOME=C:\Program Files\Java\jdk1.8.0_191"

 

 

setlocal


 

 

3.3 shutdown.bat 파일을 수정한다.

apache-tomcat-8.0.531/bin/shutdown.bat



startup.bat 파일과 마찬가지로 아래처럼 추가해 준다.

 

 

@echo off

rem Licensed to the Apache Software Foundation (ASF) under one or more

rem contributor license agreements.  See the NOTICE file distributed with

rem this work for additional information regarding copyright ownership.

rem The ASF licenses this file to You under the Apache License, Version 2.0

rem (the "License"); you may not use this file except in compliance with

rem the License.  You may obtain a copy of the License at

rem

rem     http://www.apache.org/licenses/LICENSE-2.0

rem

rem Unless required by applicable law or agreed to in writing, software

rem distributed under the License is distributed on an "AS IS" BASIS,

rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

rem See the License for the specific language governing permissions and

rem limitations under the License.

 

rem ---------------------------------------------------------------------------

rem Stop script for the CATALINA Server

rem ---------------------------------------------------------------------------

 

set "CATALINA_HOME=C:\Program Files\Apache Software Foundation\apache-tomcat-8.0.531"

set "CATALINA_BASE=C:\Program Files\Apache Software Foundation\apache-tomcat-8.0.531"

set "SERVER_NAME=Server1"

set "JAVA_HOME=C:\Program Files\Java\jdk1.8.0_191"

 

setlocal

 

 

 

3.4 service.bat 파일을 수정한다.

 

apache-tomcat-8.0.531/bin/service.bat


80줄 근처의 아래 항목을 찾아서 변경해 준다.

rem Set default Service name
set SERVICE_NAME=Tomcat81
set DISPLAYNAME=Apache Tomcat 8.0 %SERVICE_NAME% Server1

 

 

서비스에 등록한다.

 

 

5e30bf3087ef5aed6fa37887eea01326_1542688166_8261.png
 

 

 

 

 

 

 

 

 

 

4. 두번째 서버 포트를 구성한다.

 

4.1 server.xml를 수정한다.

 

apache-tomcat-8.0.532/conf/server.xml

 

 

수정할 부분은 아래와 같다.(빨간색)

서버1과 중복되지 않는 것으로 설정한다.

 

 

 

<?xml version='1.0' encoding='utf-8'?>

 

<Server port="9005" shutdown="SHUTDOWN">

  <Listener className="org.apache.catalina.startup.VersionLoggerListener" />

 

  <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />

  <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />

  <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />

  <Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />

 

 

  <GlobalNamingResources>

 

    <Resource name="UserDatabase" auth="Container"

              type="org.apache.catalina.UserDatabase"

              description="User database that can be updated and saved"

              factory="org.apache.catalina.users.MemoryUserDatabaseFactory"

              pathname="conf/tomcat-users.xml" />

  </GlobalNamingResources>

 

 

  <Service name="Catalina">

 

 

    <Connector port="9080" protocol="HTTP/1.1"

               connectionTimeout="20000"

               redirectPort="9443" />

  

 

    <Connector port="9009" protocol="AJP/1.3" redirectPort="9443" />

 

 

    <Engine name="Catalina" defaultHost="localhost">

 

      <Realm className="org.apache.catalina.realm.LockOutRealm">

 

        <Realm className="org.apache.catalina.realm.UserDatabaseRealm"

               resourceName="UserDatabase"/>

      </Realm>

 

      <Host name="localhost"  appBase="webapps"

            unpackWARs="true" autoDeploy="true">

 

 

        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"

               prefix="localhost_access_log" suffix=".txt"

               pattern="%h %l %u %t "%r" %s %b" />

 

      </Host>

    </Engine>

  </Service>

</Server>


 

 

4.2 startup.bat 파일을 수정한다.

 

apache-tomcat-8.0.532/bin/startup.bat

 

 

 

아래 빨간색과 같이 추가해 준다.

 

 

 

@echo off

rem Licensed to the Apache Software Foundation (ASF) under one or more

rem contributor license agreements.  See the NOTICE file distributed with

rem this work for additional information regarding copyright ownership.

rem The ASF licenses this file to You under the Apache License, Version 2.0

rem (the "License"); you may not use this file except in compliance with

rem the License.  You may obtain a copy of the License at

rem

rem     http://www.apache.org/licenses/LICENSE-2.0

rem

rem Unless required by applicable law or agreed to in writing, software

rem distributed under the License is distributed on an "AS IS" BASIS,

rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

rem See the License for the specific language governing permissions and

rem limitations under the License.

 

rem ---------------------------------------------------------------------------

rem Start script for the CATALINA Server

rem ---------------------------------------------------------------------------

 

 

set "CATALINA_HOME=C:\Program Files\Apache Software Foundation\apache-tomcat-8.0.532"

set "CATALINA_BASE=C:\Program Files\Apache Software Foundation\apache-tomcat-8.0.532"

set "SERVER_NAME=Server2"

set "JAVA_HOME=C:\Program Files\Java\jdk1.8.0_191"

 

 

setlocal

 

 

 

 

4.3 shutdown.bat 파일을 수정한다.

apache-tomcat-8.0.532/bin/shutdown.bat



startup.bat 파일과 마찬가지로 아래처럼 추가해 준다.

 

 

@echo off

rem Licensed to the Apache Software Foundation (ASF) under one or more

rem contributor license agreements.  See the NOTICE file distributed with

rem this work for additional information regarding copyright ownership.

rem The ASF licenses this file to You under the Apache License, Version 2.0

rem (the "License"); you may not use this file except in compliance with

rem the License.  You may obtain a copy of the License at

rem

rem     http://www.apache.org/licenses/LICENSE-2.0

rem

rem Unless required by applicable law or agreed to in writing, software

rem distributed under the License is distributed on an "AS IS" BASIS,

rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

rem See the License for the specific language governing permissions and

rem limitations under the License.

 

rem ---------------------------------------------------------------------------

rem Stop script for the CATALINA Server

rem ---------------------------------------------------------------------------

 

set "CATALINA_HOME=C:\Program Files\Apache Software Foundation\apache-tomcat-8.0.532"

set "CATALINA_BASE=C:\Program Files\Apache Software Foundation\apache-tomcat-8.0.532"

set "SERVER_NAME=Server2"

set "JAVA_HOME=C:\Program Files\Java\jdk1.8.0_191"

 

setlocal

 

 

 

3.4 service.bat 파일을 수정한다.

 

apache-tomcat-8.0.531/bin/service.bat


80줄 근처의 아래 항목을 찾아서 변경해 준다.

rem Set default Service name
set SERVICE_NAME=Tomcat82
set DISPLAYNAME=Apache Tomcat 8.0 %SERVICE_NAME% Server2

 

 

서비스에 등록한다.

 

 

5e30bf3087ef5aed6fa37887eea01326_1542688233_0907.png
 

 

 

 

5. 서버1, 서버2를 시작한다.

 

작업관리자 > 서비스 항목에 간다.

 

Tomcat81, Tomcat82 항목을 찾아 마우스 우측 클릭 > 시작을 클릭한다.

 

5e30bf3087ef5aed6fa37887eea01326_1542688342_1742.png
 

 

 

 

6. 브라우저에서 접속해 본다.

8080, 9080 동일하게 나올 것이다.

 

 

5e30bf3087ef5aed6fa37887eea01326_1542688450_991.png
 

 

 

 

 

 

끝.

 

블로그 이미지

엘로드넷

,

톰캣 ROOT로 배포하기

JAVA 2019. 1. 8. 21:51

1. 이클립스에서 export 한 war파일을 ROOT.war 로 이름을 변경한다.

 

 

2. 톰캣이 가동중이면 중지한다.

 

 

3. 톰캣 webapps 폴더에 있는 ROOT폴더를 이름변경 또는 삭제한다.(ROOTOLD로 변경하였다.)

톰캣 webapps 폴더에 ROOT.war 파일을 위치시킨다. 

 

 

4. 톰캣을 가동한다.

 

ROOT.war 파일이 압축이 자동으로 풀리면서 ROOT 폴더가 생성된다.

 

 

5e30bf3087ef5aed6fa37887eea01326_1542688849_2517.png
 

 

5. ROOT.war파일을 삭제한다.

 

 

6. 브라우저에서 접속해 본다.

 

블로그 이미지

엘로드넷

,

1. globals.propeties에 접속정보 추가

경로 : /src/main/reousrces/egovframework/egovProps/globals.properties 





#oracle DB2

Globals.DB2.DriverClassName=oracle.jdbc.driver.OracleDriver

Globals.DB2.Url=jdbc:oracle:thin:@127.0.0.1:1521:ORCL 

Globals.DB2.UserName=아이디

Globals.DB2.Password=비밀번호






2. context-datasource.xml 에 추가

경로 : /src/main/reousrces/egovframework/spring/com/context-datasource.xml




    

    <!-- Oracle DB2 -->

    <bean id="dataSource-DB2" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">

        <property name="driverClassName" value="${Globals.DB2.DriverClassName}"/>

        <property name="url" value="${Globals.DB2.Url}" />

        <property name="username" value="${Globals.DB2.UserName}"/>

        <property name="password" value="${Globals.DB2.Password}"/>

        <property name="initialSize" value="0"/>

        <property name="maxActive" value="2"/>

        <property name="maxIdle" value="2"/>

        <property name="minIdle" value="0"/>

        <property name="maxWait" value="-1"/>

    </bean>    

    

 


3. context-sqlMap.xml 에 추가

경로 : /src/main/reousrces/egovframework/spring/com/context-sqlMap.xml



        

    <!-- SqlMap setup for iBATIS Database Layer -->

    <bean id="DB2.sqlMapClient" class="egovframework.rte.psl.orm.ibatis.SqlMapClientFactoryBean">

        <property name="configLocations">

            <list>

                <value>classpath:/egovframework/sqlmap/config/DB2/*.xml</value>

            </list>

        </property>

        <property name="dataSource" ref="dataSource-DB2"/>

        <property name="lobHandler" ref="lobHandler"/>

    </bean>





4. sqlmap/config에 추가


경로 : /src/main/reousrces/egovframework/spring/sqlmap/config/DB2/sql-map-config-oracle-DB2.xml


<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE sqlMapConfig PUBLIC "-//iBATIS.com//DTD SQL Map Config 2.0//EN"

    "http://www.ibatis.com/dtd/sql-map-config-2.dtd">


<sqlMapConfig>

<sqlMap resource="egovframework/sqlmap/DB2/DB2_SQL_Oracle.xml"/>

</sqlMapConfig> 





5. DB2_SQL_Oracle.xml 생성


경로 : /src/main/reousrces/egovframework/spring/sqlmap/DB2/DB2_SQL_Oracle.xml


내용은 기존 방식과 동일







6. EgovAbstractDAO를 상속받는 abstract DAO 클래스 생성


적절한 service 패키지 내에 생성한다.



public abstract class EgovDBSecondAbstractDAO extends EgovAbstractDAO {


@Override

@Resource(name = "DB2.sqlMapClient")

public void setSuperSqlMapClient(SqlMapClient sqlMapClient) {

super.setSuperSqlMapClient(sqlMapClient);

}


}





7. DAO클래스 생성


import 서비스위치.EgovDBSecondAbstractDAO;


@Repository("dbSecondDAO")

public class DbSecondDAO extends EgovDBSecondAbstractDAO{



    public List<?> selectUser(String uniqId){

        return List<?> select("dbSecondDAO.selectUser", uniqId);

    }


}





8. ServiceImpl 설정



@Service("testService")

public class TestServiceImpl extends EgovAbstractServiceImpl implements TestService {


/** dbSecondDAO */

@Resource(name="dbSecondDAO")

private DbSecondDAO dbSecondDAO;


@Override

public List<?> selectUser(String uniqId) {

List<?> resultList = dbSecondDAO.selectUser(uniqId);

return resultList;

}






9. 컨트롤러내 추가(기존 방식과 동일)


/** testService */

@Resource(name = "testService")

private TestService testService;



@RequestMapping(value = "/test/list.do", method=RequestMethod.GET)

public String selectUserList(@RequestParam(value = "uniqId", required = false) final String uniqId, ModelMap model) throws Exception {


List<?> resultList = testService.selectUser(uniqId); 

model.addAttribute("resultList"resultList);


}




끝.



블로그 이미지

엘로드넷

,

1. globals.propeties에 접속정보 추가

경로 : /src/main/reousrces/egovframework/egovProps/globals.properties 




#ms-sql:DB

Globals.ms.DriverClassName=com.microsoft.sqlserver.jdbc.SQLServerDriver

Globals.ms.Url=jdbc:sqlserver://127.0.0.1:1433;databaseName=디비명 

Globals.ms.UserName=사용자

Globals.ms.Password=비밀번호






2. context-datasource.xml 에 추가

경로 : /src/main/reousrces/egovframework/spring/com/context-datasource.xml



    <alias name="dataSource-ms" alias="ms.dataSource" />


    

    <bean id="dataSource-ms" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">

        <property name="driverClassName" value="${Globals.ms.DriverClassName}"/>

        <property name="url" value="${Globals.ms.Url}" />

        <property name="username" value="${Globals.ms.UserName}"/>

        <property name="password" value="${Globals.ms.Password}"/>

        <property name="initialSize" value="0"/>

        <property name="maxActive" value="1"/>

        <property name="maxIdle" value="1"/>

        <property name="minIdle" value="0"/>

        <property name="maxWait" value="-1"/>

    </bean>

 

 


3. context-sqlMap.xml 에 추가

경로 : /src/main/reousrces/egovframework/spring/com/context-sqlMap.xml



        

    <bean id="ms.sqlMapClient" class="egovframework.rte.psl.orm.ibatis.SqlMapClientFactoryBean">

        <property name="configLocations">

            <list>

                <value>classpath:/egovframework/sqlmap/config/ms/*.xml</value>

            </list>

        </property>

        <property name="dataSource" ref="dataSource-ms"/>

        <property name="lobHandler" ref="lobHandler"/>

    </bean>




4. sqlmap/config에 추가


경로 : /src/main/reousrces/egovframework/spring/sqlmap/config/ms/sql-map-config-ms.xml


<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE sqlMapConfig PUBLIC "-//iBATIS.com//DTD SQL Map Config 2.0//EN"

    "http://www.ibatis.com/dtd/sql-map-config-2.dtd">


<sqlMapConfig>

<sqlMap resource="egovframework/sqlmap/ms/SQL_Ms.xml"/>

</sqlMapConfig> 





5. SQL_Ms.xml 생성


경로 : /src/main/reousrces/egovframework/spring/sqlmap/ms/SQL_Ms.xml


내용은 기존 방식과 동일







6. EgovAbstractDAO를 상속받는 DAO 클래스 생성


적절한 service 패키지 내에 생성한다.



public class EgovMssqlAbstractDAO extends EgovAbstractDAO {


@Override

@Resource(name = "ms.sqlMapClient")

public void setSuperSqlMapClient(SqlMapClient sqlMapClient) {

super.setSuperSqlMapClient(sqlMapClient);

}


}





7. DAO클래스 생성


import 서비스위치.EgovMssqlAbstractDAO;


@Repository("mssqlDAO")

public class MssqlDAO extends EgovMssqlAbstractDAO{



    public List<?> selectUser(String uniqId){

        return List<?> select("mssqlDAO.selectUser"uniqId);

    }


}





8. ServiceImpl 설정



@Service("testService")

public class TestServiceImpl extends EgovAbstractServiceImpl implements TestService {


/** mssqlDAO */

@Resource(name="mssqlDAO")

private MssqlDAO mssqlDAO;


@Override

public List<?> selectUser(String uniqId) {

List<?> resultList = mssqlDAO.selectUser(uniqId);

return resultList;

}






9. 컨트롤러내 추가(기존 방식과 동일)


/** testService */

@Resource(name = "testService")

private TestService testService;



@RequestMapping(value = "/test/list.do", method=RequestMethod.GET)

public String selectUserList(@RequestParam(value = "uniqId", required = falsefinal String uniqId, ModelMap modelthrows Exception {


List<?> resultList = testService.selectUser(uniqId); 

model.addAttribute("resultList"resultList);


}




끝.

블로그 이미지

엘로드넷

,

프로시저명 : sp_test



1. DAO


select 로 호출함



    public void callSP() {

    

     select("testDAO.callSP");

    }




2. ibatis xml 


<procedure></procedure> 태그를 사용함



<procedure id="testDAO.callSP" > 

<![CDATA[

{ CALL sp_test }

]]>

</procedure>



끝.


블로그 이미지

엘로드넷

,