Assuming the Oracle server is running, you have an account, and the environment variables ORACLE_SID and ORACLE_HOME are set, you can login to Oracle by invoking db_open/1 as:
| ?- db_open(oracle(Name, Password)).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', Password)).where dblink contains the machine name, and optionally the protocol and server instance name. For example
| ?- db_open(oracle('SCOTT@T:compserv1gw:INST', 'TIGER')).indicates to the runtime system that we want to contact an Oracle server instance on the host compserv1gw, whose ORACLE_SID is INST, using the TCP/IP protocol. Further, we want to access that database as the user SCOTT with password TIGER.
To disconnect from the current session use:
| ?- db_close.