Background Image

FORUM

조회 수 3977 추천 수 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 Views143886
    read more
  2. 10.1 ==> 10.2 버전 업그레이드를 준비 중인데요.

    Date2020.03.26 ByPhilip Park Views3692
    Read More
  3. 파티션 테이블 목록을 조회 할려고 하는데요.

    Date2020.03.25 ByPhilip Park Views4155
    Read More
  4. Cubrid sga, pga 메모리 사이즈 확인 방법 문의 드립니다.

    Date2020.03.25 ByPhilip Park Views4618
    Read More
  5. Cubrid 매니저 Tool 에서 브로커 정보 중 REQ 문의

    Date2020.03.24 By무돌이 Views3843
    Read More
  6. cubrid session timeout 문의 드립니다.

    Date2020.03.23 By한담 Views5049
    Read More
  7. 같은 디비 서버네에 다른 데이터베이스 접근방법은 어떻게 해야하나요?

    Date2020.03.18 By규영킴 Views5026
    Read More
  8. HA 구성 문의 드립니다.

    Date2020.03.10 By유효하지않네 Views5370
    Read More
  9. 서버가 다운되는 이유가 뭘까요?

    Date2020.03.06 By시나브로 Views4273
    Read More
  10. jboss 실행시 db 접속 실패

    Date2020.03.02 By황정환 Views4560
    Read More
  11. linux에서 php pdo driver 설치시 문의

    Date2020.02.27 By개발자nn Views3594
    Read More
  12. cenots7 php7에 cubrid연동 시 에러 질문

    Date2020.02.26 By개발자nn Views5108
    Read More
  13. 쿼리 실행시 응답이 없습니다.

    Date2020.02.24 Byscvjeong Views3977
    Read More
  14. 컬럼명 한글 및 csv 읽어서 연동

    Date2020.02.17 Byintern1910 Views3860
    Read More
  15. cubrid manager 에서 select 조회 시 검색 단위에 대해서 질문있습니다.

    Date2020.02.14 By브로콜리너마저 Views3877
    Read More
  16. unique constraint violations 문의

    Date2020.02.10 Byguloman Views4652
    Read More
  17. 9.3버전에서 10.2버전 업그레이드 방법문의 드립니다.

    Date2020.02.06 By동동 Views3907
    Read More
  18. backupdb 문의드립니다,

    Date2020.02.05 By동동 Views3637
    Read More
  19. asp.net ibatis connection string is null

    Date2020.02.04 Bynoy Views4536
    Read More
  20. 간혈적 에러 '보호된 메모리를 읽거나 쓰려고 했습니다. 확인 부탁드리겠습니다.

    Date2020.02.03 By.net Views3745
    Read More
  21. 메니져 실행이 안됩니다.

    Date2020.02.01 Byufox Views5267
    Read More
Board Pagination Prev 1 ... 53 54 55 56 57 58 59 60 61 62 ... 213 Next
/ 213

Contact Cubrid

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