next up previous contents index
Next: Accessing an Oracle table: Up: Using the interface: Previous: Using the interface:   Contents   Index

Connecting to and disconnecting from Oracle:

Assuming the Oracle server is running, you have an account, and that the environment variables ORACLE_SID, ORACLE_HOME are set, you can login to Oracle by invoking db_open/1 as:

| ?- db_open(oracle(name, passwd)).
If the login is successful, there will be a response of yes.

To reach a remote server you can use:

| ?- db_open(oracle('name@dblink', passwd)).
where dblink is the protocol, machine and server instance name. For example,
SCOTT@T:compserv1gw:INST tells the runtime system we want to contact an oracle server instance whose ORACLE_SID is INST on the host compserv1gw using the TCP/IP protocol.

To disconnect from the current session use:

| ?- db_close.

Baoqiu Cui