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') 
 
note
PV‑WAVE only supports one active DBMS connection per DBMS vendor. Thus, a maximum of one Oracle connection can be open at a given time. To extract data from more than one Oracle database, the user must disconnect from the first database before connecting to the second one.
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.
 
note
Once you have imported your data into PV‑WAVE, it is not necessary to maintain an open database connection. We recommend closing the connection as soon as possible, to minimize the impact on the DBMS server.
For more information on DB_CONNECT, see Chapter 2: Reference.