CodexBloom - Programming Q&A Platform

OCI Autonomous Database: Facing SQL Error ORA-01031 When Executing PL/SQL Procedure from Node.js

👀 Views: 65 đŸ’Ŧ Answers: 1 📅 Created: 2025-06-12
oracle node.js oci plsql database JavaScript

I'm building a feature where After trying multiple solutions online, I still can't figure this out. I can't seem to get I'm trying to execute a PL/SQL procedure from a Node.js application that connects to an Oracle Autonomous Database (version 19c). The procedure requires certain roles and privileges that I believe the user has, but I keep encountering the error `ORA-01031: insufficient privileges` when I call it. Here's the relevant code snippet for the database connection and procedure execution: ```javascript const oracledb = require('oracledb'); async function executeProcedure() { let connection; try { connection = await oracledb.getConnection({ user: 'my_user', password: 'my_password', connectString: 'my_database_high' // Connection string for the Autonomous DB }); const result = await connection.execute(`CALL my_schema.my_procedure(:param1, :param2)`, { param1: { dir: oracledb.BIND_IN, val: 'value1' }, param2: { dir: oracledb.BIND_IN, val: 'value2' } }); console.log('Procedure executed successfully:', result); } catch (err) { console.error('Error executing procedure:', err.message); } finally { if (connection) { try { await connection.close(); } catch (err) { console.error('Error closing connection:', err.message); } } } } executeProcedure(); ``` I have confirmed that the user has been granted the necessary roles to execute this procedure. I even used the SQL Developer to connect with the same credentials and was able to execute the procedure without any issues. Additionally, I checked for any grants on the procedure and verified that all required roles are present. As a potential workaround, I tried wrapping the procedure call in an `EXECUTE IMMEDIATE` statement, but it still resulted in the same `ORA-01031` error. Is there something specific I might be missing regarding the Node.js driver or the privileges required for executing PL/SQL procedures? Any insights would be greatly appreciated! I'm working on a REST API that needs to handle this. Cheers for any assistance! This is part of a larger CLI tool I'm building. Any ideas what could be causing this?