Background Image

FORUM

조회 수 314 추천 수 0 댓글 1
?

단축키

Prev이전 문서

Next다음 문서

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

* 질문 등록 시 다음의 내용을 꼭 기입하여 주세요.
OS
Linux 64bit (CentOS)
CUBRID Ver.
10.1.1.7691
CUBRID TOOL Ver.

응용 환경(API)
nodejs

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


-------------- 아래에 질문 사항을 기입해 주세요. ------------------------------------------------------------------------

안녕하세요. 


현재 nodejs 를 이용하여 cubrid 에 접속 테스트를 진행하고 있습니다.


접속(커넥션)은 정상적으로 확인되오나, 쿼리 실행시 응답값을 전혀 받지 못하고 있습니다.


아래는 node js 소스 정보이며 


const client = CUBRID.createConnection(dbConf);


client

    .connect()

    .then(() => {

        console.log('connection is established');

        


        const promise = client

            .query("SELECT 100 ")

            .then(response => {

                console.log(response);

            })

            .catch(err => {

                throw err;

            });

        return client.close();

    })

    .catch(err => {

        throw err;

    });


아래는 결과 값 입니다.


connection is established

{ queryHandle: 0, result: undefined }


테이블 조회시에도 동일한 undefined 결과를 받고 있는데요. 

어떠한 이유 때문이지 알 수 있을까요?

이상입니다.
  • ?
    원종민 2020.02.25 10:24
    안녕하세요.

    우선, 결과 먼저 말씀드리면 return client.close(); 반환 값을 connect() Promise가 아닌 query() Promise 안에 넣어주셔야 합니다.

    const client = CUBRID.createConnection(dbConf);

    client
        .connect()
        .then(() => {
            console.log('connection is established');

            const promise = client
                .query("SELECT 100 ")
                .then(response => {

                    console.log(response);
    return client.close();
                })
                .catch(err => {
                    throw err;
                });
        })
        .catch(err => {
            throw err;
        });
    이유는 promise 특성 때문에 발생한 것으로 query promise가 실행되기 전에 client.close()가 실행돼서 연결이 끊겨서 발생한 것입니다.

    간단한 예시로 

    client
       .connect()
       .then(() => {
          console.log('connection is established');
          
          const promise = client
          .query('SELECT 100')
          .then(response => {
          console.log(response);
          
          //return client.closeQuery(response.queryHandle);
          return client.close();
           })
          .catch(err => {
          throw err;
          });
          //return client.close();
          console.log('connection is established2');
        })
        .catch(err => {
          throw err;
        });
    다음과 같이 실행할 경우,
    connection is established
    connection is established2
    { queryHandle: 1,
      result:
       { ColumnDataTypes: [ 'Int' ],
         ColumnNames: [ '100' ],
         ColumnValues: [ [Array] ],
         RowsCount: 1 } }

    값이 출력되는데, connection is established2는 query promise 밑에 있지만 먼저 실행되는 것을 확인 할 수 있습니다.

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

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

    Date2020.04.09 Byadmin Views4458
    read more
  3. An IOException was caught during reading the inputstream. 오류 조치방법 좀 알려주세요.

    Date2019.10.29 Byldev27 Views314
    Read More
  4. 쿼리 실행시 응답이 없습니다.

    Date2020.02.24 Byscvjeong Views314
    Read More
  5. 큐브리드 서버 IP 변경시 바꿔줘야할 설정 있나요 ?

    Date2020.06.02 By하이영 Views313
    Read More
  6. 날짜 사이 데이터 구하기

    Date2021.06.29 Bycubrid초보 Views313
    Read More
  7. 971번 에러 로그가 5초간격으로 쌓임

    Date2020.01.15 Bykidless Views313
    Read More
  8. cubrid manager 데이터 가져오기 응답없음

    Date2020.05.25 Byohgeumjin Views310
    Read More
  9. 백업시 한번 한 백업폴더에 다시 백업시 문제...

    Date2017.11.23 By하일레곤 Views310
    Read More
  10. 오라클 트리거를 옮겨오고싶습니다.

    Date2018.09.28 By지구인다 Views309
    Read More
  11. 큐브리드 ha 구성 중에 master DB가 올라오지 않습니다.

    Date2022.05.12 Bysamsam Views307
    Read More
  12. csql.err 로그에 대해 질문 올립니다.

    Date2018.01.10 Bydosem7 Views307
    Read More
  13. DB복구 질문 드립니다.

    Date2017.11.07 Byhoon Views306
    Read More
  14. 콤마로 split하는 기능 구현 관련 문의

    Date2023.03.15 By플레이어블 Views306
    Read More
  15. cubrid javasp start fail 관련 문의드립니다.

    Date2022.03.14 By범이 Views306
    Read More
  16. 리눅스 서버 1대에 큐브리드를 여러개 설치 방법 문의

    Date2018.02.22 Bycoolkkm Views305
    Read More
  17. delete 시 in절에 컬럼이 두개일경우 느림현상

    Date2021.10.18 By겸둥이k Views304
    Read More
  18. 오라클 마이그레이션 index 명칭 문의 입니다.

    Date2018.10.19 By서훈아빠 Views304
    Read More
  19. 시점 복구 test 문서 연람 방법 문의

    Date2019.07.26 By공중정원 Views303
    Read More
  20. Mac mojave 버전 큐브리드 설치 문제

    Date2019.07.18 Bynorman Views303
    Read More
  21. 큐브리드 파일 내보내기 스케줄 기능 문의

    Date2017.11.23 By쿨쿨 Views303
    Read More
  22. 마이그그레이션 cmt 질문입니다.

    Date2017.07.08 By덴드로비움 Views302
    Read More
Board Pagination Prev 1 ... 141 142 143 144 145 146 147 148 149 150 ... 200 Next
/ 200

Contact Cubrid

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