Skip to content

Commit 96f9f9f

Browse files
committed
Update of readme.md
1 parent 5561a05 commit 96f9f9f

1 file changed

Lines changed: 11 additions & 5 deletions

File tree

‎README.md‎

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,15 @@ Accepted formats:
100100
- `<user>/<password>@<TNSName>`
101101
- `/@<TNSName>` - credentials are taken from an Oracle Wallet (Secure External Password Store), see [Oracle Wallet](#oracle-wallet-secure-external-password-store)
102102

103-
To connect using TNS, you need to have either the TNS_ADMIN or the ORACLE_HOME environment variable set.
104-
The file tnsnames.ora must exist in the TNS_ADMIN directory or in %ORACLE_HOME%/network/admin
105-
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.
106112

107113
In case you use a username containing `/` or a password containing `@` you should encapsulate it with double quotes `"`:
108114
```
@@ -126,11 +132,11 @@ mkstore -wrl $HOME/oracle/wallet -createCredential MYDATABASE someusername
126132
echo "oracle.net.wallet_location=(SOURCE=(METHOD=FILE)(METHOD_DATA=(DIRECTORY=$HOME/oracle/wallet)))" \
127133
> $HOME/oracle/network/admin/ojdbc.properties
128134
129-
# tnsnames.ora with the MYDATABASE entry must be in the same directory
135+
# tnsnames.ora with the MYDATABASE entry must be in the same directory as ojdbc.properties
130136
export TNS_ADMIN=$HOME/oracle/network/admin
131137
```
132138

133-
Instead of setting `TNS_ADMIN` you can also pass it as part of the connect string: `/@MYDATABASE?TNS_ADMIN=/path/to/network/admin`.
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"`.
134140

135141
The TNS alias used in the connect string must match the alias of the credential stored in the wallet.
136142

0 commit comments

Comments
 (0)