{"id":19874451,"url":"https://github.com/strongloop/strong-oracle","last_synced_at":"2025-05-02T10:31:10.773Z","repository":{"id":14542736,"uuid":"17257750","full_name":"strongloop/strong-oracle","owner":"strongloop","description":"Deprecated: Node.js Driver for Oracle databases (Use https://github.com/oracle/node-oracledb instead)","archived":false,"fork":false,"pushed_at":"2016-07-14T00:42:07.000Z","size":396,"stargazers_count":45,"open_issues_count":15,"forks_count":18,"subscribers_count":27,"default_branch":"master","last_synced_at":"2025-04-25T04:02:20.142Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/strongloop.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-02-27T17:35:41.000Z","updated_at":"2019-08-13T15:36:33.000Z","dependencies_parsed_at":"2022-08-02T23:00:20.340Z","dependency_job_id":null,"html_url":"https://github.com/strongloop/strong-oracle","commit_stats":null,"previous_names":[],"tags_count":32,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/strongloop%2Fstrong-oracle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/strongloop%2Fstrong-oracle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/strongloop%2Fstrong-oracle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/strongloop%2Fstrong-oracle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/strongloop","download_url":"https://codeload.github.com/strongloop/strong-oracle/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252023236,"owners_count":21682146,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-12T16:23:20.644Z","updated_at":"2025-05-02T10:31:10.472Z","avatar_url":"https://github.com/strongloop.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Install\n\nYou need to download and install [Oracle instant client](http://www.oracle.com/technetwork/database/features/instant-client/index-097480.html) from following links:\n\nhttp://www.oracle.com/technetwork/database/features/instant-client/index-097480.html\n\n1. Instant Client Package - Basic or Basic Lite: All files required to run OCI, OCCI, and JDBC-OCI applications\n2. Instant Client Package - SDK: Additional header files and an example makefile for developing Oracle applications with Instant Client\n\nFor Windows, please make sure 12_1 version is used.\n\n**Please make sure you download the correct packages for your system architecture, such as 64 bit vs 32 bit**\n**Unzip the files 1 and 2 into the same directory, such as /opt/instantclient\\_11\\_2 or c:\\instantclient\\_12\\_1**\n\nOn MacOS or Linux:\n\n1. Set up the following environment variables\n\nMacOS/Linux:\n\n    export OCI_HOME=\u003cdirectory of Oracle instant client\u003e\n    export OCI_LIB_DIR=$OCI_HOME\n    export OCI_INCLUDE_DIR=$OCI_HOME/sdk/include\n\n2. Create the following symbolic links\n\nMacOS:\n\n    cd $OCI_LIB_DIR\n    ln -s libclntsh.dylib.11.1 libclntsh.dylib\n    ln -s libocci.dylib.11.1 libocci.dylib\n\nLinux:\n\n    cd $OCI_LIB_DIR\n    ln -s libclntsh.so.12.1 libclntsh.so\n    ln -s libocci.so.12.1 libocci.so\n\n`libaio` library is required on Linux systems:\n\n* On Unbuntu/Debian\n\n        ﻿sudo apt-get install libaio1\n\n* On Fedora/CentOS/RHEL\n\n        ﻿sudo yum install libaio\n\n3. Configure the dynamic library path\n\nMacOS:\n\n    export DYLD_LIBRARY_PATH=$OCI_LIB_DIR\n\nLinux:\n\nAdd the shared object files to the ld cache:\n\n\t    # Replace /opt/instantclient_11_2/ with wherever you extracted the Basic Lite files to\n\t    echo '/opt/instantclient_11_2/' | sudo tee -a /etc/ld.so.conf.d/oracle_instant_client.conf\n\t    sudo ldconfig\n\nOn Windows, you need to set the environment variables:\n\nIf you have VisualStudio 2012 installed,\n\n    OCI_INCLUDE_DIR=C:\\instantclient_12_1\\sdk\\include\n    OCI_LIB_DIR=C:\\instantclient_12_1\\sdk\\lib\\msvc\\vc11\n    Path=...;c:\\instantclient_12_1\\vc11;c:\\instantclient_12_1\n\n**Please make sure c:\\instantclient_12_1\\vc11 comes before c:\\instantclient_12_1**\n\nIf you have VisualStudio 2010 installed,\n\n    OCI_INCLUDE_DIR=C:\\instantclient_12_1\\sdk\\include\n    OCI_LIB_DIR=C:\\instantclient_12_1\\sdk\\lib\\msvc\\vc10\n    Path=...;c:\\instantclient_12_1\\vc10;c:\\instantclient_12_1\n\n**Please make sure c:\\instantclient_12_1\\vc10 comes before c:\\instantclient_12_1**\n\n4. Optionally configure the OCI version\n\n`strong-oracle` defaults to OCI v12 (v11 on Mac OS X.)  To make it use an older\nor newer version of the OCI libraries, use the following:\n\n    export GYP_DEFINES=\"oci_version=11\"\n\nOn Windows:\n\n    GYP_DEFINES=\"oci_version=11\"\n\n# Examples\n\nThe simplest way to connect to the database uses the following code:\n\n```javascript\nvar settings = {};\nvar oracle = require(\"strong-oracle\")(settings);\n\nvar connectData = { \"hostname\": \"localhost\", \"user\": \"test\", \"password\": \"test\", \"database\": \"ORCL\" };\n\noracle.connect(connectData, function(err, connection) {\n    ...\n    connection.close(); // call this when you are done with the connection\n  });\n});\n```\nThe `database` parameter contains the \"service name\" or \"SID\" of the database. If you have an Oracle RAC or some other kind of setup, or if you prefer to use \"TNS\", you can do so as well. You can either provide a complete connection string, like:\n\n```javascript\nvar connString = \n      \"(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)))\";\n```\n\nor just the shortcut as declared in your `tnsnames.ora`:\n\n    DEV =\n      (DESCRIPTION =\n        (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))\n        (CONNECT_DATA =\n          (SERVER = DEDICATED)\n          (SERVICE_NAME = orcl)\n        )\n      )\n\nThe connection parameter would then be:\n\n```javascript\nvar connectData = { \"tns\": \"DEV\", \"user\": \"test\", \"password\": \"test\" };\n// or: var connectData = { \"tns\": connString, \"user\": \"test\", \"password\": \"test\" };\n```\n\nTo access a table you could then use:\n\n```javascript\noracle.connect(connData, function(err, connection) {\n\nor just the shortcut as declared in your `tnsnames.ora`:\n\n  // selecting rows\n  connection.execute(\"SELECT * FROM person\", [], function(err, results) {\n    if ( err ) {\n      console.log(err);\n    } else {\n      console.log(results);\n\n      // inserting with return value\n      connection.execute(\n        \"INSERT INTO person (name) VALUES (:1) RETURNING id INTO :2\",\n        ['joe ferner', new oracle.OutParam()],\n        function(err, results) {\n          if ( err ) { console.log(err) } else {\n            console.log(results);\n          }\n          // results.updateCount = 1\n          // results.returnParam = the id of the person just inserted\n          connection.close(); // call this when you are done with the connection\n        }\n      );\n    }\n  \n  });\n});\n```\n\nTo validate whether the connection is still established after some time:\n\n```javascript\nif (! connection.isConnected()) {\n  // retire this connection from a pool\n}\n```\n\n\n## Out Params\n\nThe following Out Params are supported in Stored Procedures:\n\n```\n\nOCCIINT\nOCCISTRING\nOCCIDOUBLE\nOCCIFLOAT\nOCCICURSOR\nOCCICLOB\nOCCIDATE\nOCCITIMESTAMP\nOCCINUMBER\nOCCIBLOB\n\n```\n\nAnd can be used as follows:\n\n```\n\nconnection.execute(\"call myProc(:1,:2)\", [\"nodejs\", new oracle.OutParam(oracle.OCCISTRING)], function(err, results){\n  console.dir(results);\n};\n\n```\n\nWhen using Strings as Out Params, the size can be optionally specified as follows:\n\n```\n\nconnection.execute(\"call myProc(:1,:2)\", [\"nodejs\", new oracle.OutParam(oracle.OCCISTRING, {size: 1000})], function(err, results){\n\n```\n\nIf no size is specified, a default size of 200 chars is used.\n\nSee tests for more examples.\n\n## In/Out Params\n\nThe following INOUT param types are supported:\n\n```\n\nOCCIINT\nOCCISTRING\nOCCIDOUBLE\nOCCIFLOAT\nOCCINUMBER\n\n```\n\nINOUT params are used like normal OUT prams, with the optional 'in' paramater value being passed in the options object:\n\n```\n\nconnection.execute(\"call myProc(:1)\", [new oracle.OutParam(oracle.OCCIINT, {in: 42})], function(err, results){\n  console.dir(results);\n};\n\n```\n\n\n## Connection options\n\nThe following options can be set on the connection:\n\n```\nconnection.setAutoCommit(true/false);\nconnection.setPrefetchRowCount(count);\n```\n\n# Develop\n\n## Install Oracle/Oracle Express\n\n * Download [Oracle Express 10g](http://www.oracle.com/technetwork/database/express-edition/database10gxe-459378.html)\n * Download [Instant Client](http://www.oracle.com/technetwork/database/features/instant-client/index-097480.html)\n  * Instant Client Package - Basic Lite\n  * Instant Client Package - SQL*Plus\n  * Instant Client Package - SDK\n * Install Oracle Express (Ubuntu)\n\n```bash\nsudo dpkg -i oracle-xe_11.2.0.3.0-1.0_i386.deb\nsudo apt-get install alien\nsudo alien oracle-instantclient11.2-*\nsudo dpkg -i oracle-instantclient11.2-*.deb\nsudo /etc/init.d/oracle-xe configure\n```\n\n * Open http://localhost:9999/apex/ change 9999 to the port you configured. Log-in with \"sys\" and the password.\n * Create a user called \"test\" with password \"test\" and give all accesses.\n\n```bash\nsudo vi /etc/ld.so.conf.d/oracle.conf -- add this line /usr/lib/oracle/11.2/client/lib/\nsudo ldconfig\n\nexport ORACLE_SID=test\nexport ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/11.2/server\nexport OCI_INCLUDE_DIR=/usr/include/oracle/11.2/client/\nexport OCI_LIB_DIR=/usr/lib/oracle/11.2/client/lib/\nsqlplus test@XE\n```\n\n## Build\n\n```bash\nnpm install\nnpm test\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstrongloop%2Fstrong-oracle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstrongloop%2Fstrong-oracle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstrongloop%2Fstrong-oracle/lists"}