You can create a DB link in Oracle Apex through the SQL Workshop. Here's a step-by-step guide:
1. Access the SQL Workshop
- Log in to your Oracle Apex workspace.
- Navigate to the SQL Workshop section.
- Select SQL Commands.
2. Execute the CREATE DATABASE LINK Statement
- In the SQL Commands window, type the following command, replacing the placeholders with your specific values:
CREATE DATABASE LINK <db_link_name>
CONNECT TO <username>
IDENTIFIED BY <password>
USING '<connect_string>';
Example:
CREATE DATABASE LINK remote_db
CONNECT TO user1
IDENTIFIED BY password123
USING '//remote_server:1521/remote_database';
Where:
<db_link_name>
: The name of the DB link you want to create.<username>
: The username for the remote database.<password>
: The password for the remote database.<connect_string>
: The connection string for the remote database.
3. Verify the DB Link
- After executing the command, you can verify the successful creation of the DB link by querying the
DBA_DB_LINKS
view:
SELECT * FROM DBA_DB_LINKS;
This will display a list of all DB links defined in the database, including the one you just created.
4. Use the DB Link
Once created, you can use the DB link in your SQL queries to access data from the remote database. For example:
SELECT * FROM remote_db.schema_name.table_name;
This query would retrieve data from the table_name
table in the schema_name
schema of the remote database, accessed through the remote_db
DB link.
Note: You need appropriate privileges to create DB links and access data from the remote database.