Skip to content

Instantly share code, notes, and snippets.

View cjbj's full-sized avatar

Christopher Jones cjbj

View GitHub Profile
@cjbj
cjbj / parallelselect.py
Last active February 14, 2023 23:02
A sample Python program that reads from an Oracle Database table in parallel threads
# parallelselect.py
#
# [email protected], Feb 2023
#
# This may or may not be faster than a single thread statement that
# reads the whole table.
#
import csv
import os
import getpass
import os
import traceback
import oracledb
un = ''
cs = ''
pw = getpass.getpass(f'Enter password for {un}: ')
try:
@cjbj
cjbj / dbora
Last active March 9, 2022 02:11
#! /bin/sh -x
#
# This is my old script for auto-starting Oracle DB on Linux.
# When I'm not using Cloud Databases, I now install the Oracle Database 21c RPM which includes its own script
#
# chkconfig: 2345 80 05
# description: start and stop Oracle Databases
#
# OL7: systemctl enable dbora
@cjbj
cjbj / issue1391.patch
Created July 21, 2021 23:42
Patch for node-oracledb 5.2 issue #1391
diff --git a/lib/queryStream.js b/lib/queryStream.js
index 08ddc72..09efc99 100644
--- a/lib/queryStream.js
+++ b/lib/queryStream.js
@@ -89,11 +89,6 @@ class QueryStream extends Readable {
this._fetching = true;
this._resultSet._allowGetRowCall = true;
const row = await this._resultSet.getRow();
- this._fetching = false;
- if (!this._resultSet) {
const oracledb = require('oracledb');
const dbConfig = require('./dbconfig.js');
if (process.platform === 'darwin') {
oracledb.initOracleClient({libDir: process.env.HOME + '/Downloads/instantclient_19_8'});
}
let result;
async function run() {
cjones@localhost:~/go/src/github.com/godror/godror$ echo $(git log --pretty=format:'%h ' -n 1)
ac04606
cjones@localhost:~/go/src/github.com/godror/godror$ go test ./dsn
--- FAIL: TestParse (0.00s)
--- FAIL: TestParse/logfmt (0.00s)
dsn_test.go:213: user=user password=pass connectString=localhost/sid heterogeneousPool=1
dsn_test.go:220: parse of "user=user password=pass connectString=localhost/sid heterogeneousPool=1"
got
dsn.ConnectionParams{CommonParams:dsn.CommonParams{Username:"user", ConnectString:"", Password:dsn.Password{secret:"pass"}, ConfigDir:"", LibDir:"", OnInit:(func(driver.Conn) error)(nil), OnInitStmts:[]string(nil), AlterSession:[][2]string(nil), Timezone:(*time.Location)(0x732ce0), EnableEvents:false}, ConnParams:dsn.ConnParams{NewPassword:dsn.Password{secret:""}, ConnClass:"", IsSysDBA:false, IsSysOper:false, IsSysASM:false, IsPrelim:false, ShardingKey:[]interface {}(nil), SuperShardingKey:[]interface {}(nil)}, PoolParams:dsn.PoolParams{MinSession
const http = require('http');
const oracledb = require('oracledb');
const dbConfig = require('./dbconfig.js');
const httpPort = 7000;
async function init() {
try {
await oracledb.createPool(dbConfig);
@cjbj
cjbj / Makefile
Created March 19, 2020 00:56
go-oci8 issue 379
#IC=$(HOME)/instantclient_18_5
IC=$(HOME)/instantclient_19_6
OLIB=$(IC)
OINC=$(IC)/sdk/include
#OH=/u01/app/oracle/product/12.1.0/dbhome_1
#OLIB=$(OH)/lib
#OINC=$(OH)/rdbms/public
oracle_break: clean
'use strict';
process.env.UV_THREADPOOL_SIZE = 5;
const myPoolSize = 5; // poolMin & poolMax;
const numStmts = 5; // number of statements to run in parallel
console.log('UV_THREADPOOL_SIZE :', process.env.UV_THREADPOOL_SIZE );
console.log('poolMin & poolMax :', myPoolSize);
console.log('number of selects to run :', numStmts);
'use strict';
process.env.ORA_SDTZ = 'UTC';
const oracledb = require('oracledb');
let config;
try {
config = require('./dbconfig.js');
} catch (err) {
if (err.code === 'MODULE_NOT_FOUND')