posted by 구름너머 2006. 5. 26. 09:34
정보시스템의 효율적 도입 및 운영 등에 관한 법률
[제정 2005.12.30 법률 제7816호], 시행일 2006.7.1, 최근개정법령 현재시행법령 확인
조별연혁보기

제1조 (목적) 이 법은 정보기술아키텍처의 활용을 촉진하고 정보시스템 감리제도를 확립함으로써 정보기술자원의 효율적 관리를 도모하고 나아가 정보화투자의 효율성 증진과 조직의 성과향상 및 국민경제의 발전에 이바지함을 목적으로 한다.

조별연혁보기

제2조 (정의) 이 법에서 사용하는 용어의 정의는 다음과 같다.

1. "정보시스템"이라 함은 정보의 수집, 가공, 저장, 검색, 송신·수신 및 그 활용과 관련되는 기기와 소프트웨어의 조직화된 체계를 말한다.

2. "정보기술아키텍처"라 함은 일정한 기준과 절차에 따라 업무, 응용, 데이터, 기술, 보안 등 조직 전체의 정보화 구성요소들을 통합적으로 분석한 뒤 이들 간의 관계를 구조적으로 정리한 체제 및 이를 바탕으로 정보시스템을 효율적으로 구성하기 위한 방법을 말한다.

3. "정보시스템 감리"라 함은 감리발주자 및 피감리인의 이해관계로부터 독립된 자가 정보시스템의 효율성을 향상시키고 안전성을 확보하기 위하여 제3자적 관점에서 정보시스템의 구축에 관한 사항을 종합적으로 점검하고 문제점을 개선하도록 하는 것을 말한다.

4. "감리원"이라 함은 제14조제1항의 규정에 따른 요건을 갖춘 자로서 정보시스템 감리의 업무(이하 "감리업무"라 한다)를 수행하는 자를 말한다.

5. "참조모형"이라 함은 정보기술아키텍처의 일관성, 재사용성, 상호운용성 등을 확보하기 위하여 정보기술아키텍처의 구성에 필요한 정보화 구성요소의 표준화된 분류체계와 형식을 정의한 것을 말한다.

6. "공공기관"이라 함은 국가기관, 지방자치단체 그 밖에 대통령령이 정하는 기관을 말한다.

조별연혁보기

제3조 (다른 법률과의 관계) 정보기술아키텍처의 도입·운영과 정보시스템 감리에 관하여 다른 법률에 특별한 규정이 있는 경우를 제외하고는 이 법이 정하는 바에 따른다.

조별연혁보기

제4조 (기본계획의 수립 등) ①정보통신부장관은 관계 공공기관의 장과 협의를 거쳐 정보기술아키텍처를 체계적으로 도입·확산시키기 위한 기본계획(이하 "기본계획"이라 한다)을 수립하여 「정보화촉진기본법」 제8조의 규정에 따른 정보화추진위원회(이하 "정보화추진위원회"라 한다)에 보고하여야 한다. 다만, 중앙행정기관과 지방자치단체에 관한 기본계획의 수립, 협의 및 보고는 행정자치부장관이 하여야 한다.

②기본계획은 정보화추진위원회의 심의를 거쳐 확정한다.

③기본계획에는 다음 각 호의 사항이 포함되어야 한다.

1. 정보기술아키텍처의 도입·확산을 위한 기본방향

2. 정보기술아키텍처의 도입·운영 현황 및 성과분석에 관한 사항

3. 정보기술아키텍처 관련 전문인력 양성에 관한 사항

4. 그 밖에 정보기술아키텍처의 도입·확산을 위하여 필요한 사항으로서 대통령령이 정하는 사항

④관계 중앙행정기관의 장은 「정보화촉진기본법」 제6조의 규정에 따른 정보화촉진시행계획을 수립·시행하는 때에는 제1항의 규정에 따른 기본계획의 내용을 반영하여야 한다.

⑤정보통신부장관은 관계 중앙행정기관의 장과 협의를 거쳐 정보기술아키텍처와 예산·성과 등 관련 제도를 연계·발전시킬 수 있는 방안을 마련하고, 관계 중앙행정기관의 장은 특별한 사유가 없는 한 이를 소관업무에 반영하도록 노력하여야 한다.

조별연혁보기

제5조 (정보기술아키텍처의 도입·운영) ①대통령령이 정하는 공공기관의 장은 대통령령이 정하는 바에 따라 정보기술아키텍처 도입계획을 수립하여 정보통신부장관에게 제출하여야 한다. 다만, 중앙행정기관의 장과 지방자치단체의 장은 정보기술아키텍처 도입계획을 행정자치부장관에게 제출하고, 행정자치부장관은 이를 종합하여 정보통신부장관에게 통보하여야 한다.

②제1항의 규정에 따른 공공기관의 장은 정보시스템을 효율적으로 활용하기 위하여 정보기술아키텍처 도입계획에 따라 정보기술아키텍처를 도입·운영하고 이를 지속적으로 유지·발전시켜야 한다.

조별연혁보기

제6조 (정보기술아키텍처의 도입·운영의 촉진) ①정부는 정보기술아키텍처의 도입·운영을 촉진하기 위하여 공공기관에서 공동으로 활용할 수 있는 정보기술아키텍처의 참조모형을 개발하여 보급할 수 있다.

②정보통신부장관은 정보기술아키텍처를 도입·운영하고자 하는 공공기관에 대하여 대통령령이 정하는 바에 따라 정보기술아키텍처의 도입·운영에 관한 기술의 제공 및 교육·훈련의 지원 등을 할 수 있다.

③정보통신부장관은 공공부문의 정보시스템과 연계된 정보시스템을 구축하거나 운영하는 등 공공부문과 밀접한 관련이 있는 민간부문에 대하여 정보기술아키텍처를 도입·운영하도록 권고할 수 있다.

조별연혁보기

제7조 (정보기술아키텍처의 도입·운영 지침 등) ①정보통신부장관은 행정자치부장관과 협의를 거쳐 정보기술아키텍처의 도입·운영 및 정보시스템의 구축·운영 기술에 관한 지침을 정하여 고시하여야 한다.

②제5조제1항의 규정에 따른 공공기관의 장은 정보기술아키텍처를 도입·운영하거나 정보시스템을 구축·운영함에 있어서 제1항의 규정에 따른 지침을 준수하여야 한다.

조별연혁보기

제8조 (정보기술아키텍처지원시스템의 구축·운영) ①정보통신부장관은 공공기관에서 정보기술아키텍처 관련 정보를 공동 활용할 수 있도록 제6조제1항의 규정에 따른 참조모형, 제7조제1항의 규정에 따른 지침, 각 기관의 정보기술아키텍처의 도입·운영 현황 등에 관한 정보를 관리·제공하기 위한 시스템(이하 "정보기술아키텍처지원시스템"이라 한다)을 구축·운영하여야 한다.

②정보통신부장관은 정보기술아키텍처지원시스템을 운영함에 있어서 필요한 경우에는 공공기관의 장에게 정보기술아키텍처 관련 정보의 제공을 요청할 수 있으며, 공공기관의 장은 요청받은 정보가 국가안전보장에 관한 정보 등 대통령령이 정하는 정보에 해당되지 아니하는 한 이에 응하여야 한다.

조별연혁보기

제9조 (정보기술아키텍처의 도입·운영 성과분석 등) ①정보통신부장관은 매년 제5조제2항의 규정에 따른 정보기술아키텍처의 도입·운영 실태 및 그 추진성과를 분석하여 정보화추진위원회에 보고하여야 한다. 다만, 중앙행정기관과 지방자치단체의 정보기술아키텍처의 도입·운영실태 및 그 추진성과의 분석·보고는 행정자치부장관이 하여야 한다.

②정보통신부장관 및 행정자치부장관은 제1항의 규정에 따른 실태조사를 위하여 필요한 때에는 관계 공공기관의 장에게 자료제출을 요구할 수 있다.

③정보통신부장관 및 행정자치부장관은 제1항의 규정에 따른 추진성과의 분석결과를 해당 공공기관의 장 및 기획예산처장관에게 통보하여야 한다.

조별연혁보기

제10조 (상호운용성 확보 등을 위한 기술평가) ①공공기관의 장은 정보시스템의 특성 및 사업의 규모 등이 대통령령이 정하는 기준에 해당하는 정보시스템 구축사업을 하고자 하는 때에는 정보통신부장관이 행정자치부장관과 협의를 거쳐 정하여 고시하는 평가기준에 따라 다음 각 호의 사항에 관하여 사업계획 수립시에 기술평가를 실시하여야 한다.

1. 정보시스템의 상호운용 및 정보의 공동활용

2. 정보시스템의 효율성

3. 정보접근을 위한 기술적 편의성

4. 그 밖에 상호운용성 확보 등에 필요한 사항으로서 대통령령이 정하는 사항

②공공기관의 장은 필요한 경우 대통령령이 정하는 자격을 갖춘 전문기술지원기관으로 하여금 제1항의 규정에 따른 기술평가를 수행하도록 할 수 있다.

조별연혁보기

제11조 (공공기관의 정보시스템 감리) ①공공기관의 장은 제12조의 규정에 따른 감리법인으로 하여금 정보시스템의 특성 및 사업의 규모 등이 대통령령이 정하는 기준에 해당하는 정보시스템 구축사업에 대하여 정보시스템 감리를 하게 하여야 한다.

②공공기관의 장은 제1항의 규정에 따른 감리를 시행하는 사업에 대하여 해당 정보시스템을 구축하는 사업자로 하여금 감리결과를 반영하게 하여야 한다.

③제1항의 규정에 불구하고 국가안전보장에 관한 정보 등 대통령령이 정하는 정보를 취급하는 기관의 경우에는 당해 기관의 장이 정하는 기관으로 하여금 정보시스템 감리를 하게 할 수 있다.

④정보통신부장관은 제1항 및 제3항의 규정에 따라 정보시스템 감리를 하는 감리법인 또는 기관이 정보시스템 감리를 효율적으로 하도록 하기 위하여 필요한 기준(이하 "감리기준"이라 한다)을 정하여 고시하여야 한다. 다만, 정보시스템 보안에 관한 사항은 관계기관의 장과 미리 협의하여야 한다.

⑤제1항 및 제3항의 규정에 따라 감리를 하는 법인 또는 기관은 당해 정보시스템이 적정하게 개발·구축되고 있는지를 감리기준에 따라 점검하여야 한다.

⑥제5항의 규정에 따라 감리를 하는 법인 또는 기관의 업무범위 및 감리절차 등 그 밖에 필요한 사항은 대통령령으로 정한다.

[시행일:2006.12.31] 제11조
조별연혁보기

제12조 (감리법인의 등록) ①정보시스템 감리를 하고자 하는 자는 대통령령이 정하는 기술능력·재정능력 그 밖에 정보시스템 감리의 수행에 필요한 사항을 갖추어 정보통신부장관에게 등록하여야 한다.

②제1항의 규정에 따라 등록할 수 있는 자는 법인에 한한다.

③제1항의 규정에 따라 등록한 법인(이하 "감리법인"이라 한다)은 등록사항을 변경하고자 하는 경우에는 그 변경사항을 정보통신부장관에게 신고하여야 한다. 다만, 등록기준에 미달되지 않는 범위 내의 자본금의 변동 등 정보통신부령이 정하는 경미한 사항의 변경은 그러하지 아니하다.

④감리법인의 등록 및 등록사항의 변경 등에 관하여 필요한 사항은 정보통신부령으로 정한다.

조별연혁보기

제13조 (감리법인의 준수사항) ①감리법인은 당해 감리법인에 소속된 감리원으로 하여금 감리업무를 수행하게 하여야 한다.

②감리법인은 거짓으로 감리보고서를 작성하여서는 아니되며, 신의에 따라 성실히 정보시스템 감리를 하여야 한다.

③감리법인은 다른 자에게 자기의 명칭을 사용하여 정보시스템 감리를 하도록 하여서는 아니된다.

조별연혁보기

제14조 (감리원) ①감리원이 되고자 하는 자는 등급별 기술자격 등 대통령령이 정하는 일정한 자격을 갖추어야 하며, 대통령령이 정하는 바에 따라 감리업무의 수행에 필요한 교육을 받아야 한다.

②정보통신부장관은 제1항의 규정에 따른 요건에 해당하는 자에게 정보통신부령이 정하는 바에 따라 감리원증을 교부하고 이를 관리하여야 한다.

③감리원은 다른 사람에게 자기의 성명을 사용하여 감리업무를 수행하게 하거나 감리원증을 대여하여서는 아니된다.

조별연혁보기

제15조 (감리법인 등의 결격사유) ①임원 중 다음 각 호의 어느 하나에 해당하는 자가 있는 법인은 제12조제1항의 규정에 따른 감리법인으로 등록을 할 수 없다.

1. 금치산자 또는 한정치산자

2. 제16조의 규정에 따라 등록이 취소된 감리법인의 임원으로서 등록이 취소된 날부터 2년이 경과하지 아니한 자(등록취소의 원인이 된 행위를 한 자와 그 대표자를 말한다.)

②제1항제1호에 해당하는 자는 제14조의 규정에 따른 감리원이 될 수 없다.

조별연혁보기

제16조 (감리법인의 등록취소 등) ①정보통신부장관은 감리법인이 다음 각 호의 어느 하나에 해당하는 때에는 그 등록을 취소하거나 1년 이내의 기간을 정하여 업무의 정지를 명할 수 있다. 다만, 제1호 내지 제3호, 제10호의 어느 하나에 해당하는 때에는 등록을 취소하여야 한다.

1. 거짓 그 밖에 부정한 방법으로 등록을 한 때

2. 최근 3년간 3회 이상의 업무정지 처분을 받은 때

3. 업무정지기간 중 정보시스템 감리를 한 때. 다만, 제17조의 규정에 따라 업무정지기간 중에 정보시스템 감리를 한 때에는 그러하지 아니하다.

4. 제11조제5항의 규정을 위반하여 감리기준을 준수하지 아니하고 감리업무를 수행한 때

5. 제12조제1항의 규정에 따른 등록기준에 미달하게 된 때

6. 제12조제3항의 규정에 따른 변경사항의 신고를 하지 아니하거나 거짓으로 한 때

7. 제13조제2항의 규정을 위반하여 거짓으로 감리보고서를 작성한 때

8. 제13조제3항의 규정을 위반하여 다른 자에게 자기의 명칭을 사용하여 정보시스템 감리를 하게 한 때

9. 제14조제1항의 규정을 위반하여 감리원이 아닌 자에게 감리업무를 수행하게 한 때

10. 임원이 제15조제1항의 규정에 따른 결격사유에 해당된 때. 다만, 결격사유에 해당된 날부터 6개월 이내에 당해 임원을 개임하는 때에는 그러하지 아니하다.

②제1항의 규정에 따른 처분의 기준 및 절차 등에 관하여 필요한 사항은 정보통신부령으로 정한다.

조별연혁보기

제17조 (등록취소처분 등을 받은 감리법인의 업무계속 등) ①제16조제1항의 규정에 따라 등록취소 또는 업무정지의 처분을 받은 감리법인은 그 처분 전에 체결한 계약에 따른 감리업무의 수행을 계속할 수 있다. 이 경우 감리법인은 그 처분을 받은 내용을 지체 없이 당해 감리 발주자에게 통지하여야 한다.

②정보시스템 감리 발주자는 특별한 사유가 있는 경우를 제외하고는 감리법인으로부터 제1항의 규정에 따른 통지를 받거나 감리법인이 등록취소 또는 업무정지의 처분을 받은 사실을 안 때에는 그 날부터 30일 이내에 한하여 당해 계약을 해지할 수 있다.

조별연혁보기

제18조 (청문) 정보통신부장관은 제16조제1항의 규정에 따라 등록을 취소하고자 하는 경우에는 청문을 실시하여야 한다.

조별연혁보기

제19조 (권한 등의 위임·위탁) ①정보통신부장관은 이 법에 따른 권한의 일부를 대통령령이 정하는 바에 따라 그 소속기관의 장에게 위임할 수 있다.

②정보통신부장관은 이 법에 따른 업무의 일부를 대통령령이 정하는 바에 따라 관련기관 또는 단체에 위탁할 수 있다.

조별연혁보기

제20조 (비밀누설 등의 금지) 감리법인의 임원·직원 또는 임원·직원이었던 자는 정당한 사유 없이 그 직무상 알게 된 비밀을 다른 사람에게 누설하거나 도용하여서는 아니된다.

조별연혁보기

제21조 (벌칙) ①제20조의 규정을 위반하여 직무상 알게 된 비밀을 다른 사람에게 누설하거나 도용한 자는 3년 이하의 징역 또는 2천만원 이하의 벌금에 처한다.

②제12조제1항의 규정에 따라 등록을 하지 아니한 자가 정보시스템 감리를 한 경우에는 2년 이하의 징역 또는 1천만원 이하의 벌금에 처한다.

③제14조제3항의 규정을 위반하여 다른 사람에게 자기의 성명을 사용하여 감리업무를 수행하게 하거나 감리원증을 대여한 자 또는 다른 사람의 성명을 사용하여 감리업무를 수행하거나 감리원증을 대여받은 자는 1년 이하의 징역 또는 500만원 이하의 벌금에 처한다.

조별연혁보기

제22조 (양벌규정) 법인의 대표자나 법인 또는 개인의 대리인·사용인 그 밖의 종업원이 그 법인 또는 개인의 업무에 관하여 제21조의 위반행위를 한 때에는 행위자를 벌하는 외에 그 법인 또는 개인에 대하여도 동조 각 항의 벌금형을 과한다.

조별연혁보기

제23조 (벌칙 적용에서의 공무원 의제) 감리업무에 종사하는 감리원은 「형법」 제129조 내지 제132조의 적용에 있어서는 이를 공무원으로 본다.


부칙연혁보기 부칙 <제07816호, 2005.12.30>

제1조 (시행일) 이 법은 공포 후 6개월이 경과한 날부터 시행한다. 다만, 제11조의 규정은 공포 후 1년이 경과한 날부터 시행한다.

제2조 (정보시스템 감리에 관한 적용례) 공공기관의 정보시스템 감리에 관한 제11조제1항의 규정은 동규정의 시행 후 최초로 시행하는 정보시스템 구축사업부터 적용한다.

제3조 (감리법인의 등록에 관한 경과조치) 이 법 시행 당시 정보시스템 감리를 하는 법인은 이 법에 의한 감리법인으로 본다. 다만, 이 법 시행 후 6개월 이내에 제12조제1항의 규정에 의한 감리법인의 등록기준을 갖추어야 한다.

제4조 (감리원에 관한 경과조치) 이 법 시행 당시 감리업무를 수행하는 자는 제14조제1항의 규정에 불구하고 이 법 시행 후 1년이 경과한 날까지는 이 법에 의한 감리업무를 수행할 수 있다.

제5조 (다른 법률의 개정) ①소프트웨어産業振興法 일부를 다음과 같이 개정한다.

제2조제2호중 "情報化促進基本法 第15條의2"를 "「정보시스템의 효율적 도입 및 운영 등에 관한 법률」 제2조제1호"로 한다.

②情報化促進基本法 일부를 다음과 같이 개정한다.

제15조의2를 삭제한다.


posted by 구름너머 2006. 5. 26. 09:28
공공기관의 ITA 도입 및 정보시스템 감리 의무화등록일2006-03-23
담당자정영길 ( )담당부서정보화기획실 정보이용촉진과전화번호750-1225
정보통신부는 선진화된 정보화 관리 방법인 정보기술아키텍처(ITA : Information Technology Architect
ure)를 제도화하기 위한 공청회를 23일 은행회관에서 개최했다. 공청회는 지난해 12월 30일 "정보시스
템의 효율적 도입 및 운영 등에 관한 법률"이 제정됨에 따라 후속조치로 시행령과 시행규칙을 제정하기
위해 관련업계 등의 의견을 수렴하는 자리였다.

정통부가 마련한 시행령·시행규칙 제정(안)에 따르면, 중앙행정기관, 지방자치단체는 정보기술아키텍처
를 의무적으로 도입해야 하며, 정부투자기관 등의 공공기관도 이전 3년간 정보화 예산의 평균이 20억
이상, 신규 단위 정보화 사업의 투자 규모가 100억 이상 등 일정 기준에 해당하는 경우 정보기술아키텍
처를 의무적으로 도입해야 한다.

정보기술아키텍처는 기존 단위사업 중심의 정보화로 인한 시스템간 연계 미흡과 중복개발 등의 문제를
개선하고, 합리적인 정보화 투자를 촉진하기 위한 새로운 정보화 추진 방식으로써 'ITA 도입 의무화 조
치'가 마련될 경우 공공부문 정보화 투자 효율 및 성과 제고를 위한 획기적인 계기가 될 것으로 보인다.
미국의 경우 ‘96년부터 정보기술아키텍처 도입으로 정보화 예산 30%를 절감하는 효과를 거둔 것으로
나타났다.

또한, 정보시스템 구축시 제3자적 입장에서 정보시스템 구축 과정을 점검하는 활동인 정보시스템 감리
도 활성화될 것으로 전망된다. 시행령(안)에 따르면, 공공기관은 정보시스템 구축 사업비(장비 등 단순
구입비용 제외)가 5억원 이상인 사업의 경우 의무적으로 감리를 시행해야 한다.

5억원 미만의 사업의 경우도 대민 서비스, 다수기관 연계 사업 등 특성 기준에 해당하는 경우 감리를 시
행하도록 하고 있다
. 그 동안 정보시스템 감리는 공공기관의 자체 판단하에 시행하여 왔었다.

아울러, 의무감리 제도 도입에 따라 부실감리를 방지하고 감리 품질을 제고하기 위해 감리법인 등록요
건, 감리원 자격요건도 규정된다.

우선, 감리법인은 자본금 1억 이상, 5인 이상의 감리원 등 재정·기술능력을 갖추어 정보통신부 장관에
게 등록해야 한다. 또한, 감리원의 자격 요건과 관련해 감리 총괄역할을 하는 수석감리원은 정보처리분
야 기술사, 정보시스템 감리사 자격을 보유해야 하고, 분야별로 감리를 시행하는 감리원 등급에는 정보
처리기사 자격 취득후 관련 경력 7년 이상 등 고급기술자 이상의 요건을 갖추어야 한다.

정통부는 이번 공청회 개최를 통해 관련업계 등 각계의 의견을 수렴한 후 입법예고, 규제심사 등 관련
절차 진행을 통해 하위법령 제정을 추진할 예정이다.
posted by 구름너머 2006. 5. 24. 18:24

CLOB 칼럼에 데이터 넣기 위해 몇 일 헤메다

아래 문서보고 성공했습니다.

새로운 길이 되길...

환경: WL6.1-Oracle9i

예:

java.sql.Clob myClob = null;

strQuery = new StringBuffer();
strQuery.append(" SELECT USED_SQL FROM tb_Log ")
.append(" WHERE USED_SYS='IVOC' ")
.append("AND LOG_ID ="+seqVal+" ")
.append(" FOR UPDATE ");
pstmt = conn.prepareStatement(strQuery.toString());
rs = pstmt.executeQuery();

if (rs.next()) {
myClob = rs.getClob("USED_SQL");
java.io.Writer wr = ((weblogic.jdbc.common.OracleClob) myClob).getCharacterOutputStream();
char[] b = useSQL.toCharArray();// converts 's' to a character array
wr.write(b);
wr.flush();

wr.close();
}
conn.commit();

문서위치 : http://e-docs.bea.com/wls/docs81/oracle/advanced.html

Recommended Data Type Mapping

The following table shows the recommended mapping between Oracle data types and JDBC types. There are additional possibilities for representing Oracle data types in Java. If the getObject() method is called when result sets are being processed, it returns the default Java data type for the Oracle column being queried.

Note: In Oracle 9i, Oracle introduced the Timestamp datatype. The WebLogic jDriver for Oracle does not support this datatype.

Table 5-1 Oracle Types Mapped to WebLogic Server

Oracle

Java

Varchar

String

Number

Tinyint

Number

Smallint

Number

Integer

Number

Long

Number

Float

Number

Numeric

Number

Double

Long

Longvarchar

RowID

String

Date

Timestamp

Raw

(var)Binary

Long raw

Longvarbinary

Char

(var)Char

Boolean*

Number OR Varchar

MLS label

String

Blob

Blob

Clob

Clob


* Note that when PreparedStatement.setBoolean() is called, it converts a VARCHAR type to 1 or 0 (string), and it converts a NUMBER type to 1 or 0 (number).


WebLogic Server and Oracle's NUMBER Column

Oracle provides a column type called NUMBER, which can be optionally specified with a precision and a scale, in the forms NUMBER(P) and NUMBER(P,S). Even in the simple unqualified NUMBER form, this column can hold all number types from small integer values to very large floating point numbers, with high precision.

WebLogic Server reliably converts the values in a column to the Java type requested when a WebLogic Server application asks for a value from such a column. Of course, if a value of 123.456 is asked for with getInt(), the value will be rounded.

The method getObject(), however, poses a little more complexity. WebLogic Server guarantees to return a Java object which will represent any value in a NUMBER column with no loss in precision. This means that a value of 1 can be returned in an Integer, but a value like 123434567890.123456789 can only be returned in a BigDecimal.

There is no metadata from Oracle to report the maximum precision of the values in the column, so WebLogic Server must decide what sort of object to return based on each value. This means that one ResultSet may return multiple Java types from getObject() for a given NUMBER column. A table full of integer values may all be returned as Integer from getObject(), whereas a table of floating point measurements may be returned primarily as Double, with some Integer if any value happens to be something like "123.00". Oracle does not provide any information to distinguish between a NUMBER value of "1" and a NUMBER of "1.0000000000".

There is some more reliable behavior with qualified NUMBER columns, that is, those defined with a specific precision. Oracle's metadata provides these parameters to the driver so WebLogic Server will always return a Java object appropriate for the given precision and scale, regardless of the values in the table.

Table 5-2 Conversion Types for Oracle's Number Column Definitions

Column Definition

Returned by getObject()

NUMBER(P <= 9)

Integer

NUMBER(P <= 18)

Long

NUMBER(P = 19)

BigDecimal

NUMBER(P <=16, S 0)

Double

NUMBER(P = 17, S 0)

BigDecimal


Using Oracle Long Raw Data Types

There are two properties available for use with WebLogic Server in support of Oracle's chunking of BLOBs, CLOBs, Long, and Long raw data types. Although BLOB and CLOB data types are only supported with Oracle Version 8 and JDBC 2.0, these properties also apply to Oracle's Long raw data type, which is available in Oracle Version 7.


Waiting on Oracle Resources

Note: The waitOnResources() method is not supported for use with the Oracle 8 API.

The WebLogic Server driver supports Oracle's oopt() C functionality, which allows a client to wait until resources become available. The Oracle C function sets options in cases in which requested resources are not available, such as whether to wait for locks.

A developer can specify whether a client will wait for DBMS resources, or will receive an immediate exception. The following code is an excerpt from a sample code file (examples/jdbc/oracle/waiton.java):

java.util.Properties props = new java.util.Properties();
props.put("user", "scott");
props.put("password", "tiger");
props.put("server", "myserver");

Driver myDriver = (Driver)
Class.forName("weblogic.jdbc.oci.Driver").newInstance();

// You must cast the Connection as a weblogic.jdbc.oci.Connection
// to take advantage of this extension
Connection conn =(weblogic.jdbc.oci.Connection)
myDriver.connect("jdbc:weblogic:oracle", props);

// After constructing the Connection object, immediately call
// the waitOnResources method

conn.waitOnResources(true);

Use of this method can cause several error return codes to be generated while the software waits for internal resources that are locked for short durations.

To take advantage of this feature, you must do the following:

  1. Cast your Connection object as a weblogic.jdbc.oci.Connection.
  2. Call the waitOnResources() method.

This functionality is described in section 4-97 of The OCI Functions for C.


Autocommit

The default transaction mode for JDBC WebLogic Server assumes autocommit to be true. You can improve the performance of your programs by setting autocommit to false, after creating a Connection object, with the following statement:

Connection.setAutoCommit(false);


Transaction Isolation Levels

WebLogic Server supports the following transaction isolation levels:

  • SET TRANSACTION ISOLATION LEVEL READ COMMITTED
  • SET TRANSACTION ISOLATION LEVEL SERIALIZABLE

The Oracle DBMS supports only these two isolation levels. Unlike other JDBC drivers, the WebLogic jDriver for Oracle throws an exception if you try to use an isolation level that is unsupported. Some drivers silently ignore attempts to set an unsupported isolation level.

The READ_UNCOMMITTED transaction isolation level is not supported.


Codeset Support

JDBC and the WebLogic Server driver handle character strings in Java as Unicode strings. Because the Oracle DBMS uses a different codeset, the driver must convert character strings from Unicode to the codeset used by Oracle. The WebLogic Server examines the value stored in the Oracle environment variable NLS_LANG and select a codeset for the JDK to use for the conversion, using the mapping shown in Table5-3. If the NLS_LANG variable is not set, or if it is set to a codeset not recognized by the JDK, the driver cannot determine the correct codeset. (For information about the correct syntax for setting NLS_LANG, see your Oracle documentation.)

If you are converting codesets, you should pass the following property to the WebLogic Server with the Driver.connect() method when you establish the connection in your code:

props.put("weblogic.oci.min_bind_size", 660);

This property defines the minimum size of buffers to be bound. The default is 2000 bytes, which is also the maximum value. If you are converting codesets, you should use this property to reduce the bind size to a maximum of 660, one-third of the maximum 2000 bytes, since Oracle codeset conversion triples the buffer to allow for expansion.

WebLogic Server provides the weblogic.codeset property to set the codeset from within your Java code. For example, to use the cp863 codeset, create a Properties object and set the weblogic.codeset property before calling Driver.connect(), as shown in the following example:

java.util.Properties props = new java.util.Properties();
props.put("weblogic.codeset", "cp863");
props.put("user", "scott");
props.put("password", "tiger");

String connectUrl = "jdbc:weblogic:oracle";

Driver myDriver = (Driver)
Class.forName("weblogic.jdbc.oci.Driver").newInstance();

Connection conn =
myDriver.connect(connectUrl, props);

Codeset support can vary with different JVMs. Check the documentation for the JDK you are using to determine whether a particular codeset is supported.

Note: You must also set the NLS_LANG environment variable in your Oracle client to the same or a corresponding codeset.

Table 5-3 NLS_LANG Settings Mapped to JDK Codesets

NLS_LANG

JDK codeset

al24utffss

UTF8

al32utf8

UTF8

ar8iso8859p6

ISO8859_6

cdn8pc863

Cp863

cl8iso8859p5

ISO8859_5

cl8maccyrillic

MacCyrillic

cl8mswin1251

Cp1251

ee8iso8859p2

ISO8859_2

ee8macce

MacCentralEurope

ee8maccroatian

MacCroatian

ee8mswin1250

Cp1250

ee8pc852

Cp852

el8iso8859p7

ISO8859_7

el8macgreek

MacGreek

el8mswin1253

Cp1253

el8pc737

Cp737

is8macicelandic

MacIceland

is8pc861

Cp861

iw8iso8859p8

ISO8859_8

ja16euc

EUC_JP

ja16sjis

SJIS

ko16ksc5601

EUC_KR

lt8pc772

Cp772

lt8pc774

Cp774

n8pc865

Cp865

ne8iso8859p10

ISO8859_10

nee8iso8859p4

ISO8859_4

ru8pc855

Cp855

ru8pc866

Cp866

se8iso8859p3

ISO8859_3

th8macthai

MacThai

tr8macturkish

MacTurkish

tr8pc857

Cp857

us7ascii

ASCII

us8pc437

Cp437

utf8

UTF8

we8ebcdic37

Cp1046

we8ebcdic500

Cp500

we8iso8859p1

ISO8859_1

we8iso8859p15

ISO8859_15_FDIS

we8iso8859p9

ISO8859_9

we8macroman8

MacRoman

we8pc850

Cp850

we8pc860

Cp860

zht16big5

Big5


Support for Oracle Array Fetches

WebLogic Server supports Oracle array fetches. When called for the first time, ResultSet.next() retrieves an array of rows (rather than a single row) and stores it in memory. Each time that next() is called subsequently, it reads a row from the rows in memory until they are exhausted, and only then will next() go back to the database.

You set a property (java.util.Property) to control the size of the array fetch. The property is weblogic.oci.cacheRows; it is set by default to 100. Here's an example of setting this property to 300, which means that calls to next() only hit the database once for each 300 rows retrieved by the client.

Properties props = new Properties();
props.put("user", "scott");
props.put("password", "tiger");
props.put("server", "DEMO");
props.put("weblogic.oci.cacheRows", "300");

Driver myDriver = (Driver)
Class.forName("weblogic.jdbc.oci.Driver").newInstance();

Connection conn = myDriver.connect("jdbc:weblogic:oracle", props);

You can improve client performance and lower the load on the database server by taking advantage of this JDBC extension. Caching rows in the client, however, requires client resources. You should tune your application for the best balance between performance and client resources, depending on your network configuration and your application.

If any columns in a SELECT are of type LONG, BLOB, or CLOB, WebLogic Server temporarily resets the cache size to 1 for the ResultSet associated with that select statement.


Using Stored Procedures

This section describes variations in the implementation of stored procedures that are specific to Oracle.

  • Binding a Parameter to an Oracle Cursor
  • Notes on Using CallableStatement

Binding a Parameter to an Oracle Cursor

WebLogic has created an extension to JDBC (weblogic.jdbc.oci.CallableStatement) that allows you to bind a parameter for a stored procedure to an Oracle cursor. You can create a JDBC ResultSet object with the results of the stored procedure. This allows you to return multiple ResultSets in an organized way. The ResultSets are determined at run time in the stored procedure.

Here is an example. First define the stored procedures as follows:

create or replace package
curs_types as
type EmpCurType is REF CURSOR RETURN emp%ROWTYPE;
end curs_types;
/

create or replace procedure
single_cursor(curs1 IN OUT curs_types.EmpCurType,
ctype in number) AS BEGIN
if ctype = 1 then
OPEN curs1 FOR SELECT * FROM emp;
elsif ctype = 2 then
OPEN curs1 FOR SELECT * FROM emp where sal 2000;
elsif ctype = 3 then
OPEN curs1 FOR SELECT * FROM emp where deptno = 20;
end if;
END single_cursor;
/
create or replace procedure
multi_cursor(curs1 IN OUT curs_types.EmpCurType,
curs2 IN OUT curs_types.EmpCurType,
curs3 IN OUT curs_types.EmpCurType) AS
BEGIN
OPEN curs1 FOR SELECT * FROM emp;
OPEN curs2 FOR SELECT * FROM emp where sal 2000;
OPEN curs3 FOR SELECT * FROM emp where deptno = 20;
END multi_cursor;
/

In your Java code, you'll construct CallableStatements with the stored procedures and register the output parameter as data type java.sql.Types.OTHER. When you retrieve the data into a ResultSet, use the output parameter index as an argument for the getResultSet() method.

java.sql.CallableStatement cstmt = conn.prepareCall(
"BEGIN OPEN ? " +
"FOR select * from emp; END;");
cstmt.registerOutParameter(1, java.sql.Types.OTHER);

cstmt.execute();
ResultSet rs = cstmt.getResultSet(1);
printResultSet(rs);
rs.close();
cstmt.close();

java.sql.CallableStatement cstmt2 = conn.prepareCall(
"BEGIN single_cursor(?, ?); END;");
cstmt2.registerOutParameter(1, java.sql.Types.OTHER);

cstmt2.setInt(2, 1);
cstmt2.execute();
rs = cstmt2.getResultSet(1);
printResultSet(rs);

cstmt2.setInt(2, 2);
cstmt2.execute();
rs = cstmt2.getResultSet(1);}
printResultSet(rs);

cstmt2.setInt(2, 3);
cstmt2.execute();
rs = cstmt2.getResultSet(1);
printResultSet(rs);
cstmt2.close();

java.sql.CallableStatement cstmt3 = conn.prepareCall(
"BEGIN multi_cursor(?, ?, ?); END;");
cstmt3.registerOutParameter(1, java.sql.Types.OTHER);
cstmt3.registerOutParameter(2, java.sql.Types.OTHER);
cstmt3.registerOutParameter(3, java.sql.Types.OTHER);

cstmt3.execute();

ResultSet rs1 = cstmt3.getResultSet(1);
ResultSet rs2 = cstmt3.getResultSet(2);
ResultSet rs3 = cstmt3.getResultSet(3);

For the full code for this example, including the printResultSet() method, see the examples in the samples/examples/jdbc/oracle/ directory.

Note that the default size of an Oracle stored procedure string is 256K.

Notes on Using CallableStatement

The default length of a string bound to an OUTPUT parameter of a CallableStatement is 128 characters. If the value you assign to the bound parameter exceeds that length, you'll get the following error:

ORA-6502: value or numeric error

You can adjust the length of the value of the bound parameter by passing an explicit length with the scale argument to the CallableStatement.registerOutputParameter() method. Here is a code example that binds a VARCHAR that will never be larger than 256 characters:

CallableStatement cstmt =
conn.prepareCall("BEGIN testproc(?); END;");

cstmt.registerOutputParameter(1, Types.VARCHAR, 256);
cstmt.execute();
System.out.println(cstmt.getString());
cstmt.close();


DatabaseMetaData Methods

This section describes some variations in the implementation of DatabaseMetaData methods that are specific to Oracle:

  • As a general rule, the String catalog argument is ignored in all DatabaseMetaData methods.
  • In the DatabaseMetaData.getProcedureColumns() method:
    • The String catalog argument is ignored.
    • The String schemaPattern argument accepts only exact matches (no pattern matching).
    • The String procedureNamePattern argument accepts only exact matches (no pattern matching).
    • The String columnNamePattern argument is ignored.


Support for JDBC Extended SQL

The JavaSoft JDBC specification includes SQL Extensions, also called SQL Escape Syntax. All WebLogic jDrivers support Extended SQL. Extended SQL provides access to common SQL extensions in a way that is portable between DBMSs.

For example, the function to extract the day name from a date is not defined by the SQL standards. For Oracle, the SQL is:

select to_char(date_column, 'DAY') from table_with_dates

The equivalent function for Sybase and Microsoft SQL Server is:

select datename(dw, date_column) from table_with_dates

Using Extended SQL, you can retrieve the day name for both DBMSs as follows:

select {fn dayname(date_column)} from table_with_dates

Here's an example that demonstrates several features of Extended SQL:

String query =
"-- This SQL includes comments and " +
"JDBC extended SQL syntax.\n" +
"select into date_table values( \n" +
" {fn now()}, -- current time \n" +
" {d '1997-05-24'}, -- a date \n" +
" {t '10:30:29' }, -- a time \n" +
" {ts '1997-05-24 10:30:29.123'}, -- a timestamp\n" +
" '{string data with { or } will not be altered}'\n" +
"-- Also note that you can safely include" +
" { and } in comments or\n" +
"-- string data.";
Statement stmt = conn.createStatement();
stmt.executeUpdate(query);

Extended SQL is delimited with curly braces ("{}") to differentiate it from common SQL. Comments are preceded by two hyphens, and are ended by a new line ("\n"). The entire Extended SQL sequence, including comments, SQL, and Extended SQL, is placed within double quotes and passed to the execute() method of a Statement object. Here is Extended SQL used as part of a CallableStatement:

CallableStatement cstmt =
conn.prepareCall("{ ? = call func_squareInt(?)}");

This example shows that you can nest extended SQL expressions:

select {fn dayname({fn now()})}

You can retrieve lists of supported Extended SQL functions from a DatabaseMetaData object. This example shows how to list all the functions a JDBC driver supports:

DatabaseMetaData md = conn.getMetaData();
System.out.println("Numeric functions: " +
md.getNumericFunctions());
System.out.println("\nString functions: " +
md.getStringFunctions());
System.out.println("\nTime/date functions: " +
md.getTimeDateFunctions());
System.out.println("\nSystem functions: " +
md.getSystemFunctions());
conn.close();


Overview of JDBC 2.0 for Oracle

The following JDBC 2.0 features are implemented in WebLogic jDriver for Oracle:

  • BLOBs (Binary Large Objects)?WebLogic Server can now handle this Oracle data type.
  • CLOBs (Character Large Objects)?WebLogic Server can now handle this Oracle data type.
  • Character Streams for both ASCII and Unicode characters?A better way to handle characters streams, as streams of characters instead of as byte arrays.
  • Batch Updates?You can now send multiple statements to the database as a single unit.

These features have been added to the existing JDBC functionality previously available in the WebLogic Server. All of your existing code for previous drivers will work with the new WebLogic jDriver for Oracle.

Note: WebLogic Server also supports Oracle extension methods for prepared statements, callable statements, arrays, STRUCTs, and REFs. However, to use these extensions, you must use the Oracle Thin Driver to connect to your database.


Configuration Required to Support JDBC 2.0

WebLogic Server Version runs on an SDK that provides the Java 2 environment required by JDBC 2.0. For a complete list of supported configurations, see the WebLogic Server Supported Configurations page.


BLOBs and CLOBs

The BLOB (Binary Large Object) and CLOB (Character Large Object) data types were made available with the release of Oracle version 8. The JDBC 2.0 specification and WebLogic Server also support these data types. This section contains information about using these data types.

Transaction Boundaries

BLOBs and CLOBs in Oracle behave differently than other data types in regards to transactional boundaries (statements issued before an SQL commit or rollback statement). in that a BLOB or CLOB will be come inactive as soon as a transaction is committed. If AutoCommit is set to TRUE, the transaction will be automatically committed after each command issued on the connection, including SELECT statements. For this reason you will need to set AutoCommit to false if you need to have a BLOB or CLOB available across multiple SQL statements. You will then need to manually commit (or rollback) the transactions at the appropriate time. To set AutoCommit to false, enter the following command:

conn.setAutoCommit(false); // where conn is your connection object

BLOBs

The BLOB data type, available with Oracle version 8, allows you to store and retrieve large binary objects in an Oracle table. Although BLOBs are defined as part of the JDBC 2.0 specification, the specification does not provide methods to update BLOB columns in a table. The BEA WebLogic implementation of BLOBs, however, does provide this functionality by means of an extension to JDBC 2.0.

Connection Properties

weblogic.oci.selectBlobChunkSize

This property sets the size of an internal buffer used for sending bytes or characters to an I/O stream. When the Chunk size is reached, the driver will perform an implicit flush() operation, which will cause the data to be sent to the DBMS.

Explicitly setting this value can be useful in controlling memory usage on the client.

If the value of this property is not explicitly set, a default value of 65534 will be used.

Set this property by passing it to the Connection object as a property. For example, this code fragment sets weblogic.oci.selectBlobChunkSize to 1200:

Properties props = new Properties();
props.put("user", "scott");
props.put("password", "tiger");
props.put("server", "DEMO");

props.put ("weblogic.oci.selectBlobChunkSize","1200");

Driver myDriver = (Driver)
Class.forName("weblogic.jdbc.oci.Driver").newInstance();

Connection conn =
driver.connect("jdbc:weblogic:oracle:myServer", props);

weblogic.oci.insertBlobChunkSize

This property specifies the buffer size (in bytes) of input streams used internally by the driver.

Set this property to a positive integer to insert BLOBs into an Oracle DBMS with the BLOB chunking feature. By default, this property is set to zero (0), which means that BLOB chunking is turned off.

Import Statements

To use the BLOB functionality described in this section, import the following classes in your client code:

import java.sql.*;
import java.util.*;
import java.io.*;
import weblogic.jdbc.common.*;

Initializing a BLOB Field

When you first insert a row containing a BLOB data type, you must insert the row with an "empty" BLOB before the field can be updated with real data. You can insert an empty BLOB with the Oracle EMPTY_BLOB() function.

To initialize a BLOB field:

  1. Create a table with one or more columns defined as a BLOB data type.
  2. Insert a new row with an empty BLOB column, using the Oracle EMPTY_BLOB() function:
  3. stmt.execute("INSERT into myTable values (1,EMPTY_BLOB()");
  4. Obtain a "handle" to the BLOB column:
  5. java.sql.Blob myBlob = null;
    Statement stmt2 = conn.createStatement();
    stmt2.execute("SELECT myBlobColumn from myTable
    where pk = 1 for update");
    ResultSet rs = stmt2.getResultSet();
    rs.next() {
    myBlob = rs.getBlob("myBlobColumn");
    // do something with the BLOB
    }
  6. You can now write data to the BLOB. Continue with the next section, Writing Binary Data to a BLOB.

Writing Binary Data to a BLOB

To write binary data to a BLOB column:

  1. Obtain a handle to the BLOB field as described above, in Initializing a BLOB Field, step 3.
  2. Create an InputStream object containing the binary data.
  3. java.io.InputStream is = // create your input stream
  4. Create an output stream to which you write your BLOB data. Note that you must cast your BLOB object to weblogic.jdbc.common.OracleBlob.
  5. java.io.OutputStream os =
    ((weblogic.jdbc.common.OracleBlob) myBlob).getBinaryOutputStream();
  6. Write the input stream containing your binary data to the output stream. The write operation is finalized when you call the flush() method on the OutputStream object.
  7. byte[] inBytes = new byte[65534]; // see note below
    int numBytes = is.read(inBytes);
    while (numBytes > 0) {
    os.write(inBytes, 0, numBytes);
    numBytes = is.read(inBytes);
    }
    os.flush();

    Note: The value [65534] in the above code presumes that you have not set the weblogic.oci.select.BlobChunkSize property whose default is 65534. If you have set this property, setting the byte[] value to match the value set in theweblogic.oci.select.BlobChunkSize property will provide the most efficient handling of the data. For more information about this property, see Connection Properties.

  8. Clean up:
  9. os.close();
    pstmt.close();
    conn.close();

Writing a BLOB Object

Writing a BLOB object to a table is performed with Prepared Statements. For example, to write the myBlob object to the table myOtherTable:

PreparedStatement pstmt = conn.preparedStatement(
"UPDATE myOtherTable SET myOtherBlobColumn = ? WHERE id = 12");
pstmt.setBlob(1, myBlob);

Reading BLOB Data

When you retrieve a BLOB column with the getBlob() method and then use a ResultSet from a SQL SELECT statement, only a pointer to the BLOB data is returned; the binary data is not actually transferred to the client until the getBinaryStream() method is called and the data is read into the stream object.

To read BLOB data from an Oracle table:

  1. Execute a SELECT statement:
  2. stmt2.execute("SELECT myBlobColumn from myTable");
  3. Use the results from the SELECT statement.
  4. int STREAM_SIZE = 10;
    byte[] r = new byte[STREAM_SIZE];
    ResultSet rs = stmt2.getResultSet();
    java.sql.Blob myBlob = null;
    while (rs.next) {
    myBlob = rs.getBlob("myBlobColumn");
    java.io.InputStream readis = myBlob.getBinaryStream();
    for (int i=0 ; i < STREAM_SIZE ; i++) {
    r[i] = (byte) readis.read();
    System.out.println("output [" + i + "] = " + r[i]);
    }
  5. Clean up:
  6. rs.close();
    stmt2.close();

Note: You can also use a CallableStatement to generate a ResultSet. This ResultSet can then be used as shown above. See your JDK documentation under java.sql.CallableStatment for details.

Other Methods

The following methods of the java.sql.Blob interface are also implemented in the WebLogic Server JDBC 2.0 driver. For details, see your JDK documentation:

  • getBinaryStream()
  • getBytes()
  • length()

The position() method is not implemented.

CLOBs

The CLOB data type, available with Oracle version 8, enables storage of large character strings in an Oracle table. Since the JDBC 2.0 specification does not include functionality to directly update CLOB columns, BEA has implemented the methods getAsciiOutputStream() (for ASCII data) and getCharacterOutputStream() (for Unicode data) to insert or update a CLOB.

Codeset Support

Depending on which version of the Oracle Server and client you are using you may need to set one of the following properties by passing them to the Connection object when you establish your connection the DBMS in your Java client code.

weblogic.codeset

This property allows you to set a codeset from within your Java code. You must also set the NLS_LANG environment variable for the Oracle client.

weblogic.oci.ncodeset

This property sets the National codeset used by the Oracle server. You must also set the NLS_NCHAR environment variable for the Oracle client.

weblogic.oci.codeset_width

This property tells the WebLogic Server which type you are using. Note the following restrictions on codeset use:

Possible Values:

0 for variable-width codesets

1 for fixed-width codesets (1 is the default value)

2 or 3 for the width, in bytes, of the codeset

weblogic.oci.ncodeset_width

If you are using one of Oracle's National codesets, specify the width of that codeset with this property. Note the following restrictions on codeset use:

Possible Values:

0 for variable-width codesets

1 for fixed-width codesets (1 is the default value)

2 or 3 for the width, in bytes, of the codeset

Initializing a CLOB Field

When you first insert a row containing a CLOB data type, you must insert the row with an "empty" CLOB before the field can be updated with real data. You can insert an empty CLOB with the Oracle EMPTY_CLOB() function.

To initialize a CLOB column:

  1. Create a table with one or more columns defined as a CLOB data type.
  2. Insert a new row with an empty CLOB column, using the Oracle EMPTY_CLOB() function:
  3. stmt.execute("INSERT into myTable VALUES (1,EMPTY_CLOB()");
  4. Obtain an object for the CLOB column:
  5. java.sql.Clob myClob = null;
    Statement stmt2 = conn.createStatement();
    stmt2.execute("SELECT myClobColumn from myTable
    where pk = 1 for update");
    ResultSet rs = stmt2.getResultSet();
    while (rs.next) {
    myClob = rs.getClob("myClobColumn");
    }
  6. You can now write character data to the CLOB. If your data is in the ASCII format, Continue with the next section, Writing ASCII Data to a CLOB. If your character data is in Unicode format, see Writing Unicode Data to a CLOB

Writing ASCII Data to a CLOB

To write ASCII character data to a CLOB column:

  1. Obtain a "handle" to the CLOB as described above, in Initializing a CLOB Field, step 3.
  2. Create an object containing the character data:
  3. String s = // some ASCII data
  4. Create an ASCII output stream to which you write your CLOB characters. Note that you must cast your CLOB object to weblogic.jdbc.common.OracleClob.
  5. java.io.OutputStream os =
    ((weblogic.jdbc.common.OracleClob) myclob).getAsciiOutputStream();
  6. Write the input stream containing your ASCII data to the output stream. The write operation is finalized when you call the flush() method on the OutputStream object.
  7. byte[] b = s.getBytes("ASCII");
    os.write(b);
    os.flush();
  8. Clean up:
  9. os.close();
    pstmt.close();
    conn.close();

Writing Unicode Data to a CLOB

To write Unicode character data to a CLOB column:

  1. Obtain a "handle" to the CLOB as described earlier, in step 3 of "Initializing a CLOB Field."
  2. Create an object containing the character data:
  3. String s = // some Unicode character data
  4. Create a character output stream to which you write your CLOB characters. Note that you must cast your CLOB object to weblogic.jdbc.common.OracleClob.
  5. java.io.Writer wr =
    ((weblogic.jdbc.common.OracleClob) myclob).getCharacterOutputStream();
  6. Write the input stream containing your ASCII data to the output stream. The write operation is finalized when you call the flush() method on the OutputStream object.
  7. char[] b = s.toCharArray(); // converts 's' to a character array
    wr.write(b);
    wr.flush();
  8. Clean up:
  9. wr.close();
    pstmt.close();
    conn.close();

Writing CLOB Objects

Writing a CLOB object to a table is performed with Prepared Statements. For example, to write the myClob object to the table myOtherTable:

PreparedStatement pstmt = conn.preparedStatement(
"UPDATE myOtherTable SET myOtherClobColumn = ? WHERE id = 12");
pstmt.setClob(1, myClob);

Updating a CLOB Value Using a Prepared Statement

If you use a prepared statement to update a CLOB and the new value is shorter than the previous value, the CLOB will retain the characters that were not specifically replaced during the update. For example, if the current value of a CLOB is abcdefghij and you update the CLOB using a prepared statement with zxyw, the value in the CLOB is updated to zxywefghij. To correct values updated with a prepared statement, you should use the dbms_lob.trim procedure to remove the excess characters left after the update. See the Oracle documentation for more information about the dbms_lob.trim procedure.

Reading CLOB Data

When a CLOB column is retrieved using a result set from a SQL SELECT statement, only a pointer to the CLOB data is returned; the actual data is not transferred to the client with the result set until the getAsciiStream() method is called and the characters are read in to the stream.

To read CLOB data from an Oracle table:

  1. Execute a SELECT statement:
  2. java.sql.Clob myClob = null;
    Statement stmt2 = conn.createStatement();
    stmt2.execute("SELECT myClobColumn from myTable");
  3. Use the results from the SELECT statement:
  4. ResultSet rs = stmt2.getResultSet();
    while (rs.next) {
    myClob = rs.getClob("myClobColumn");
    java.io.InputStream readClobis =
    myReadClob.getAsciiStream();
    char[] c = new char[26];
    for (int i=0 ; i < 26 ; i++) {
    c[i] = (char) readClobis.read();
    System.out.println("output [" + i + "] = " + c[i]);
    }
    }
  5. Clean up:
  6. rs.close();
    stmt2.close();

Note: You can also use a CallableStatement to generate a ResultSet. This ResultSet can then be used as shown above. See your JDK documentation under java.sql.CallableStatment for details.

Other Methods

The following methods of the java.sql.Clob interface are also implemented in the WebLogic Server (a JDBC 2.0 driver):

  • getSubString()
  • length()

For details about these methods, see the JDK documentation.

Note: The position() method is not implemented.


Character and ASCII Streams

Some new methods in the JDBC 2.0 specification allow character and ASCII streams to be manipulated as characters rather than as bytes, as in earlier versions. The following methods for handling character and ASCII streams are implemented in WebLogic Server.

Unicode Character Streams

getCharacterStream()

The java.sql.ResultSet interface uses this method for reading Unicode streams as the Java type java.io.Reader. This method replaces the deprecated getUnicodeStream() method.

setCharacterStream()

The java.sql.PreparedStatement interface uses this method for writing a java.io.Reader object. This method replaces the deprecated setUnicodeStream() method.

ASCII Character Streams

getAsciiStream()

The java.sql.ResultSet interface uses this method for reading ASCII streams as the Java type java.io.InputStream.

setAsciiStream()

The java.sql.PreparedStatement interface uses this method for writing a java.io.InputStream object.

For details about using these methods, see your JDK documentation.


Batch Updates

Batch updates are a feature of JDBC 2.0 that allows you to send multiple SQL update statements to the DBMS as a single unit. Depending on the application, this can provide improved performance over sending multiple update statements individually. The Batch update feature is available in the Statement interface and requires the use of SQL statements that do not return a result set.

The following SQL statements can be used with Batch updates:

  • INSERT INTO
  • UPDATE
  • DELETE
  • CREATE TABLE
  • DROP TABLE
  • ALTER TABLE

Using Batch Updates

This is the basic procedure for using Batch updates:

  1. Get a connection from a connection pool that uses the WebLogic jDriver for Oracle as described in Using the Connection Pool in an Application.
  2. Create a statement object using the createStatement() method. For example:
  3. Statement stmt = conn.createStatement();
  4. Use the addBatch() method to add SQL statements to the batch. These statements are not sent to the DBMS until the executeBatch() method is called. For example:
  5. stmt.addBatch("INSERT INTO batchTest VALUES ('JOE', 20,35)");
    stmt.addBatch("INSERT INTO batchTest VALUES ('Bob', 30,44)");
    stmt.addBatch("INSERT INTO batchTest VALUES ('Ed', 34,22)");
  6. Use the executeBatch() method to send the batch to the DBMS for processing. For example:
  7. stmt.executeBatch();

    If any of the statements fail an exception is thrown, and none of the statements is executed.

To use batch updates with for PreparedStatements and CallableStatements, create the statement normally, set the input parameters, and then call the addBatch() method with no arguments. Repeat for each additional set of input parameter values (each update), and then call executeBatch(). For example:

  1. Get a connection from a connection pool that uses the WebLogic jDriver for Oracle as described in Using the Connection Pool in an Application.
  2. Create a PreparedStatement object using the prepareStatement() method. For example:
  3. PreparedStatement pstmt = conn.prepareStatement("INSERT INTO batchTest VALUES (?,?,?)");
  4. Set the input parameters and then call addBatch() to add an update to the batch. These statements are not sent to the DBMS until the executeBatch() method is called. For example:
  5. pstmt.setString(1,"Joe");
    pstmt.setInt(2,20);
    pstmt.setInt(3,35);
    pstmt.addBatch();
  6. Repeat for each additional set of input parameter values:
  7. pstmt.setString(1,"Bob");
    pstmt.setInt(2,30);
    pstmt.setInt(3,44);
    pstmt.addBatch();
    pstmt.setString(1,"Ed");
    pstmt.setInt(2,34);
    pstmt.setInt(3,22);
    pstmt.addBatch();
  8. Use the executeBatch() method to send the batch to the DBMS for processing. For example:
  9. pstmt.executeBatch();

    If any of the prepared statements fail, an exception is thrown and none of the statements is executed.

Batch updates also work with CallableStatement objects for stored procedures. Each stored procedure must return an update count. The stored procedure cannot take any OUT or INOUT parameters.

Clearing the Batch

You may clear a batch of statements that was created with the addBatch() method, by using the clearBatch() method. For example:

stmt.clearBatch();

Update Counts

According to the JDBC 2.0 specification, the executeBatch() method should return an array of Integers containing the number of rows updated for each Statement. The Oracle DBMS, however, does not supply this information to the driver. Instead, the Oracle DBMS returns -2 for all updates.


New Date Methods

The following methods have a signature which takes a java.util.Calendar object as a parameter. java.util.Calendar allows you to specify time zone and location information that is used to translate dates. Consult your JDK API guide for details about using the java.util.Calendar class.

java.sql.ResultSet.getDate(int columnIndex, Calendar cal)

(returns a java.sql.Date object)

java.sql.PreparedStatement.setDate

'JAVA' 카테고리의 다른 글

MarshalException  (0) 2006.10.19
Code Convention : jsp page 작성 요령  (0) 2006.07.21
자바웹프로그래머의기본  (1) 2006.04.01
자바 웹 프로젝트 개발 환경 갖추기  (0) 2006.04.01
파일비교 툴  (0) 2006.03.31
posted by 구름너머 2006. 5. 24. 14:25
한국전산원(원장 김창곤 www.nca.or.kr)은 제6회 정보시스템감리사 검정을 위한 필기시험을 오는 4월 1일 실시한다.

원서접수는 14일까지이며, 감리사 홈페이지(http://auditor.nca.or.kr)를 통해서 가능하다.

정보시스템 감리사란 정보시스템의 효율성과 안전성 향상을 위해 시스템 구축과 운영에 관한 사항을 종합적으로 점검, 평가해 개선방향을 제시하는 전문가를 말한다.

필기전형 시험은

1.프로젝트 관리·

2.소프트웨어공학·

3.데이터베이스·

4.시스템 아키텍처 및 보안의

4개 과목에 대해 각 과목별 25문제씩 총 100문제가 출제된다.

상대 평가이기는 하지만,

과목별 40점 미만의 점수 획득시 과락으로 분류돼 다른 과목에서 높은 점수를 획득해도 불합격 처리된다.

'ORACLE' 카테고리의 다른 글

개발자가 범하기 쉬운 튜닝 이슈 10가지  (0) 2006.08.09
오라클 데이타베이스 입문  (0) 2006.07.21
테이블 조회(PK,comments포함)  (0) 2006.04.21
오라클 팁  (0) 2006.04.21
sysdate 활용방법  (0) 2006.04.21
posted by 구름너머 2006. 5. 24. 09:10

◇아드보카트호 향후 일정(한국시간)

5월14일 : 대표팀 첫 소집(낮 12시.파주 대표팀 트레이닝센터)

5월14일-5월20일 : 파주 대표팀 트레이닝센터 훈련

5월20일-5월22일 : 숙소 그랜드힐튼호텔로 이동

서울월드컵경기장 보조구장 훈련

5월23일 : 국내 1차 평가전 vs 세네갈(20시.서울월드컵)

5월26일 : 국내 2차 평가전 vs 보스니아-헤르체고비나(20시.서울월드컵)

5월27일 : 1차 베이스캠프 스코틀랜드 글래스고로 출발(13시30분.인천공항)

5월31일 : 글래스고→노르웨이 오슬로 이동

6월 2일 : 현지 1차 평가전 vs 노르웨이(새벽 2시.오슬로)

6월 4일 : 현지 2차 평가전 vs 가나(23시.스코틀랜드 에딘버러)

6월 6일 : 글래스고→독일 쾰른 입성(시간 미정)

독일 쾰른 베이스캠프 '슐로스 벤스베르크' 호텔 체크인

6월10일 : 독일월드컵 본선 개막(새벽 1시)

6월12일 : 쾰른→프랑크푸르트 이동(17시.버스)

6월13일 : 스타디움 공식훈련(새벽 1시)

6월13일 : 본선 G조 1차전 vs 토고(22시.프랑크푸르트)

경기 직후 쾰른 베이스캠프로 이동

6월17일 : 쾰른→라이프치히 이동(17시.전세기)

6월18일 : 스타디움 공식훈련(새벽 1시)

6월19일 : 본선 G조 2차전 vs 프랑스(새벽 4시.라이프치히)

경기 직후 쾰른 베이스캠프로 이동

6월22일 : 쾰른→하노버 이동(17시.전세기)

6월23일 : 스타디움 공식훈련(새벽 1시)

본선 G조 3차전 vs 스위스(새벽 4시.하노버)

경기 직후 쾰른 베이스캠프로 이동

posted by 구름너머 2006. 5. 17. 09:25
신나이(신과나눈이야기) 시리즈
신나이 시리즈의 각 권별 소개 페이지입니다.
[참고] 신나이 시리즈 구매대행 사이트: http://www.synage.net
'신나이에 나오는 인물과 책 그리고 영화'- 신나이속 신나이, 클릭 !!!
신과 나눈 이야기 1 [아름드리미디어] ★★★★★

닐 도날드 월쉬 저 | 1997년 7월 20일

<내용 요약>

[신과의 교류]

o 나(신)는 모두에게 언제나 말한다. 내가 가장 자주 쓰는 교류 형식은 느낌이다. 느낌은 영혼의 언어다. 네 가장 내밀한 느낌 속에 감...
신과 나눈 이야기 2 [아름드리미디어] ★★★★

닐 도날드 월쉬 저 | 1997년 11월 1일

<내용 요약>

[선택과 우연]

o 너희가 어떤 것에 대해 마음을 정할 때, 너희가 상상할 수 있는 것보다 훨씬 더 미묘하고 복잡한 힘들이 개입한다. 이 힘들과 이 과정...
신과 나눈 이야기 3 [아름드리미디어] ★★★★★

닐 도날드 월쉬 저 | 1999년 3월 30일

<내용 요약>

[행복 만들기]

o 남이 나를 어떻게 생각할지 염려하는 한, 너는 그 사람들의 것이다. 남이란 존재하지 않는다는 걸 깨달을 때, 자신을 위한 최고의 선택...
신과 나누는 우정 [아름드리미디어] ★★★★★

닐 도날드 월쉬 저 | 1999년 3월 30일

<내용 요약>

o 너희와 나의 관계는 너희 서로간의 관계와 전혀 다르지 않다. 너희는 이야기를 나누는 것으로 서로 간의 관계를 시작하여, 잘 되어나가면 우정을 나눈다. 그것이 잘 되어나가면,...
신과 나눈 교감 [아름드리미디어] ★★★★★

닐 도널드 월시 저 | 2001년 4월 16일

<내용 요약>

o 신인 나는 너희에게 여러 해에 걸쳐서 여러 가지 방식으로 여러 번 이야기해 왔지만, 한번도 이렇게 직접적으로는 하지 않았다. 이제 나는 너희에게, 너희자신으로서 말한다. 이런 일은 ...
신과나눈이야기 새로운 계시록 [반디미디어] ★★★★

닐 도널드 월시 저 | 2003년 5월 20일

<내용 요약>

[평화에 이르는 다섯 단계]
1. 너희는 신과 삶에 관한 믿음 가운데 일부는 더 이상 작동하지 않는다고 인정할 수 있다.
2. 너희는 신과 삶에 관해 이해하지 못...
Tomorrow's God [ATRIA BOOKS, New York] ★★★★★

Neale Donald Walsch 저

<내용 요약>

1. Tomorrow's God does not require anyone to believe in God.
2. Tomorrow's God is without gender, size, sh...

'BOOKS' 카테고리의 다른 글

어두운 세상에 길은 있는가  (0) 2006.09.08
셜록 홈스의 과학 미스테리  (0) 2006.04.02
posted by 구름너머 2006. 5. 4. 01:11

오랜만에감동을 받은 영화를 찾았다.

사랑에 대해 배울수 있는 기회가 되길...

[메인카피]

8개의 충돌, 8색의 상처, 그 끝에서... 사랑을 배우다!

[줄거리]

LA 교외의 한 도로에서 시체가 발견된다. 현장에 도착한 수사관 그레이엄(돈 치들)의 표정이 당혹과 슬픔으로 일그러지는 순간, 이야기는 36시간 전, 15명의 삶으로 돌아간다.

백인 부부 릭과 진 - 지방검사 릭(브랜든 프레이져)과 그의 아내 진(산드라 블록)이 두 흑인청년에게 차를 강탈당한 밤, 아내 진은 주위 모든 것에 화가 난다. 집문 열쇠를 수리하러 온 멕시칸 남자 대니얼은 의심스럽고 가정부에겐 짜증이 난다. 그러나 그녀는 지금 모르고 있다. 자신이 정치적 성공에 몰두한 남편 때문에 외로우며, 36시간 후 결코 예상하지 못했던 기적을 만난다는 것을...

흑인 부부 카메론과 크리스틴 - 같은 시간, 흑인이자 방송국 PD인 카메론(테렌스 하워드)과 아내 크리스틴(탠디 뉴튼)은 지방검사 릭의 강탈당한 차와 같은 차종이라는 이유로 백인 경찰 라이언과 핸슨에게 검문을 당한다. 라이언은 여자에게 몸수색을 이유로 성적 모욕을 준다. 수치를 당한 아내는 남편을 비난한다. 그러나 남편은 그 사건이 자신의 지위에 위협을 줄까 두렵다. 아직... 그는 자신이 지켜야 할 것이 무엇인지 모르고 있다.

백인 경찰 라이언과 핸슨 - 라이언(맷 딜런)은 아버지의 병 수발이 힘들기만 하다. 그의 폭력은 병든 아버지로부터 받는 아픔에 대한 화풀이일 뿐이지만, 그는 아직 자신이 수치심을 안겨준 흑인 여자(크리스틴)와의 운명적 만남을 알지 못한다. 또한, 핸슨(라이언 필립)은 라이언의 행동에 분노하지만 36시간 후, 그 역시 편견에 사로잡힌 엄청난 충돌이 있음을 감히 상상도 못한다.

이란인 파라드와 멕시칸 대니얼 - 페르시아계 이민자인 파라드는 자신의 가게를 지키기 위해 총을 사고 열쇠를 고치지만, 자신이 무시당하고 있다고 느낀다. 도둑이 가게에 침입한 날, 그것이 열쇠 수리공 멕시칸 대니얼 때문이라고 생각한 파라드는 결국, 대니얼의 어린 딸을 향해 총을 쏘게 된다. 그리고, 이 모든 오해는 기적과 구원을 가져온다.

흑인형사 그레이엄 - 살인사건의 현장, 그가 보고 있는 시체는 자신의 동생이다. 백인사회에서 성공을 위해 가족으로부터 스스로 소외를 선택한 그이지만, 지금 그 앞엔 동생의 시체와 함께 ‘동생을 죽인 살인자는 너’라는 어머니의 비난만 남아있다.

흑인청년 피터와 앤쏘니 - 36시간 전, 지방검사 릭의 차를 강탈했던 피터와 앤쏘니. 피터는 수많은 사람들과의 만남 끝에 집으로 향하고 있었다. 그리고... 당신이 절대 상상할 수 없었던 충돌을 맞이한다. LA. 결말을 예측할 수 없는 36시간을 향해 그들은 서로 교차하고 충돌하며 달려가고 있다. 아직, 그들은 모르고 있다. 서로와의 충돌이 어떤 영향을 가져올 것인지...

[제작노트]

2006 ACADEMY WINNER
제78회 아카데미 작품상 수상
제78회 아카데미 각본상 수상
제78회 아카데미 편집상 수상

'세상의진리방' 카테고리의 다른 글

위장을 망치는 불변의 5적  (1) 2006.06.09
자수정  (0) 2006.06.07
[book]소리없는 소리  (0) 2006.04.26
한반도 기운을 읽어내는 예언가 한바다  (0) 2006.04.24
보석관련 사이트  (0) 2006.04.21
posted by 구름너머 2006. 5. 3. 09:17
부동산·주민소환제 등 6개 법안이 뭐길래?
[오마이뉴스 2006-05-02 15:49]
[오마이뉴스 김연기 기자] 국회는 2일 오후, 한나라당의 반대 속에 열린우리당과 민주당, 민주노동당 의원들이 참석한 가운데 본회의를 열어 부동산 대책 법안 등 6개 법안을 통과시켰다. 이날 국회 본회의 직권상정을 통해 통과한 6개 법안에 대해 알아봤다.

재건축초과이익환수법, 도시 및 주거환경정비법

재건축초과이익환수법은 재건축개발이익에 대해 최고 50%의 비율로 개발부담금을 부과하는 것을 골자로 하고 있다. 이 제정 법률안은 지난 19일 국회 건교위 공청회를 거쳐 법안소위에 상정된 바 있다.

도시 및 주거환경정비법 개정안은 재건축 안전진단 예비평가를 공공기관에 맡기고 재검토 의뢰 권한을 시도지사로 조정하는 내용을 담고 있다. 이 법에 따라 앞으로 시, 군, 구청장은 재건축을 추진하는 아파트 단지에 대한 안전진단 통과 결정을 내릴 경우 시도지사에 보고해야 한다. 또 시도지사는 시설안전기술공단이나 건설기술연구원 등에 안전진단 결과가 적절한지 검토를 의뢰할 수 있고 통과 결정을 취소할 수 있다.

3·30 부동산 후속대책 법안 격인 이들 법안이 통과됨에 따라 다소 불안한 모습을 보였던 재건축 시장도 다시 안정세를 찾을 것으로 예상된다. 그러나 부동산 3법 중의 하나인 임대주택법안은 이번 본회의 처리에서 제외됐다.

주민소환제법, 지방자치법 개정안

주민소환제법은 주민소환 대상을 지방자치단체장과 비례대표를 제외한 지방의회 의원으로 규정하고
▲시·도지사는 유권자 10% 이상
▲기초단체장은 유권자 15% 이상
▲지방의원은 유권자 20% 이상의 찬성으로 주민소환 투표를 청구할 수 있게 했다.

청구사유에는 별도의 제한을 두지 않았으며 전체 유권자 3분의 1 이상의 투표와 과반수 찬성일 경우 소환대상자는 즉시 직을 잃게 된다. 이에 따라 지자체 선출직 공무원의 비리가 발생할 경우 주민투표로 해당 공무원을 해임시킬 수 있게 됐다.

그러나 법안은 주민소환 도입에 따른 지방행정의 안정성을 보장하기 위해 지자체장과 지방의원 취임후 1년 이내, 임기 말 1년 이내에는 주민소환 청구를 할 수 없다. 또 주민소환을 청구한 지 1년이 지나지 않으면 다시 소환청구를 할 수 없게 했다.

이 법안은 당초 직권상정에 없었으나 민주노동당의 요구로 본회의 개회 직전 직권상정됐다.

동북아역사재단법

동북아역사연구재단법은 독도문제를 연구하고 대안을 생산하는 역할을 하는 재단에 관한 법이다. 이 법안이 통과됨에 따라 독도와 일본의 역사교과서 왜곡을 포함한 동북아 지역의 역사문제를 체계적으로 연구할 싱크탱크가 설립될 수 있게 됐다.

특히 최근 대통령의 특별담화가 발표되고, 독도 문제가 다시 뜨거운 문제로 비상하면서 이 법에 대한 관심도 높아졌다. 김원기 국회의장도 그동안 동북아역사재단법안의 경우 국익이 걸려 있는 법안으로 더 이상 처리를 미룰 수 없다는 판단 아래, 법안 처리에 대한 강력한 의지를 보여왔다.

국제조세조정법

이른바 '론스타법'으로 불린 국제조세조정법 개정안은 조세회피 지역에 근거를 두고 국내에 진출한 펀드들이 투자 차익을 얻을 경우 세금을 원천징수 하도록 하는 내용을 담고 있다. 국제 투기자본이 국내에 들어와 거둬들인 투자차익에 대해 먼저 세금을 떼낸 후 나중에 과세여부 등을 따져 돌려주겠다는 게 골자다.

이에 따라 '국부유출' 논란의 진원지인 해외투기 펀드에 대한 원천징수가 오는 7월부터 차질없이 진행 될 수 있을 것으로 보인다. 배당, 이자, 주식양도 차익 등이 원천징수 대상에 포함된다. 재경부 장관이 조세회피지역으로 지정하는 지역이나 국가에 있는 외국계 펀드에만 이 법은 적용된다. 재경부는 법안 시행 예정일인 7월 1일 이전에 원천징수 대상 조세회피지역을 지정할 계획이다.

- ⓒ 2006 오마이뉴스, 무단 전재 및 재배포 금지 -