Search code examples
node.jssessiondb2session-storagedb2-connect

"MYSCHEMA.sessions" is an undefined name


When I try to connect to SESSIONS table which I created in the appropriate schema, I get this error:

[IBM][CLI Driver][DB2/LINUXX8664] SQL0204N "MYSCHEMA.sessions" is an undefined name. SQLSTATE=42704

I pass the DSN to the session like this:

var session = require("express-session")
  , Db2Store = require('connect-db2')(session);
var options = {
  dsn: 'DATABASE=MyDB;HOSTNAME=IpAddr;PORT=myPort;PROTOCOL=TCPIP;UID=db2_admin;PWD=db2_pwd;CurrentSchema=MYSCHEMA;'
}
var sessionStore = new Db2Store(options);
app.use(session({
  store: sessionStore,
  secret: "AAAAA:ZZZZZ:EEEEE"
}));

Did I miss something here ?


Solution

  • Due to DB2 auto-capitalize issue: https://www.ibm.com/developerworks/data/library/techarticle/0203adamache/0203adamache.html#N1011C, I had to put table name, columns and As clause between quotes when creating sessions table and also inside the module in connect-db2/lib/connect-db2.js file