Background Image

FORUM

조회 수 1206 추천 수 0 댓글 2
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄

* 질문 등록 시 다음의 내용을 꼭 기입하여 주세요.
OS
Window7 32bit, Linux 64bit 등
CUBRID Ver.
[cubrid_rel] 수행 결과 9.3.9
CUBRID TOOL Ver.
[도움말]-[버전정보] 확인
응용 환경(API)
java, php, odbc 등 입력

* CUBRID 응용 오류, SQL 오류 또는 SQL 튜닝 관련된 문의는 반드시 다음의 내용을 추가해 주세요. 비밀글이나 비밀 댓글도 가능합니다.
* 저희가 상황을 이해하고, 재현이 가능해야 알 수 있는 문제들이 많습니다. 가능한 정보/정황들을 부탁합니다.
에러 내용 및 재현 방법 재현 가능한 Source와 SQL
관련 테이블(인덱스, 키정보 포함) 정보 CUBRID 홈 디렉토리 아래 log 디렉토리 압축


-------------- 아래에 질문 사항을 기입해 주세요. ------------------------------------------------------------------------
MS-SQL에 있는 프로시져를 CUBRID로 전환하고있는데 궁금한게 생겨서 이렇게 질문을 남깁니다.


프로시져로 작성할하게 될때 해당 프로시져 자바파일에서 INSERT 구분이나 UPDATE 구분들이 제대로 동작이 안될때..


예졔

Connection conn = null;

        PreparedStatement pstmt = null;

        StringBuffer sql = new StringBuffer(512);


        try {

            Class.forName("cubrid.jdbc.driver.CUBRIDDriver");

            conn = DriverManager.getConnection("jdbc:CUBRID:localhost:30000:aaaa:::?charset=UTF-8","aaa","aaaaaa");


            sql.append("INSERT INTO AAAAAA\n");

            sql.append(" (A1, \n");

            sql.append("  A2, \n");

            sql.append("  A3, \n");

            sql.append("  A4) \n");

            sql.append("VALUES (?, \n");

            sql.append(" ?, \n");

            sql.append(" ?, \n");

            sql.append(" SYSDATETIME)ㅇㄹ");

      pstmt = conn.prepareStatement(sql.toString());

            pstmt.setString(1, bbb);

            pstmt.setString(2, ccc);

            pstmt.setString(3, ddd);

            pstmt.executeUpdate();

            pstmt.close();


           conn.commit();

            conn.close();

            

        } catch ( SQLException e ) {

            System.err.println(e.getMessage());

        } catch ( Exception e ) {

            System.err.println(e.getMessage());

        } finally {

            if ( conn != null ) conn.close();

        }


강제로 저렇게 오류를 만들어 내봤는데..


큐브리드에서는 그냥 실행이 정상적으로만 되고 실제 데이터를 확인해보면 INSERT는 안됐더라고요.. 그래서 JAVA에서 직접 실행을 하면 오류가 나서 catch 문으로 빠져서

오류를 발생이 되더라고요.. 근데 큐브리드에서 select 프로시져명();  또는 CALL 프로시져명(); 실행을 하면 오류 내용이 전혀 나타나지 않더라고요..


catch 문으로 오류가 난 부분을 보여줄수 있는 방법이 있을가여??

  • ?
    오명환 2017.09.06 16:06
    가장 간단한 방법은 해당 procedure에 string을 return해서 오류 메세지를 전달하거나, "success" 메세지를 넣는 방법입니다.
    예제)
    public static String Phone(String name, String phoneno) throws Exception{
    String sql="INSERT INTO PHONE(NAME, PHONENO)"+ "VALUES (?, ?)";
    try{
    Class.forName("cubrid.jdbc.driver.CUBRIDDriver");
    Connection conn = DriverManager.getConnection("jdbc:default:connection
    :");
    PreparedStatement pstmt = conn.prepareStatement(sql);

    pstmt.setString(1, name);
    pstmt.setString(2, phoneno);
    pstmt.setString(3, "");
    pstmt.executeUpdate();

    pstmt.close();
    conn.commit();
    conn.close();
    } catch (SQLException e) {
    System.err.println(e.getMessage());
    return e.getMessage();
    }

    return "success";
    }
    위 코드는 테이블에 필드가 2개인데, 3개의 값을 넣어서 오류를 만든 코드입니다.

    SP 등록 문장)
    create function put_phone(name varchar, phoneno varchar) return string
    as language java
    name 'PhoneNumber.Phone(java.lang.String, java.lang.String) return java.lang.String';

    call로 함수 호출시 오류)

    csql> call put_phone('xxxx', '01011111111');

    === <Result of CALL Command in Line 1> ===

    Result
    ======================
    'Missing or invalid position of the bind variable provided.'
  • ?
    오명환 2017.09.06 16:13
    cubrid는 jvm 구동시 -Djava.util.logging.conf.file = $CUBRID/java/logging.properties 옵션을 가지고 구동합니다.
    logging.properties를 참조하시면, 기본으로 java.util.logging.filehandler class를 이용해서 logging를 할 수 있게 되어 있습니다.

    java.util.logging.filehandler 또는 java.util.logging.ConsoleHandler 사용방법을 참고하셔서 SP관련 오류 정보를 출력하셔도 됩니다.

  1. CUBRID 사용자를 위한 DBeaver 도구 출시 안내

    Date2024.04.23 Byadmin Views65
    read more
  2. SQLGate for CUBRID 영구 무료 라이선스 제공

    Date2020.04.09 Byadmin Views4465
    read more
  3. 하이버네이트 페이징 처리

    Date2015.02.11 By질주하는구 Views8268
    Read More
  4. 하이버네이트 uniqueResult 함수 사용 문의

    Date2018.05.15 Bykim77p Views461
    Read More
  5. 하나의 쿼리에서 복수 테이블 업데이트 방법 문의

    Date2023.05.17 By도담도담 Views138
    Read More
  6. 하나의 노드에 여러개의 db가 있을때, ha 구성을 안한 db는 사용하지 못하는 문제.

    Date2014.12.09 By깜장매2 Views5713
    Read More
  7. 필드명 대문자로 바꾸는법좀 알려주세요

    Date2015.01.16 By초보개발자임 Views6255
    Read More
  8. 필드 크기 변경 계획에 대한 질문

    Date2012.04.04 By유니콘 Views7447
    Read More
  9. 필드 크기 변경 계획에 대한 질문

    Date2010.07.23 By유니콘 Views9903
    Read More
  10. 필드 추가시 빨랐던 select문 느려지는 이유

    Date2023.02.10 By나라디 Views127
    Read More
  11. 프로시져 호출에러

    Date2013.11.01 Byblast Views8
    Read More
  12. 프로시져 에러 처리 관련해서...

    Date2017.09.04 By펌피 Views1206
    Read More
  13. 프로시저와 함수 관련 질문이 있습니다...

    Date2019.07.11 Bybjosbkjx Views239
    Read More
  14. 프로시저 클래스 등록 관련입니다.

    Date2020.04.16 Bymon Views174
    Read More
  15. 프로시저 질문드립니다.

    Date2020.05.25 Byhiy5978 Views237
    Read More
  16. 프로시저 오류가 무엇때문에 나는지 모르겠습니다.

    Date2017.10.20 By펌피 Views1656
    Read More
  17. 프로시저 사용시

    Date2009.08.03 By경아 Views10095
    Read More
  18. 프로시저 변환 문의

    Date2016.06.15 By천상 Views9786
    Read More
  19. 프로시저 unload 문의

    Date2014.06.19 Bychocob Views6233
    Read More
  20. 프로시저 resultset 문의

    Date2013.05.23 By신데렐라 Views10
    Read More
  21. 프로시저 질문입니다.

    Date2019.02.15 By닐릴리 Views328
    Read More
  22. 프로세스 정상동작 문의 드립니다.

    Date2009.01.23 By윤희서 Views33635
    Read More
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 ... 200 Next
/ 200

Contact Cubrid

대표전화 070-4077-2110 / 기술문의 070-4077-2113 / 영업문의 070-4077-2112 / Email. contact_at_cubrid.com
Contact Sales