Connecting to a Database
Use the DB_CONNECT function to establish a connection between a database and PV‑WAVE. DB_CONNECT takes two string parameters: the name of the DBMS vendor (ORACLE), and the connect_string (a string containing login commands) for the desired database. The return value of DB_CONNECT is an identifier that is used by PV‑WAVE to distinguish between database connections.
result = DB_CONNECT('dbms_vendor', 'connect_string')
Database Connection Example
Assume that you would like to access the data in an Oracle database. To import the data into PV‑WAVE, you must first establish a connection using the DB_CONNECT function. For example, to connect as user “scott” (password “tiger”), you could enter the following command:
oracle_id = DB_CONNECT(”ORACLE”, ”scott/tiger”)
This command attempts to connect to the default Oracle database for the current session. The default database is determined by the environment variable ORACLE_SID. If you want to connect to a database other than the default, you can use the following command:
oracle_id = DB_CONNECT(”ORACLE”, ”scott/tiger@another_db”)
In this case, another_db is the Oracle name of a database, as defined in the TNSNAMES.ORA file on your system.
For more information on DB_CONNECT, see Reference.