Background Image

FORUM

조회 수 313 추천 수 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. No Image notice by admin 2024/04/23 by admin
    Views 49 

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

  2. SQLGate for CUBRID 영구 무료 라이선스 제공

  3. 오라클에서 max() keep의 기능은 어떻게 변경해야할까요

  4. 8.4.4ver 큐브리드 JDBC Driver Connection 인터페이스 미구현 문제2

  5. Windows Server 설치된 큐브리드 10.1.1.7691 의 loadjava.exe 실행 시 액세스가 거부되었습니다. 라는 메시지가 나오는 현상

  6. Mac OS 큐브리드 매니저 설치 문제

  7. csql -c 옵션 질문입니다.

  8. 큐브리드 설치 오류

  9. Internal system failure

  10. varchar 타입 컬럼을 숫자형식으로 정렬하는 방법 문의

  11. loaddb로 백업시 clob 타입 사용시 문의

  12. HA 구성 문의 드립니다.

  13. cubrid manager 접속 질문이요!!!!!!!!

  14. 큐브리드 포트포워딩 문의

  15. WHERE절에 REGEXP_REPLACE를 넣고 실행하면 다운됩니다.

  16. CUBRID/conf/cubrid_broker.conf 파일에 auto_commit 설정이 없으면 추가해야 하나요?

  17. 시스템 테이블 db_serial 에 추가 질문입니다.

  18. 큐브리드 백업시 다음과 같은 오류가 납니다

  19. 큐브리드 매니저 가져오기 기능 오류

  20. 일반사용자 시스템 테이블 접근 권한 제어관련 질문드립니다.

  21. Docker Image 배포 문의

  22. An IOException was caught during reading the inputstream. 오류 조치방법 좀 알려주세요.

Board Pagination Prev 1 ... 140 141 142 143 144 145 146 147 148 149 ... 200 Next
/ 200

Contact Cubrid

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