oracledb 6.1.0 → 6.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/README.md +2 -2
  2. package/build/Release/oracledb-6.3.0-darwin-x64.node +0 -0
  3. package/build/Release/oracledb-6.3.0-darwin-x64.node-buildinfo.txt +1 -0
  4. package/build/Release/oracledb-6.3.0-js-buildinfo.txt +1 -0
  5. package/build/Release/oracledb-6.3.0-linux-arm64.node +0 -0
  6. package/build/Release/oracledb-6.3.0-linux-arm64.node-buildinfo.txt +1 -0
  7. package/build/Release/oracledb-6.3.0-linux-x64.node +0 -0
  8. package/build/Release/oracledb-6.3.0-linux-x64.node-buildinfo.txt +1 -0
  9. package/build/Release/oracledb-6.3.0-win32-x64.node +0 -0
  10. package/build/Release/oracledb-6.3.0-win32-x64.node-buildinfo.txt +1 -0
  11. package/examples/README.md +26 -8
  12. package/examples/dbconfig.js +57 -40
  13. package/examples/example.js +6 -4
  14. package/lib/connection.js +67 -1
  15. package/lib/dbObject.js +9 -0
  16. package/lib/errors.js +25 -7
  17. package/lib/future.js +53 -0
  18. package/lib/impl/connection.js +56 -0
  19. package/lib/impl/pool.js +5 -3
  20. package/lib/impl/resultset.js +48 -11
  21. package/lib/oracledb.js +34 -14
  22. package/lib/pool.js +10 -0
  23. package/lib/sodaCollection.js +11 -0
  24. package/lib/sodaOperation.js +16 -0
  25. package/lib/thin/connection.js +184 -155
  26. package/lib/thin/dbObject.js +49 -2
  27. package/lib/thin/index.js +1 -1
  28. package/lib/thin/pool.js +3 -2
  29. package/lib/thin/protocol/buffer.js +79 -70
  30. package/lib/thin/protocol/capabilities.js +3 -1
  31. package/lib/thin/protocol/constants.js +31 -14
  32. package/lib/thin/protocol/messages/auth.js +6 -2
  33. package/lib/thin/protocol/messages/base.js +36 -14
  34. package/lib/thin/protocol/messages/dataType.js +8 -5
  35. package/lib/thin/protocol/messages/lobOp.js +7 -8
  36. package/lib/thin/protocol/messages/withData.js +62 -22
  37. package/lib/thin/protocol/oson.js +13 -10
  38. package/lib/thin/protocol/packet.js +6 -5
  39. package/lib/thin/protocol/utils.js +2 -2
  40. package/lib/thin/sqlnet/connStrategy.js +8 -4
  41. package/lib/thin/sqlnet/constants.js +138 -138
  42. package/lib/thin/sqlnet/ezConnectResolver.js +10 -43
  43. package/lib/thin/sqlnet/navNodes.js +7 -7
  44. package/lib/thin/sqlnet/networkSession.js +22 -21
  45. package/lib/thin/sqlnet/ntTcp.js +7 -7
  46. package/lib/thin/sqlnet/packet.js +1 -1
  47. package/lib/thin/statement.js +345 -113
  48. package/lib/thin/util.js +35 -86
  49. package/lib/types.js +6 -1
  50. package/lib/util.js +12 -0
  51. package/lib/version.js +1 -1
  52. package/package.json +1 -1
  53. package/build/Release/oracledb-6.1.0-darwin-x64.node +0 -0
  54. package/build/Release/oracledb-6.1.0-darwin-x64.node-buildinfo.txt +0 -1
  55. package/build/Release/oracledb-6.1.0-js-buildinfo.txt +0 -1
  56. package/build/Release/oracledb-6.1.0-linux-arm64.node +0 -0
  57. package/build/Release/oracledb-6.1.0-linux-arm64.node-buildinfo.txt +0 -1
  58. package/build/Release/oracledb-6.1.0-linux-x64.node +0 -0
  59. package/build/Release/oracledb-6.1.0-linux-x64.node-buildinfo.txt +0 -1
  60. package/build/Release/oracledb-6.1.0-win32-x64.node +0 -0
  61. package/build/Release/oracledb-6.1.0-win32-x64.node-buildinfo.txt +0 -1
@@ -27,175 +27,175 @@
27
27
 
28
28
  module.exports = {
29
29
  // TNS packet types
30
- NSPTCN : 1, // Connect
31
- NSPTAC : 2, // Accept
32
- NSPTAK : 3, // Acknowledge
33
- NSPTRF : 4, // Refuse
34
- NSPTRD : 5, // Redirect
35
- NSPTDA : 6, // Data
36
- NSPTNL : 7, // Null
37
- NSPTAB : 9, // Abort
38
- NSPTRS : 11, // Re-send
39
- NSPTMK : 12, // Marker
40
- NSPTAT : 13, // Attention
41
- NSPTCNL : 14, // Control information
42
- NSPTDD : 15, // data descriptor
43
- NSPTHI : 19, // Highest legal packet type
30
+ NSPTCN: 1, // Connect
31
+ NSPTAC: 2, // Accept
32
+ NSPTAK: 3, // Acknowledge
33
+ NSPTRF: 4, // Refuse
34
+ NSPTRD: 5, // Redirect
35
+ NSPTDA: 6, // Data
36
+ NSPTNL: 7, // Null
37
+ NSPTAB: 9, // Abort
38
+ NSPTRS: 11, // Re-send
39
+ NSPTMK: 12, // Marker
40
+ NSPTAT: 13, // Attention
41
+ NSPTCNL: 14, // Control information
42
+ NSPTDD: 15, // data descriptor
43
+ NSPTHI: 19, // Highest legal packet type
44
44
 
45
45
  // Packet Header
46
- NSPHDLEN : 0, // Packet length
47
- NSPHDPSM : 2, // Packet checksum(deprecated in version 3.15 with large sdu support)
48
- NSPHDTYP : 4, // Packet type
49
- NSPHDFLGS : 5, // Packet flags
50
- NSPHDHSM : 6, // Header checksum
51
- NSPSIZHD : 8, // Packet header size
46
+ NSPHDLEN: 0, // Packet length
47
+ NSPHDPSM: 2, // Packet checksum(deprecated in version 3.15 with large sdu support)
48
+ NSPHDTYP: 4, // Packet type
49
+ NSPHDFLGS: 5, // Packet flags
50
+ NSPHDHSM: 6, // Header checksum
51
+ NSPSIZHD: 8, // Packet header size
52
52
 
53
53
  /* Packet flags for NSPHDFLGS */
54
- NSPFSID : 0x01, // SID is given
55
- NSPFRDS : 0x02, // ReDirect Separation of cnda vs cndo
56
- NSPFRDR : 0x04, // ReDiRected client Connect (NSPTCN)
57
- NSPFLSD : 0x20, // packet with large sdu field
58
- NO_HEADER_FLAGS : 0,
59
- NSPFSRN : 0x08,
54
+ NSPFSID: 0x01, // SID is given
55
+ NSPFRDS: 0x02, // ReDirect Separation of cnda vs cndo
56
+ NSPFRDR: 0x04, // ReDiRected client Connect (NSPTCN)
57
+ NSPFLSD: 0x20, // packet with large sdu field
58
+ NO_HEADER_FLAGS: 0,
59
+ NSPFSRN: 0x08,
60
60
 
61
61
  // Connect Packet
62
- NSPCNVSN : 8, // My version number
63
- NSPCNLOV : 10, // Lowest version number I can be compatible with
64
- NSPCNOPT : 12, // Global service options
65
- NSPCNSDU : 14, // My SDU size
66
- NSPCNTDU : 16, // Maximum TDU size
67
- NSPCNNTC : 18, // NT characterstics
68
- NSPCNTNA : 20, // Line turnaround value
69
- NSPCNONE : 22, // The value '1' in my hardware byte order
70
- NSPCNLEN : 24, // Length of connect data
71
- NSPCNOFF : 26, // Offset to connect data
72
- NSPCNMXC : 28, // Maximum connect data you can send me
73
- NSPCNFL0 : 32, // Connect flags
74
- NSPCNFL1 : 33,
75
- NSPCNTMO : 50, // local connection timeout val
76
- NSPCNTCK : 52, // local tick size
77
- NSPCNADL : 54,
78
- NSPCNAOF : 56, // offset to reconnect tns addr
79
- NSPCNLSD : 58, // large sdu
80
- NSPCNLTD : 62, // large tdu
81
- NSPCNCFL : 66, // compression data
82
- NSPCNCFL2 : 70, // connect flag2
62
+ NSPCNVSN: 8, // My version number
63
+ NSPCNLOV: 10, // Lowest version number I can be compatible with
64
+ NSPCNOPT: 12, // Global service options
65
+ NSPCNSDU: 14, // My SDU size
66
+ NSPCNTDU: 16, // Maximum TDU size
67
+ NSPCNNTC: 18, // NT characterstics
68
+ NSPCNTNA: 20, // Line turnaround value
69
+ NSPCNONE: 22, // The value '1' in my hardware byte order
70
+ NSPCNLEN: 24, // Length of connect data
71
+ NSPCNOFF: 26, // Offset to connect data
72
+ NSPCNMXC: 28, // Maximum connect data you can send me
73
+ NSPCNFL0: 32, // Connect flags
74
+ NSPCNFL1: 33,
75
+ NSPCNTMO: 50, // local connection timeout val
76
+ NSPCNTCK: 52, // local tick size
77
+ NSPCNADL: 54,
78
+ NSPCNAOF: 56, // offset to reconnect tns addr
79
+ NSPCNLSD: 58, // large sdu
80
+ NSPCNLTD: 62, // large tdu
81
+ NSPCNCFL: 66, // compression data
82
+ NSPCNCFL2: 70, // connect flag2
83
83
  // NSPCNV310DAT : (NSPCNTMO + 8), start of connect data, V3.10 packet
84
84
  // NSPCNV315DAT : (NSPCNCFL + 4),
85
- NSPCNDAT : 74, // Start connect data
86
- NSPMXCDATA : 230, // Maximum length of connect data
85
+ NSPCNDAT: 74, // Start connect data
86
+ NSPMXCDATA: 230, // Maximum length of connect data
87
87
  // Connect flags (Used mostly by NA)
88
- NSINAWANTED : 0x01, // Want to use NA
89
- NSINAINTCHG : 0x02, // Interchange involved
88
+ NSINAWANTED: 0x01, // Want to use NA
89
+ NSINAINTCHG: 0x02, // Interchange involved
90
90
  NSINADISABLEDFORCONNECTION: 0x04, // Disable NA
91
- NSINANOSERVICES : 0x08, // No NA services linked
92
- NSINAREQUIRED : 0x10, // NA is required
93
- NSINAAUTHWANTED : 0x20, // Authentication linked
94
- NSISUPSECRENEG : 0x80, // bkwrd comp: SUPport SECurity RE-NEG
91
+ NSINANOSERVICES: 0x08, // No NA services linked
92
+ NSINAREQUIRED: 0x10, // NA is required
93
+ NSINAAUTHWANTED: 0x20, // Authentication linked
94
+ NSISUPSECRENEG: 0x80, // bkwrd comp: SUPport SECurity RE-NEG
95
95
  // Connect options
96
- NSGDONTCARE : 0x0001, // "don't care"
97
- NSGHDX : 0x0002, // half-duplex (w/ token management)
98
- NSGFDX : 0x0004, // full-duplex
99
- NSGHDRCHKSUM : 0x0008, // checksum on packet header
100
- NSGPAKCHKSUM : 0x0010, // checksum on entire packet
101
- NSGBROKEN : 0x0020, // provide broken connection notification
102
- NSGUSEVIO : 0x0040, // can use Vectored I/O
103
- NSGOSAUTHOK : 0x0080, // use OS authentication
104
- NSGSENDATTN : 0x0200, // can send attention
105
- NSGRECVATTN : 0x0400, // can recv attention
106
- NSGNOATTNPR : 0x0800, // no attention processing
107
- NSGRAW : 0x1000, // I/O is direct to/from transport
108
- TNS_VERSION_DESIRED : 319,
109
- TNS_VERSION_MINIMUM : 300,
110
- TNS_VERSION_MIN_UUID : 319,
111
- TNS_UUID_OFFSET : 45,
96
+ NSGDONTCARE: 0x0001, // "don't care"
97
+ NSGHDX: 0x0002, // half-duplex (w/ token management)
98
+ NSGFDX: 0x0004, // full-duplex
99
+ NSGHDRCHKSUM: 0x0008, // checksum on packet header
100
+ NSGPAKCHKSUM: 0x0010, // checksum on entire packet
101
+ NSGBROKEN: 0x0020, // provide broken connection notification
102
+ NSGUSEVIO: 0x0040, // can use Vectored I/O
103
+ NSGOSAUTHOK: 0x0080, // use OS authentication
104
+ NSGSENDATTN: 0x0200, // can send attention
105
+ NSGRECVATTN: 0x0400, // can recv attention
106
+ NSGNOATTNPR: 0x0800, // no attention processing
107
+ NSGRAW: 0x1000, // I/O is direct to/from transport
108
+ TNS_VERSION_DESIRED: 319,
109
+ TNS_VERSION_MINIMUM: 300,
110
+ TNS_VERSION_MIN_UUID: 319,
111
+ TNS_UUID_OFFSET: 45,
112
112
 
113
113
  /* Accept Packet */
114
- NSPACVSN : 8, // connection version
115
- NSPACOPT : 10, // global service options
116
- NSPACSDU : 12, // SDU size
117
- NSPACTDU : 14, // Maximum TDU
118
- NSPACONE : 16, // The value '1' in my hardware byte order
119
- NSPACLEN : 18, // connect data length
120
- NSPACOFF : 20, // offset to connect data
121
- NSPACFL0 : 22, // connect flags
122
- NSPACFL1 : 23,
123
- NSPACTMO : 24, // connection pool timeout value
124
- NSPACTCK : 26, // local tick size
125
- NSPACADL : 28, // reconnect tns address length
126
- NSPACAOF : 30, // offset to reconnect tns addr
127
- NSPACLSD : 32, // Large sdu
128
- NSPACLTD : 36, // Large tdu
129
- NSPACCFL : 40, // compression flag
130
- NSPACFL2 : 41, // accept flag2 (4 bytes)
131
- NSPACV310DAT : 32, /* start of accept data, V3.10 packet */
132
- NSPACV315DAT : 41, // start of accept data, V3.15 packet
114
+ NSPACVSN: 8, // connection version
115
+ NSPACOPT: 10, // global service options
116
+ NSPACSDU: 12, // SDU size
117
+ NSPACTDU: 14, // Maximum TDU
118
+ NSPACONE: 16, // The value '1' in my hardware byte order
119
+ NSPACLEN: 18, // connect data length
120
+ NSPACOFF: 20, // offset to connect data
121
+ NSPACFL0: 22, // connect flags
122
+ NSPACFL1: 23,
123
+ NSPACTMO: 24, // connection pool timeout value
124
+ NSPACTCK: 26, // local tick size
125
+ NSPACADL: 28, // reconnect tns address length
126
+ NSPACAOF: 30, // offset to reconnect tns addr
127
+ NSPACLSD: 32, // Large sdu
128
+ NSPACLTD: 36, // Large tdu
129
+ NSPACCFL: 40, // compression flag
130
+ NSPACFL2: 41, // accept flag2 (4 bytes)
131
+ NSPACV310DAT: 32, /* start of accept data, V3.10 packet */
132
+ NSPACV315DAT: 41, // start of accept data, V3.15 packet
133
133
 
134
134
  /* Refuse Packet */
135
- NSPRFURS : 8, // User (appliction) reason for refusal
136
- NSPRFSRS : 9, // System (NS) reason for
137
- NSPRFLEN : 10, // Length of refuse data
138
- NSPRFDAT : 12, // Start of connect data
135
+ NSPRFURS: 8, // User (appliction) reason for refusal
136
+ NSPRFSRS: 9, // System (NS) reason for
137
+ NSPRFLEN: 10, // Length of refuse data
138
+ NSPRFDAT: 12, // Start of connect data
139
139
  // Compression flags
140
- NSPACCFON : 0x80, // 1st MSB: compression on/off
141
- NSPACCFAT : 0x40, // 2nd MSB : compression auto
142
- NSPACCFNT : 0x02, // Second last LSB : compression for non-tcp protocol
140
+ NSPACCFON: 0x80, // 1st MSB: compression on/off
141
+ NSPACCFAT: 0x40, // 2nd MSB : compression auto
142
+ NSPACCFNT: 0x02, // Second last LSB : compression for non-tcp protocol
143
143
  // Accept flag2
144
- NSPACOOB : 0x00000001, // OOB support check at connection time
145
- NSGPCHKSCMD : 0x01000000, // Support for Poll and Check logic
144
+ NSPACOOB: 0x00000001, // OOB support check at connection time
145
+ NSGPCHKSCMD: 0x01000000, // Support for Poll and Check logic
146
146
 
147
147
  /* Redirect packet */
148
- NSPRDLEN : 8, // Length of redirect data
149
- NSPRDDAT : 10, // Start of connect data
148
+ NSPRDLEN: 8, // Length of redirect data
149
+ NSPRDDAT: 10, // Start of connect data
150
150
 
151
151
  /* Data Packet */
152
- NSPDAFLG : 8, // Data flags
153
- NSPDADAT : 10, // Start of Data
154
- NSPDAFEOF : 0x40, // "end of file"
152
+ NSPDAFLG: 8, // Data flags
153
+ NSPDADAT: 10, // Start of Data
154
+ NSPDAFEOF: 0x40, // "end of file"
155
155
 
156
156
  /* Marker Packet */
157
- NSPMKTYP : 8, // marker type (see below)
158
- NSPMKODT : 9, // old (pre-V3.05) data byte
159
- NSPMKDAT : 10, // data byte
160
- NSPMKTD0 : 0, // data marker - 0 data bytes
161
- NSPMKTD1 : 1, // data marker - 1 data byte
162
- NSPMKTAT : 2, // Attention Marker
163
- NIQBMARK : 1, // Break marker
164
- NIQRMARK : 2, // Reset marker
165
- NIQIMARK : 3, // Interrupt marker
157
+ NSPMKTYP: 8, // marker type (see below)
158
+ NSPMKODT: 9, // old (pre-V3.05) data byte
159
+ NSPMKDAT: 10, // data byte
160
+ NSPMKTD0: 0, // data marker - 0 data bytes
161
+ NSPMKTD1: 1, // data marker - 1 data byte
162
+ NSPMKTAT: 2, // Attention Marker
163
+ NIQBMARK: 1, // Break marker
164
+ NIQRMARK: 2, // Reset marker
165
+ NIQIMARK: 3, // Interrupt marker
166
166
 
167
167
  /* Control Packet */
168
- NSPCTLCMD : 8, // Control Command length is 2 bytes
169
- NSPCTLDAT : 10, // Control Data length is specific to the Command type.
170
- NSPCTL_SERR : 8, // Error Control Command Type
171
- NSPCTL_CLRATTN : 9, // Clear OOB option
168
+ NSPCTLCMD: 8, // Control Command length is 2 bytes
169
+ NSPCTLDAT: 10, // Control Data length is specific to the Command type.
170
+ NSPCTL_SERR: 8, // Error Control Command Type
171
+ NSPCTL_CLRATTN: 9, // Clear OOB option
172
172
 
173
173
  /* OPTIONS */
174
- NSPDFSDULN : 8192, // default SDU size
175
- NSPABSSDULN : 2097152, // maximim SDU size
176
- NSPMXSDULN : 65535, // maximim SDU size
177
- NSPMNSDULN : 512, // minimum SDU size
178
- NSPDFTDULN : 2097152, // default TDU size
179
- NSPMXTDULN : 2097152, // maximum TDU size
180
- NSPMNTDULN : 255, // minimum TDU size
181
- NSFIMM : 0x0040, // immediate close
174
+ NSPDFSDULN: 8192, // default SDU size
175
+ NSPABSSDULN: 2097152, // maximim SDU size
176
+ NSPMXSDULN: 65535, // maximim SDU size
177
+ NSPMNSDULN: 512, // minimum SDU size
178
+ NSPDFTDULN: 2097152, // default TDU size
179
+ NSPMXTDULN: 2097152, // maximum TDU size
180
+ NSPMNTDULN: 255, // minimum TDU size
181
+ NSFIMM: 0x0040, // immediate close
182
182
 
183
183
  /* PARAMETERS */
184
- DISABLE_OOB_STR : 'DISABLE_OOB', // disable OOB parameter
185
- EXPIRE_TIME : 'EXPIRE_TIME', // expire Time
186
- PEM_WALLET_FILE_NAME : 'ewallet.pem',
184
+ DISABLE_OOB_STR: 'DISABLE_OOB', // disable OOB parameter
185
+ EXPIRE_TIME: 'EXPIRE_TIME', // expire Time
186
+ PEM_WALLET_FILE_NAME: 'ewallet.pem',
187
187
 
188
188
  /* Get/Set options */
189
- NT_MOREDATA : 1, // More Data in Transport available
190
- NS_MOREDATA : 2, // More Data available to be read
191
- SVCNAME : 3, // Service name
192
- SERVERTYPE : 4, // Server type
193
- REMOTEADDR : 5, // Remote Address
194
- HEALTHCHECK : 6, // Health check of connection
195
- CONNCLASS : 7, // Connection Class
196
- PURITY : 8, // Purity
197
- SID : 9, // SID
189
+ NT_MOREDATA: 1, // More Data in Transport available
190
+ NS_MOREDATA: 2, // More Data available to be read
191
+ SVCNAME: 3, // Service name
192
+ SERVERTYPE: 4, // Server type
193
+ REMOTEADDR: 5, // Remote Address
194
+ HEALTHCHECK: 6, // Health check of connection
195
+ CONNCLASS: 7, // Connection Class
196
+ PURITY: 8, // Purity
197
+ SID: 9, // SID
198
198
 
199
199
  /* FLAGS */
200
- NSNOBLOCK : 0x0001, // Do not block
200
+ NSNOBLOCK: 0x0001, // Do not block
201
201
  };
@@ -26,7 +26,6 @@
26
26
 
27
27
  'use strict';
28
28
 
29
- const {lookup} = require('dns').promises;
30
29
  const errors = require("../../errors.js");
31
30
 
32
31
  // The host information pattern of the EZConnect URL format.
@@ -71,14 +70,7 @@ const DESCRIPTION_PARAMS = ["ENABLE", "FAILOVER", "LOAD_BALANCE",
71
70
  class EZConnectResolver {
72
71
  constructor(url) {
73
72
  this.URL_PROPS_ALIAS = this.initializeUrlAlias();
74
- const jdbcUrlPrefix = url.indexOf('@');
75
- if (jdbcUrlPrefix != -1) {
76
- this.url = url.substring(jdbcUrlPrefix + 1);
77
- this.urlPrefix = url.substring(0, jdbcUrlPrefix + 1);
78
- } else {
79
- this.url = url;
80
- this.urlPrefix = "";
81
- }
73
+ this.url = url;
82
74
  this.resolvedUrl = '';
83
75
  this.connectionProps = new Map();
84
76
  this.urlProps = new Map();
@@ -89,8 +81,8 @@ class EZConnectResolver {
89
81
  * Returns the resolved long TNS String.
90
82
  * @return Resolved TNS URL.
91
83
  */
92
- async getResolvedUrl() {
93
- await this.parse();
84
+ getResolvedUrl() {
85
+ this.parse();
94
86
  return this.resolvedUrl;
95
87
  }
96
88
 
@@ -99,29 +91,22 @@ class EZConnectResolver {
99
91
  * After parsing the extended settings if the remaining part of the URL is in
100
92
  * EZConnectURL format then resolve it to long TNS url format.
101
93
  */
102
- async parse() {
94
+ parse() {
103
95
  // First try to parse the extended settings part of the URL.
104
96
  let parsedUrl = this.parseExtendedSettings(this.url);
105
97
  if (this.connectionProps.size === 0 && this.urlProps.size === 0) {
106
98
  // If we have not parsed anything then use the received url as is.
107
99
  parsedUrl = this.url;
108
100
  }
109
-
110
- if (parsedUrl.startsWith("(")) {
111
- // Skip resolve the URL if it is in TNS format,
112
- // TNS format starts with '('
113
- this.resolvedUrl = this.urlPrefix + parsedUrl;
114
- } else {
115
- // Try to resolve the EZConnectURL to Long TNS URL.
116
- this.resolvedUrl = this.urlPrefix + await this.resolveToLongURLFormat(parsedUrl);
117
- }
101
+ // Try to resolve the EZConnectURL to Long TNS URL.
102
+ this.resolvedUrl = this.resolveToLongURLFormat(parsedUrl);
118
103
  }
119
104
  /**
120
105
  * Translate the given ezconnect url format to Long TNS format.
121
106
  * @param url EZConnect URL
122
107
  * @return Returns resolved TNS url.
123
108
  */
124
- async resolveToLongURLFormat(url) {
109
+ resolveToLongURLFormat(url) {
125
110
  // URL is in the following format
126
111
  // [protocol://]host1[,host13][:port1][,host2:port2][/service_name][:server][/instance_name]
127
112
 
@@ -151,7 +136,7 @@ class EZConnectResolver {
151
136
  const proxyHost = this.urlProps.get("HTTPS_PROXY");
152
137
  const proxyPort = this.urlProps.get("HTTPS_PROXY_PORT");
153
138
  const addressInfo =
154
- await this.buildAddressList(hostInfo, protocol, proxyHost, proxyPort);
139
+ this.buildAddressList(hostInfo, protocol, proxyHost, proxyPort);
155
140
 
156
141
  const connectionIdPrefix =
157
142
  this.urlProps.get("CONNECTION_ID_PREFIX");
@@ -210,10 +195,8 @@ class EZConnectResolver {
210
195
  * @param proxyPort proxy server port [optional].
211
196
  * @return address information of the DESCRIPTION node.
212
197
  */
213
- async buildAddressList(hostInfo, protocol,
198
+ buildAddressList(hostInfo, protocol,
214
199
  proxyHost, proxyPort) {
215
- let shost = '';
216
- let ipcnt = 0;
217
200
  const builder = new Array();
218
201
  let proxyInfo = '';
219
202
  if (proxyHost != null) {
@@ -235,11 +218,10 @@ class EZConnectResolver {
235
218
  const hostnames = (match.groups.hostnames).split(',');
236
219
  let port = match.groups.port;
237
220
  if (port == null) {
238
- port = '1521' + '';
221
+ port = '1521'; //default port
239
222
  }
240
223
  for (const hname in hostnames) {
241
224
  addressListBuilder.push(this.getAddrStr(hostnames[hname], port, protocol, proxyInfo));
242
- shost = hostnames[hname];
243
225
  addressNodeCount++;
244
226
  }
245
227
  }
@@ -253,21 +235,6 @@ class EZConnectResolver {
253
235
  else
254
236
  builder.push(parts.join(''));
255
237
  }
256
- if (naddr == 1) {
257
- shost = shost.trim();
258
- // If it is IPV6 format address then remove the enclosing '[' and ']'
259
- if (shost.startsWith("[") && shost.endsWith("]"))
260
- shost = shost.substring(1, shost.length - 1);
261
- try {
262
- await lookup(shost);
263
- ipcnt++;
264
- } catch {
265
- // nothing
266
- }
267
- if (ipcnt == 0) {
268
- errors.throwErr(errors.ERR_INVALID_EZCONNECT_SYNTAX, 'could not resolve hostname', shost);
269
- }
270
- }
271
238
 
272
239
  if (addressLists.length < 2 && naddr > 1) {
273
240
  this.lb = true;
@@ -35,10 +35,10 @@ const dnsPromises = dns.promises;
35
35
  const cInfo = require("../util.js").CLIENT_INFO;
36
36
 
37
37
  const SchemaObjectFactoryInterface = {
38
- ADDR:0,
39
- ADDR_LIST:1,
40
- DESC:2,
41
- DESC_LIST:3,
38
+ ADDR: 0,
39
+ ADDR_LIST: 1,
40
+ DESC: 2,
41
+ DESC_LIST: 3,
42
42
  };
43
43
 
44
44
  /**
@@ -77,7 +77,7 @@ class Address {
77
77
  const httpsProxyPortNVP = findNVPairRecurse(nvp, 'https_proxy_port');
78
78
 
79
79
  if (portnvp)
80
- this.port = portnvp.atom;
80
+ this.port = Number(portnvp.atom);
81
81
 
82
82
  if (hostnvp)
83
83
  this.host = hostnvp.atom;
@@ -88,7 +88,7 @@ class Address {
88
88
  if (httpsProxyNVP)
89
89
  this.httpsProxy = httpsProxyNVP.atom;
90
90
  if (httpsProxyPortNVP)
91
- this.httpsProxyPort = httpsProxyPortNVP.atom;
91
+ this.httpsProxyPort = Number(httpsProxyPortNVP.atom);
92
92
 
93
93
  this.addr = nvp.toString();
94
94
  }
@@ -451,7 +451,7 @@ const NavSchemaObject = {
451
451
  CONID: "(CONNECTION_ID="
452
452
  };
453
453
  const options = {
454
- all:true,
454
+ all: true,
455
455
  };
456
456
  /**
457
457
  * Class that navigates the address node in the tree.
@@ -46,6 +46,7 @@ const downHostInstance = require("./connStrategy.js").SOLE_INST_DHCACHE;
46
46
 
47
47
  async function getConnectionInfo(userConfig) {
48
48
  const connStr = await resolveConnectStr(userConfig.connectString, userConfig.configDir);
49
+ const addressNode = await createNode(connStr);
49
50
  let nvpair;
50
51
  if (typeof connStr === 'string')
51
52
  nvpair = createNVPair(connStr);
@@ -58,7 +59,7 @@ async function getConnectionInfo(userConfig) {
58
59
  const sid = findValue(nvpair, ["DESCRIPTION", "CONNECT_DATA", "SID"]);
59
60
  const poolPurity = findValue(nvpair, ["DESCRIPTION", "CONNECT_DATA", "POOL_PURITY"]);
60
61
 
61
- return [serverVal, connClass, svcname, poolPurity, sid ];
62
+ return [serverVal, connClass, svcname, poolPurity, sid, addressNode ];
62
63
  }
63
64
 
64
65
  /**
@@ -71,29 +72,23 @@ async function resolveConnectStr(connectString, configDir) {
71
72
  const connStr = connectString.trim();
72
73
  let resolvedVal = connStr;
73
74
  if ((connStr.indexOf(')') == -1) || (connStr.indexOf('(') != 0)) {
74
- try {
75
- /* Try through ezconnect */
75
+ if ((connStr.indexOf(':') != -1) || (connStr.indexOf('/') != -1)) {
76
76
  const ezcnObj = new EzConnect(connStr);
77
- resolvedVal = await ezcnObj.getResolvedUrl();
78
- } catch (err) {
79
- try {
80
- /* try tns alias */
81
- const namesFilePath = tnsnamesFilePath(configDir);
82
- const p = await nlParamParser.initializeNlpa(namesFilePath);
83
- resolvedVal = p.get(connStr.toUpperCase());
84
- if (!resolvedVal)
85
- errors.throwErr(errors.ERR_TNS_ENTRY_NOT_FOUND, connStr, configDir ? configDir + '/tnsnames.ora' : process.env.TNS_ADMIN + '/tnsnames.ora');
86
- resolvedVal = resolvedVal.getListElement(0);
87
- } catch (err1) {
88
- if ((connStr.indexOf(':') != -1) || (connStr.indexOf('/') != -1)) {
89
- throw err;
90
- } else {
91
- throw err1;
92
- }
93
- }
77
+ resolvedVal = ezcnObj.getResolvedUrl();
78
+ return resolvedVal;
79
+ } else {
80
+ //try tns alias
81
+ const namesFilePath = tnsnamesFilePath(configDir);
82
+ const p = await nlParamParser.initializeNlpa(namesFilePath);
83
+ resolvedVal = p.get(connStr.toUpperCase());
84
+ if (!resolvedVal)
85
+ errors.throwErr(errors.ERR_TNS_ENTRY_NOT_FOUND, connStr, configDir ? configDir + '/tnsnames.ora' : process.env.TNS_ADMIN + '/tnsnames.ora');
86
+ resolvedVal = resolvedVal.getListElement(0);
94
87
  }
88
+
95
89
  }
96
90
  return resolvedVal;
91
+
97
92
  }
98
93
 
99
94
  async function resolveAddress(connStr, configDir) {
@@ -516,7 +511,13 @@ class NetworkSession {
516
511
  */
517
512
  async connect(userConfig) {
518
513
  const connStr = userConfig.connectString ? userConfig.connectString : userConfig.connectionString;
519
- const addressNode = await resolveAddress(connStr, userConfig.configDir);
514
+ let addressNode;
515
+ if (userConfig._connInfo) {
516
+ addressNode = userConfig._connInfo[5];
517
+ addressNode.reset();
518
+ } else {
519
+ addressNode = await resolveAddress(connStr, userConfig.configDir);
520
+ }
520
521
  let address;
521
522
  try {
522
523
  address = await this.getAddress(addressNode, userConfig);
@@ -228,10 +228,10 @@ class NTTCP {
228
228
  this.doDNMatch = false; //Don't match initial connect
229
229
  try {
230
230
  secureContext = tls.createSecureContext({
231
- cert : this.atts.wallet,
232
- key : this.atts.wallet,
231
+ cert: this.atts.wallet,
232
+ key: this.atts.wallet,
233
233
  passphrase: this.atts.walletPassword,
234
- ca : this.atts.wallet,
234
+ ca: this.atts.wallet,
235
235
  });
236
236
  } catch (err) {
237
237
  errors.throwErr(errors.ERR_TLS_INIT_FAILURE);
@@ -415,7 +415,7 @@ class NTTCP {
415
415
  buf: tempBuf.subarray(0, len),
416
416
  type: tempBuf[4],
417
417
  flags: tempBuf[5],
418
- num : this.packetNum++
418
+ num: this.packetNum++
419
419
  };
420
420
  this.packets.push(packet);
421
421
  if (this.readWaiter) {
@@ -474,10 +474,10 @@ class NTTCP {
474
474
  this.checkErr();
475
475
  this.doDNMatch = true;
476
476
  const secureContext = tls.createSecureContext({
477
- cert : this.atts.wallet,
478
- key : this.atts.wallet,
477
+ cert: this.atts.wallet,
478
+ key: this.atts.wallet,
479
479
  passphrase: this.atts.walletPassword,
480
- ca : this.atts.wallet,
480
+ ca: this.atts.wallet,
481
481
  });
482
482
  await this.tlsConnect(secureContext, this.connStream);
483
483
  } finally {
@@ -299,7 +299,7 @@ function RedirectPacket(packet) {
299
299
  */
300
300
  function MarkerPacket(isLargeSDU) {
301
301
  this.len = constants.NSPMKDAT + 1; /* Packet length */
302
- this.buf = Buffer.alloc(constants.NSPMKDAT + 1); /* Packet Buffer */
302
+ this.buf = Buffer.allocUnsafe(constants.NSPMKDAT + 1); /* Packet Buffer */
303
303
 
304
304
  if (isLargeSDU) {
305
305
  this.buf.writeUInt32BE(this.len, constants.NSPHDLEN);