HOW TO

Bypass the login screen when connecting to an Oracle database

Last Published: April 25, 2020

Summary

Steps to bypass the login screen when making an SQL connection to an Oracle database on UNIX and PC platforms.

Procedure

You can bypass the login screen by hardcoding the username and password in an Avenue script using the following requests.

  • To make a SQL connection to an Oracle database from UNIX:

    1. Open a new script window.

    A. Activate the Project window.
    B. Click the Scripts icon.
    C. Click New.



    2. Copy the following code into the script window:

    Code:
    theSQL=SQLCon.Find("Oracle")
    theSQL.Login("user/password")
    astring="Select * from house1"
    theVTab=VTab.MakeSQL(theSQL, astring)
    myTable=Table.Make(theVtab) av.GetProject.AddDoc(mytable)
    mytable.GetWin.Open


    Note:
    This script assumes that the environment variables needed to connect to Oracle have been set.


    3. Click the Compile button.
    [O-Image] Script compile button
    4. Click the Run button.
    [O-Image] Run compiled script button
  • To make a SQL connection to an Oracle database from a PC using ODBC:

    1. Create a Data Source Name (DSN) for the Oracle database.

    A. Click Start > Settings > Control Panel.
    B. Double-click the ODBC32 Administrator icon.
    C. Select the User DSN tab, then click the Add button.
    D. Select the Oracle ODBC Driver and click the Finish button.
    E. Type in a name for the DSN in the Data Source Name field, for example 'Addresses'.
    F. Enter the Service Name.
    G. Click OK.
    H. Click OK to close the ODBC Administrator dialog box.



    2. Open a new script window.

    3. Copy the following code into the script window:

    Code:
    theCon = SQLCon.Find("DSN NAME")
    theCon.Login("SRVR=orasan;UID=snoopy;PWD=snoopy")
    astring="Select * from house1"
    theVTab=VTab.MakeSQL(theCon, astring)
    myTable=Table.Make(theVtab)
    av.GetProject.AddDoc(mytable)
    mytable.GetWin.Open


    Where 'SRVR' is the Oracle service name and 'astring' is a SQL statement that selects all of the fields from a table in the database. The following is an excerpt from the tnsnames.ora file where two different alias names/service names are defined as "san" and "rexx":

    san = (DESCRIPTION = 
    (ADDRESS =
    (PROTOCOL = TCP)
    (HOST = sanawar)
    (PORT = 1521)
    )
    (CONNECT_DATA =
    (SID = oracle7)
    )
    )

    rexx = (DESCRIPTION =
    (ADDRESS =
    (PROTOCOL = TCP)
    (HOST = rexx)
    (PORT = 1521)
    )
    (CONNECT_DATA =
    (SID = sde30)
    )
    )


    4. Click the Compile button.
    [O-Image] Script compile button
    5. Click the Run button.
    [O-Image] Run compiled script button

Article ID:000004029

Software:
  • Legacy Products

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options

Discover more on this topic