You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+35-3Lines changed: 35 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -98,16 +98,48 @@ Accepted formats:
98
98
-`<user>/<password>@//<host>[:<port>]/<service>`
99
99
-`<user>/<password>@<host>:<port>:<SID>`
100
100
-`<user>/<password>@<TNSName>`
101
+
-`/@<TNSName>` - credentials are taken from an Oracle Wallet (Secure External Password Store), see [Oracle Wallet](#oracle-wallet-secure-external-password-store)
101
102
102
-
To connect using TNS, you need to have the ORACLE_HOME environment variable set.
103
-
The file tnsnames.ora must exist in path %ORACLE_HOME%/network/admin
104
-
The file tnsnames.ora must contain valid TNS entries.
103
+
To connect using a TNS name, the file `tnsnames.ora` with a valid entry for that name must be found.
104
+
The directory holding `tnsnames.ora` (and `ojdbc.properties`, if used) is taken from the first of these that is set:
105
+
106
+
1.`TNS_ADMIN` parameter in the connect string, e.g. `app/pass@MYDATABASE?TNS_ADMIN=/path/to/network/admin`
107
+
2. Java system property `oracle.net.tns_admin`, e.g. `export JAVA_OPTS="-Doracle.net.tns_admin=/path/to/network/admin"`
108
+
3.`TNS_ADMIN` environment variable
109
+
4.`$ORACLE_HOME/network/admin`, when the `ORACLE_HOME` environment variable is set
110
+
111
+
Options 1-3 are handled by the Oracle JDBC driver. Option 4 is a fallback provided by utPLSQL-cli, used only when none of the others is set.
105
112
106
113
In case you use a username containing `/` or a password containing `@` you should encapsulate it with double quotes `"`:
107
114
```
108
115
utplsql run "my/Username"/"myP@ssword"@connectstring
# tnsnames.ora with the MYDATABASE entry must be in the same directory as ojdbc.properties
136
+
export TNS_ADMIN=$HOME/oracle/network/admin
137
+
```
138
+
139
+
`ojdbc.properties` is read from the same directory as `tnsnames.ora`, so any of the options listed under [ConnectionURL](#connectionurl) can be used instead of `TNS_ADMIN`, for example `utplsql run "/@MYDATABASE?TNS_ADMIN=/path/to/network/admin"`.
140
+
141
+
The TNS alias used in the connect string must match the alias of the credential stored in the wallet.
* The JDBC driver resolves tnsnames.ora / ojdbc.properties from the {@value TNS_ADMIN_PROPERTY} property
28
+
* or the TNS_ADMIN environment variable on its own, but it doesn't look into ORACLE_HOME.
29
+
* The property takes precedence over the environment variable, so it must not be set when TNS_ADMIN is.
30
+
*
31
+
* @return ORACLE_HOME/network/admin (lowercase, as in Oracle installations; paths are case-sensitive on Linux) when neither {@value TNS_ADMIN_PROPERTY} nor TNS_ADMIN is set, otherwise null
0 commit comments