oracle / node-oracledb

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

Node-oracledb 6.0 with a 'Thin' mode has been released! #1552

Open sharadraju opened 1 year ago

sharadraju commented 1 year ago

Hello All, the node-oracledb 6.0.0 release is out!

This version of node-oracledb is now a ‘Thin’ mode driver by default. The Thin mode is implemented purely in JavaScript and connects directly to Oracle Database. It removes the need to download Oracle client libraries to connect to Oracle Database.

You can also enable a ‘Thick’ mode that will allow the optional use of Oracle client libraries with some additional functionality. This mode will include all the features of the previous node-oracledb release, along with the other enhancements.

Check out our release blog for all the deets: https://medium.com/@sharad-chandran/usher-in-a-new-era-with-the-node-oracledb-6-0-pure-javascript-thin-driver-e10e2af693b2

kuanysh-baltagarayev commented 1 year ago

good day! i can't connect to oracle db. error is "NJS-138: connections to this database server version are not supported by node-oracledb in Thin mode". my dep version is ""oracledb": "^6.0.1","

sharadraju commented 1 year ago

@kuanysh-baltagarayev What is your Oracle Database version?

kuanysh-baltagarayev commented 1 year ago

Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

sharadraju commented 1 year ago

@kuanysh-baltagarayev node-oracledb 6.0 Thin mode supports Oracle Database Release 12.1 and later. Please see the following documentation: https://node-oracledb.readthedocs.io/en/latest/user_guide/appendix_a.html#id1 for the supported releases.

Node-oracledb 6.0 is a 'Thin mode' driver by default. You can switch to Thick mode for Oracle Database 11g support or upgrade your database version

kuanysh-baltagarayev commented 1 year ago

thank you!!!

Fariededuction commented 1 year ago

how about oracle 10g sir?

sharadraju commented 1 year ago

@Fariededuction Oracle Database 10g can be used with node-oracledb 6.0 Thick mode and the right Oracle Client Libraries. Thin mode does not support Oracle Database 10g.

Fariededuction commented 1 year ago

wow its really work sir, thank you!!

nilaytupelolife commented 8 months ago

Hello @sharadraju I want to connect to Oracle database in Thin mode. But in typeorm i am not aware how can i do this. Can you please guide me for that.

Thanks in advance.

sharadraju commented 8 months ago

@nilaytupelolife There was a bug related to the running of typeorm tests with node-oracledb 6.0, which was fixed in 6.1. You might want to follow the TypeORM PR for making the Thin mode default for node-oracledb in TypeORM here: https://github.com/typeorm/typeorm/pull/10285 Please let me know if you have connected to Oracle Database with node-oracledb earlier versions with typeorm. There should not be any change to those settings.

nilaytupelolife commented 8 months ago

@sharadraju Thank youfor you reply. I figure out and it is working fine. But when i do npm install it is not working i need to do -force to install packages. I am facing following error npm ERR! While resolving: typeorm@0.3.17 npm ERR! Found: oracledb@6.2.0 npm ERR! node_modules/oracledb npm ERR! oracledb@"^6.1.0" from the root project npm ERR! npm ERR! Could not resolve dependency: npm ERR! peerOptional oracledb@"^5.1.0" from typeorm@0.3.17 npm ERR! node_modules/typeorm npm ERR! typeorm@"^0.3.17" from the root project npm ERR! peer typeorm@"^0.3.0" from @nestjs/typeorm@10.0.0 npm ERR! node_modules/@nestjs/typeorm npm ERR! @nestjs/typeorm@"^10.0.0" from the root project npm ERR! npm ERR! Conflicting peer dependency: oracledb@5.5.0 npm ERR! node_modules/oracledb npm ERR! peerOptional oracledb@"^5.1.0" from typeorm@0.3.17 npm ERR! node_modules/typeorm npm ERR! typeorm@"^0.3.17" from the root project npm ERR! peer typeorm@"^0.3.0" from @nestjs/typeorm@10.0.0 npm ERR! node_modules/@nestjs/typeorm npm ERR! @nestjs/typeorm@"^10.0.0" from the root project

Can you please guide me on this>

sharadraju commented 8 months ago

@nilaytupelolife The latest version of node-oracledb is 6.2, which was released last week. Your package.json file must have node-oracledb 6.1 as the dependency. Change the node-oracledb version in your package.json file to ^6.2

nilaytupelolife commented 8 months ago

@sharadraju I did that. But now i feel, issue is because typeorm has 5.1.4 set in their peer dependencies thats why it is giving error. Can you help in that as well?

sharadraju commented 8 months ago

@nilaytupelolife You might want to follow the TypeORM PR: https://github.com/typeorm/typeorm/pull/10285 Here they are updating the version of node-oracledb to 6.1 in the peer dependencies. You can comment there and request them to approve the merge of the PR.

nilaytupelolife commented 8 months ago

@sharadraju Thank you very much for your support. will check it in typeorm repository.

nilaytupelolife commented 8 months ago

@sharadraju I am facing listner issue when i try to connect oracle cloud db using Oracle db 6.2.0. Can you please help? I am using wallet approch earlier with 5.5.0.

sharadraju commented 8 months ago

@nilaytupelolife Can you send the exact error that you are facing? The Wallet connect string details have changed with Oracle Cloud Database. So you may have to re-download your wallet and try again. Are you using mTLS or 1-way TLS?

nilaytupelolife commented 8 months ago

I am usign mTLS. Error is something like this NJS-521: connection to host *** port **** is refused

sharadraju commented 8 months ago

@nilaytupelolife In Thin mode, you have to specify the walletPassword as a separate attribute in the dbConfig object as well. Something like the following:

const oracledb = require('oracledb');

async function runApp() {

  let connection;
  let dbConfig = {
    user: process.env.NODE_ORACLEDB_USER,
    password: process.env.NODE_ORACLEDB_PASSWORD,
    connectString: process.env.NODE_DB_CONNECT_STRING,
    walletLocation: process.env.TNS_ADMIN,
    walletPassword: process.env.WALLET_PASSWORD,
    configDir: process.env.TNS_ADMIN,
    sslServerDNMatch: true,
    //httpsProxy: process.env.PROXY_HOST,
    //httpsProxyPort: process.env.PROXY_PORT,
  };
console.log(dbConfig);

  try {
    // Get a standalone Oracle Database connection
    //oracledb.initOracleClient();
    connection = await oracledb.getConnection(dbConfig);
    console.log('Connection was successful!');

This is documented here

karkan20 commented 1 month ago

I am trying g to upgrade the version from 5.5.0 to 6.0.0 or 6.5.1 major version. I get an error while creating pool - NJS-516 no configuration directory set or available to search for tnsnames.ora. Not sure what's missing as it was working fine in 5.5.0.

cjbj commented 1 month ago

@karkan20 please open new issues for new problems. But before doing that that, review this: https://node-oracledb.readthedocs.io/en/latest/user_guide/initialization.html#using-optional-oracle-configuration-files and note the differences between Thin mode (the new default) and Thick mode (the equivalent of what you had in 5.5)