1

I am running Node.js application with dashDB as the back end. I a using ibm_db node package as driver for connecting to dashDB. Node.js and dashDB are deployed in IBM Bluemix. I am not using connection pool option provided by ibm_db package. We have background job (cron job from node-cron package) which queries dashDB frequently (say for every 2 minutes) for CRUD operations. For first 30 minutes, there were no issues. After 30-45 minutes, we start getting below error, when ever we try to establish a connection.

We are opening the connection and closing the connection as soon as we get the results from database.

Here is the code we used to open and close connections:

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 }
}

And here are the errors we are getting:

**[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**   
Manglu
  • 10,744
  • 12
  • 44
  • 57

1 Answers1

0

Typically SQL30081N error means a communication error in the tcp/ip layer between the client and server. Check the following.

  1. Verify you are able to connect to the db and query data from the dashdb console from the same client where you are running your node.js application.

Review this tech note which details the various causes and resolution to the SQL30081n error between db2 client and server connection.

IBM SQL30081N TCIPIP connection error

If that does not help please contact db2 support team for further investigation.

smurali_IBM