2016-09-16 66 views
1

我以dashDB作爲後端運行Node.js應用程序。我使用ibm_db節點包作爲連接到dashDB的驅動程序。 Node.js和dashDB部署在IBM Bluemix中。 我沒有使用ibm_db軟件包提供的連接池選項。我們有後臺作業(來自node-cron包的cron作業),它經常查詢dashDB(比如每2分鐘)查詢CRUD操作。前30分鐘,沒有問題。 30-45分鐘後,當我們試圖建立連接時,我們開始低於錯誤。dashdb:連接錯誤SQLSTATE = 08001

只要我們從數據庫中獲得結果,就會打開連接並關閉連接。

這裏是我們用來打開代碼和關閉連接:

var dashDB = require("ibm_db") 
function openConnection(next) { 
    try { 
     dashDB.open(connectionString, function(err, connection) { 
      if (err) return dashDBError('openConnection', err) 
      console.log('DB: openConnection.'.blue) 
      connectionsCount ++ 
      next(connection) 
     }); 
    } catch(err) { 
     console.error('CAUGHT OPEN CONNECTION ERROR') 
     console.log(err) 
     next({ error: err }) 
    } 
} 

//Close dashDB connection 
function closeConnection(connection) { 
    connection.close(function(err) { 
     if (err) return dashDBError('closeConnection', err) 
     connectionsCount -- 
     console.log('DB: closeConnection.'.blue) 
    }) 
} 
//Throw error on exception 
function dashDBError(action, err) { 
    console.error('DB ERROR', action, err.message) 
    console.log('Connections: ', connectionsCount) 
    console.trace("Here I am!") 
    return { error: err } 
} 

這裏是我們得到的錯誤:

**[IBM][CLI Driver] SQL30081N A communication error has been detected. Communication protocol being used: "TCP/IP". Communication API being used: "SOCKETS". 
Location where the error was detected: "169.55.227.101". Communication function detecting the error: "send". Protocol specific error code(s): "32", "*", "0". SQLSTATE=08001 

[IBM][CLI Driver] SQL30081N A communication error has been detected. Communication protocol being used: "TCP/IP". Communication API being used: "SOCKETS". 
Location where the error was detected: "169.55.227.101". Communication function detecting the error: "selectForConnectTimeout". Protocol specific error code(s): "115", "*", "*". SQLSTATE=08001 

Assertion failed: (ret != SQL_INVALID_HANDLE), function GetColumnValue, file ../src/odbc.cpp, line 620. 
Abort trap: 6** 

回答

0

通常SQL30081N錯誤意味着通信錯誤在TCP /客戶端和服務器之間的IP層。檢查以下內容。

  1. 確認您能夠連接到數據庫並從運行node.js應用程序的同一客戶端的dashdb控制檯查詢數據。

查看此技術說明,其中詳細介紹了db2客戶端和服務器連接之間SQL30081n錯誤的各種原因和解決方案。

IBM SQL30081N TCIPIP connection error

如果沒有幫助,請聯繫DB2支持團隊進行進一步的調查。

smurali_IBM

+0

感謝Murali。我正在與Dash DB支持團隊進行覈對。我們得到了錯誤代碼32.支持團隊正在研究這個問題。 –

相關問題