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. CUBRID 사용자를 위한 DBeaver 도구 출시 안내

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

    Date2020.04.09 Byadmin Views4456
    read more
  3. Cubrid admin 접속 제한 문의드립니다.

    Date2023.07.13 By데굴v Views118
    Read More
  4. 특정단어 삭제

    Date2023.07.13 Byddmmdd Views165
    Read More
  5. error while loading shared libraries: libncurses.so.5 에러 문의 드립니다.

    Date2023.07.10 Bykikiki767 Views1456
    Read More
  6. 다운로드페이지에 CUBRIDManager 11.x windows-x64.exe 는 없는데 .. 다운로드 할 수 있을까요?

    Date2023.07.05 By최라이거 Views274
    Read More
  7. db_class에서 테이블 목록 조회시

    Date2023.07.03 Bycncn Views292
    Read More
  8. 조회쿼리 시간단축

    Date2023.06.30 Byleeee Views98
    Read More
  9. CUBRID 8.4.4 -> 11.0.3 로 업그레이드 시 발생할 문제가 있을까요?

    Date2023.06.29 BySDDC사업개발자 Views89
    Read More
  10. CUBRID to Tibero DBLink지원 가능한지 알고싶습니다.

    Date2023.06.28 By공공기관에서사용중1 Views137
    Read More
  11. ELO타입이 무엇인가요?

    Date2023.06.27 Bysobubble Views116
    Read More
  12. 백업파일 받았는데 복구하는 방법을 모르겠습니다.

    Date2023.06.20 ByGgyak Views185
    Read More
  13. UTF8 한글이 깨짐

    Date2023.06.19 Byyonggi Views271
    Read More
  14. 저장 프로스저에 있는 함수 상세보기 문의입니다.

    Date2023.06.12 By대출인생30년 Views82
    Read More
  15. MERGE INTO 속도 개선 문의

    Date2023.06.12 Byleeee Views129
    Read More
  16. NX_transcation

    Date2023.06.12 Byyoo Views79
    Read More
  17. cubrid cursor.close() 에러 관련질문

    Date2023.06.08 By힘내자화이팅 Views185
    Read More
  18. merge 쿼리 속도개선

    Date2023.06.08 Byleeee Views109
    Read More
  19. 브로커(CAS)수 질문드립니다!

    Date2023.06.05 By요시니 Views152
    Read More
  20. 데이터 이관 문의입니다.

    Date2023.05.30 Bykipo0821 Views129
    Read More
  21. 8.4.4 charset. Collation 확인 방법

    Date2023.05.24 By네오랜덤 Views186
    Read More
  22. 8.4.4버젼 charset 확인

    Date2023.05.23 By네오랜덤 Views190
    Read More
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 11 ... 200 Next
/ 200

Contact Cubrid

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