Thursday, 7 May 2015

Ways of connection - sqlcl and the connect command

Where it looks for connections is a bit long winded:
Check -optl if this does not quite match what you are seeing.

Variables we support:
TNS_ADMIN (for finding tnsnames.ora)
LOCAL (windows=TWO_TASK)
TWO_TASK (non windows i.e. my database connection information e.g. tnsnames.ora entry name or EZCONNECT)
ORACLE_HOME (for finding tnsnames.ora)
SQLPATH (for finding login.sql)
PATH for finding .dll
LD_LIBRARY_PATH for finding .so
ORACLE_SID used in bequeath connection by thick oci driver.

tnsnames.ora - looks for tnsnames.* for example so might pick up an old setting in a .SAV file.

connect -oci username/password
nothing given:if currently connected try same utl different connection.
nothing given:not currently connected and -oci try bequeath

try TWO_TASK/LOCAL (if these are not null go to  'something given')
try localhost:1521/orcl

if something given
try LDAPCON environment variable
try tnsnames.ora
try NET xml store of connections
try passing on to the driver untouched (could be (DESCRIPTION= or hostname resolution for example)
try hostname resolution ie @hostname or @hostname:1521/hostname (in case hostname=service name) (try with or without domain eg - or domain got from looking up resolved host)
(if -oci try thick then try thin for each possibility (there are one or two that currently do not try thick))

On no connection give error output for each attempt. (optl shows what it is trying whether it connects or not).

If password is missing prompt for it, if connection fails and there was a prompt - prompt for everything up to 3 times.
At the username prompt: user@dbname is not currently supported.

No comments: