oracle / node-oracledb

Oracle Database driver for Node.js maintained by Oracle Corp.
http://oracle.github.io/node-oracledb/
Other
2.25k stars 1.07k forks source link

Getting error "ORA-12638: Credential retrieval failed" in windows #1505

Closed bhandaribhumin closed 2 years ago

bhandaribhumin commented 2 years ago

Hi Team, I was using this node since 6 month on MacOS everything works expectedly but when i was setup same project on windows system I'm not able to run the project.

  1. What versions are you using?

    "oracledb": "^5.4.0", Node version: v16.15.0

  2. Is it an error or a hang or a crash?

  3. error

    
    createPool error [Error: ORA-12638: Credential retrieval failed] {
    errorNum: 12638,
    offset: 0
    }
4. What error(s) or behavior you are seeing?
Every time when i try to call API console shows like :

Error: NJS-047: poolAlias "default" not found in the connection pool cache at OracleDb.getConnection (E:\GitHub\veera\veera-api\node_modules\oracledb\lib\oracledb.js:267:13) at OracleDb. (E:\GitHub\veera\veera-api\node_modules\oracledb\lib\util.js:178:19) at Object.simpleExecute (E:\GitHub\veera\veera-api\src\services\database.js:70:27) at Object.select (E:\GitHub\veera\veera-api\src\db_apis\version.js:9:33) at getVersions (E:\GitHub\veera\veera-api\src\controllers\version.js:8:34) at Layer.handle [as handle_request] (E:\GitHub\veera\veera-api\node_modules\express\lib\router\layer.js:95:5) at next (E:\GitHub\veera\veera-api\node_modules\express\lib\router\route.js:144:13) at Route.dispatch (E:\GitHub\veera\veera-api\node_modules\express\lib\router\route.js:114:3) at Layer.handle [as handle_request] (E:\GitHub\veera\veera-api\node_modules\express\lib\router\layer.js:95:5) at E:\GitHub\veera\veera-api\node_modules\express\lib\router\index.js:284:15


5. Include a runnable Node.js script that shows the problem.

Code : 

const oracledb = require('oracledb'); const dbConfig = require('../config/database.js');

// Tell node-oracledb where to find the Oracle Instant Client 'Basic' package on macOS and Windows if (process.platform === 'darwin') { console.log('process.env.HOM', process.env.HOME); oracledb.initOracleClient({ libDir: process.env.HOME + '/instantclient_19_8' }); } else if (process.platform === 'win32') { // oracledb.initOracleClient({ libDir: 'C:\oracleDB\instantclient_21_3' }); // note the double backslashes oracledb.initOracleClient({ libDir: 'C:\oracle\instantclient_21_6' }); } // else you must set the system library search path before starting Node.js

async function initialize() { const DEFAULT_POOL_STRING = dbConfig.hrPool; await getOracleConnection(dbConfig.hrPool).then((resolve)=>{ console.log('resolve',resolve); }).catch((error)=>{ console.log('Error',error); }) }

const getOracleConnection = (DB_POOL_STRING) => { return new Promise(async (resolve, reject) => { const returnValues = { "DB_POOL": {}, "STATUS": '' }; console.log(Pool String); console.log(DB_POOL_STRING); await oracledb.createPool(DB_POOL_STRING).then((res) => { returnValues.DB_POOL = dbConfig.hrPool; returnValues.STATUS = "SUCCESS"; console.log('createPool returnValues', returnValues); resolve(returnValues); }).catch(async (error) => { console.log('createPool error', error); await getOracleConnection(dbConfig.hrPoolBK); reject(error); }); }); }



Pool String
{
  user: 'user',
  password: 'password',
  connectString: '(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(COMMUNITY=tcp.world)(PROTOCOL=TCP)(Host=10000.00.004)(Port=0000))(ADDRESS=(COMMUNITY=tcp.world)(PROTOCOL=TCP)(Host=111.113.000.000)(Port=0000)))(CONNECT_DATA=(SID = ORCL)))',
  poolMin: 10,
  poolMax: 10,
  poolIncrement: 0,
  poolTimeout: 100000
}

Note: 
`I noticed the application work successfully when i was used "oracledb": "^5.3.0",`
cjbj commented 2 years ago

@bhandaribhumin This is interesting. Can you confirm that last comment? Can you check with both Instant Client 21.3 and 21.6? Also make sure you don't have some conflict with differing versions in PATH and in the initOracleClient() call.

cjbj commented 2 years ago

@bhandaribhumin I asked around about this error. It's related to Kerberos. If you have kerberos5 in the authentication_services parameter of your sqlnet.ora, trying removing that. If not, can you make sure you do a clean comparison between versions of Instant Client and also node-oracledb, and let us know?

cjbj commented 2 years ago

Closing - no update. Also there's no indication this is a node-oracledb driver problem.