docs/integrations/data-integrations/oracle.mdx
This documentation describes the integration of MindsDB with Oracle, one of the most trusted and widely used relational database engines for storing, organizing and retrieving data by type while still maintaining relationships between the various types.
Before proceeding, ensure the following prerequisites are met:
Establish a connection to your Oracle database from MindsDB by executing the following SQL command:
CREATE DATABASE oracle_datasource
WITH
ENGINE = 'oracle',
PARAMETERS = {
"host": "localhost",
"service_name": "FREEPDB1",
"user": "SYSTEM",
"password": "password"
};
Required connection parameters include the following:
user: The username for the Oracle database.
password: The password for the Oracle database.
dsn: The data source name (DSN) for the Oracle database.
OR
host: The hostname, IP address, or URL of the Oracle server.
AND
sid: The system identifier (SID) of the Oracle database.
OR
service_name: The service name of the Oracle database.
Optional connection parameters include the following:
port: The port number for connecting to the Oracle database. Default is 1521.disable_oob: The boolean parameter to disable out-of-band breaks. Default is false.auth_mode: The authorization mode to use.thick_mode: Set to true to use thick mode for the connection. Thin mode is used by default.oracle_client_lib_dir: The directory path where Oracle Client libraries are located. Required if thick_mode is set to true.Retrieve data from a specified table by providing the integration name, schema, and table name:
SELECT *
FROM oracle_datasource.schema_name.table_name
LIMIT 10;
Run PL/SQL queries directly on the connected Oracle database:
SELECT * FROM oracle_datasource (
--Native Query Goes Here
SELECT employee_id, first_name, last_name, email, hire_date
FROM oracle_datasource.hr.employees
WHERE department_id = 10
ORDER BY hire_date DESC;
);
oracle_client_lib_dir parameter is set correctly in the connection configuration.This troubleshooting guide provided by Oracle might also be helpful.