Open Source RDBMS - Seamless, Scalable, Stable and Free

한국어 | Login |Register

(click on this box to dismiss)

비동기 질문

node.js에서 node-cubrid를 이용 중인데요.

한번에 여러 query()를 보내니, 'Another query is already in progress! - denying current query request.' 라는 메시지가 나옵니다. 아무래도 비동기를 지원하지 않는 것 같은데요.

node.js는 근본이 비동기인데, 쿼리 실행할때마다, 커넥션 새로 맺고 쿼리 실행하고 하면, 잘 버틸 수 있을지 의문이 들구요. 한가지 불편한 것은 비동기 방식으로 작성하다가, cubrid에서만 동기 방식으로 작성해야되니, 여러가지를 고려 안할 수가 없네요. mysql 모듈은 비동기를 잘 지원하던데, cubrid는 비동기 지원이 힘든건가요?

link comment (2)
asked 4 years ago
If I answer to you in English, would you understand? Or do you need an answer in Korean? - [Level:3]Esen Sagynov 4 years ago
whatever is fine. I just need the answer asap. - [Level:1]webjjin 4 years ago
1 Answer

node-cubrid is 100% asynchronous, but I understand why you doubt that it is.

In brief, you can't execute multiple queries in parallel because this is how databases work in order to satisfy ACID property. This is not possible in node-cubrid, nor in node-mysql, nor in any other relational database module.

In order to execute queries in parallel you need to use a connection pool manager such as node-pool or node-pooling and execute parallel queries through multiple database connections. See Common uses of CUBRID Node.js API with examples or Connection Pooling and other Tips for CUBRID Node.js Driver users for details.

Then why node-cubrid is said to be asynchronous? Because it provides event listeners and implements callback system, ie. when you execute any query, it doesn't block your application, and you can continue doing some other stuff while node-cubrid executes a database query. When there is a response from a database, node-cubrid will call the callback function you've passed in or emit an event.

link comment (13)
answered 4 years ago
asked 4 years ago
viewed 2184 times

You are either using a very old browser or a browser that is not supported.
In order to browse you need to have one of the following browsers:

Internet Explorer: Mozilla Firefox: Google Chrome: