Repository: oracle/node-oracledb

Issue #1554: Scandic characters in bind variables cause error ORA-01460
Created: 2023-05-25T14:11:29Z
What versions are you using?
oracle version 19c
process.platform
darwin
process.version
v18.16.0
process.arch
arm64
require('oracledb').versionString
6.0.0


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


What error(s) or behavior you are seeing?


Error: ORA-01460: unimplemented or unreasonable conversion requested

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

const oracledb = require('oracledb')
const dbConfig = {
  user: process.env.NODE_ORACLEDB_USER,
  password: process.env.NODE_ORACLEDB_PASSWORD,
  connectString: process.env.NODE_ORACLEDB_CONNECTIONSTRING,
}

async function run() {
  let connection

  try {
    let sql, binds, options, result

    connection = await oracledb.getConnection(dbConfig)

    const stmts = [
      `DROP TABLE no_example`,

      `CREATE TABLE no_example (id NUMBER, data VARCHAR2(20))`,
    ]

    for (const s of stmts) {
      try {
        await connection.execute(s)
      } catch (e) {
        if (e.errorNum != 942) console.error(e)
      }
    }

    sql = `INSERT INTO no_example VALUES (:1, :2)`

    binds = [
      [101, 'Alpha'],
      [102, 'Beta'],
      [103, 'Gamma'],
    ]

    // For a complete list of options see the documentation.
    options = {
      autoCommit: true,
      // batchErrors: true,  // continue processing even if there are data errors
      bindDefs: [
        { type: oracledb.NUMBER },
        { type: oracledb.STRING, maxSize: 20 },
      ],
    }

    result = await connection.executeMany(sql, binds, options)

    console.log('Number of rows inserted:', result.rowsAffected)

    //
    // Query the data
    //

    sql = `SELECT * FROM no_example WHERE data=:variable`

    binds = { variable: 'ä' }

    // For a complete list of options see the documentation.
    options = {
      outFormat: oracledb.OUT_FORMAT_OBJECT, // query result format
      // extendedMetaData: true,               // get extra metadata
      // fetchArraySize:   100                 // internal buffer allocation size for tuning
    }

    result = await connection.execute(sql, binds, options)

    // Column metadata can be shown, if desired
    // console.log("Metadata: ");
    // console.dir(result.metaData, { depth: null });

    console.log('Query results: ')
    console.dir(result.rows, { depth: null })
  } catch (err) {
    console.error(err)
  } finally {
    if (connection) {
      try {
        await connection.close()
      } catch (err) {
        console.error(err)
      }
    }
  }
}

run()


Run with command NODE_ORACLEDB_USER=SYSTEM NODE_ORACLEDB_PASSWORD=oracle NODE_ORACLEDB_CONNECTIONSTRING=local.oracle.com:1521/xe node test.js
If I change this row binds = { variable: 'ä' } to binds = { variable: 'a' }, then it works without a problem
This problem didn't exist in version 5.5.0.

Duplicate issue #1555: Bug with cyrillic symbols in bind params on oracledb 6.0.0 (DPI-1019)
Created: 2023-05-25T14:37:10Z
Versions:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
DbCharset: CL8MSWIN1251
oracledb 6.0.0
win32 (Windows 10 x64)
nodejs v18.16.0
oracle instant client 21.10.0.0.0
Hello!
After upgrading to oracle db 6.0.0, queries stopped being executed, to which strings containing Cyrillic characters are binded. Everything works on oracledb version 5.5.0.
If I search by English characters, everything works without problems on both versions.
When executing code on oracledb version 6.0.0, I get an error:
Error: DPI-1019: buffer size of 8 is too small                                                                                                                                    
    at async sql (file:///C:/.../tt.js:27:16) {                                                                                                         
  errorNum: 0,                                                                                                                                                                    
  offset: 0,                                                                                                                                                                      
  code: 'DPI-1019'                                                                                                                                                                
}

Script code below:
import oracledb from "oracledb";

let oracleClient;

oracledb.outFormat = oracledb.OUT_FORMAT_OBJECT;
oracledb.fetchAsString = [oracledb.CLOB];

try {
	oracledb.initOracleClient({
	 libDir: "c:/instantclient_21_10"
	});
} catch {

}

sql();


async function sql() {
	oracleClient = await oracledb.getConnection({
		user          : "***",
		password      : "***",
		connectString : "***.local:1521/ORCL"
	});

	try {
		let websql = await oracleClient.execute(`select * from missiontype where f_missiontype_name = :nn`, {
			nn: {
				dir: oracledb.BIND_IN,
				type: oracledb.DB_TYPE_VARCHAR,
				val: "Сбор ВГХ"
			},
		});

		console.log(websql.rows);
	} catch (err) {
		console.error(err);
	}

	await oracleClient.close();
}
Table MISSIONTYPE:



ID
NAME




1
Сбор ВГХ


2
Установка оборудования



Name                  Type          Nullable Default Comments                        
--------------------- ------------- -------- ------- ------------------------------- 
ID                    INTEGER                           
NAME                  VARCHAR2(255)           

Can you tell me how to solve this problem?

Closing comment (2023-05-25T15:24:36Z): This is a duplicate of #1554 so will close this one. You can see the patch there which should resolve the issue for you. It will be included in the next release of node-oracledb!