JetBrains Rider 2024.3 Help

Create an Oracle data source using OCI

Enable the Database Tools and SQL plugin

This functionality relies on the Database Tools and SQL plugin, which is bundled and enabled in JetBrains Rider by default. If the relevant features are not available, make sure that you did not disable the plugin.

  1. Press Ctrl+Alt+S to open settings and then select Plugins.

  2. Open the Installed tab, find the Database Tools and SQL plugin, and select the checkbox next to the plugin name.

JetBrains Rider uses JDBC drivers to connect to the Oracle server through the TNS protocol. The following driver modes are available:

  • In Thin mode, the JDBC driver always connects to the TNS listener. In this mode, various versions of the JDBC driver can be used.

  • In OCI mode, the JDBC driver uses native libraries. In this case, the JDBC driver's version must be the same as the version of these native libraries.

Required files and settings

  • Running Oracle instance with access permissions for your user.

  • Configured tnsnames.ora file. For full information about tnsnames.ora file, refer to the official documentation.

Creating the Oracle OCI data source

Step 1. Prepare a driver for the OCI connection

  1. Open data source properties. You can open data source properties by using one of the following options:

    • In the Database tool window (View | Tool Windows | Database) , click the Data Source Properties icon The Data Source Properties icon.

    • Press Ctrl+Alt+Shift+S.

  2. In the Data Sources and Drivers dialog, click the Drivers tab.

  3. In the list of drivers, right-click the Oracle driver and select Duplicate.

  4. Change the name of the duplicated Oracle driver (for example, Oracle [OCI]).

  5. In the Driver Files pane, click the Add icon (the Add button) and select Native Library Path….

  6. In the file browser, navigate to the directory of the Instant Client files (for example, ~/Oracle/instantclient_19_8) and click Open.

    Preparing drivers for the OCI connection

Step 2. Create the Oracle data source

  1. In the Database tool window (View | Tool Windows | Database) , click the New icon New and select Connect to Database.

  2. If you have a connection string for the database defined in your solution or elsewhere, leave the Use connection string option selected and choose Oracle in the Database type selector.

    Use the String selector to choose the desired connection string from your solution or type it in manually, then click Connect.

  3. You can also choose Add data source manually, click Next and select Oracle in the Database source selector. Follow the wizard steps to form the connection string by configuring individual options.

  4. To access all available options for the new database connection, click in the Database window, then click the New icon New and select Oracle.

  5. From the Connection type list, select TNS.

  6. From the Driver list, select OCI.

  7. Click the Driver link and select the driver entry that you created on Step 1 (in our case, Oracle [OCI]).

  8. In the TNSADMIN field, click the browse button and navigate to the directory with the Instant Client files (in our case, ~/Oracle/instantclient_19_8/network/admin).

  9. In the TNS name field, use the automatic completion (Ctrl+Space) to select which service name to use (see a value of an alias in the tnsnames.ora wallet file).

  10. Specify credentials for the Oracle user.

  11. Ensure that the connection to the database can be established using the provided details. To do that, click the Test Connection link at the bottom of the connection details area.

    Test Connection link

    In case of any connection issues, refer to the Cannot connect to a database page.

  12. (Optional) By default, only the default schema is introspected and available to work with. If you also want to work with other schemas, in the Schemas tab, select them for the introspection.

    Schemas tab of the Data Sources and Drivers dialog
  13. Click OK to create the data source.

  14. Find your new data source in the Database tool window (⌘ 1) .

    • For more information about the Database tool window, see the corresponding reference topic.

    • For more information about working with database objects in JetBrains Rider, refer to Database objects.

    • To write and run queries, open the default query console by clicking the data source and pressing F4.

    • To view data of a database object, open Data editor and viewer by double-clicking the object.

Create the OCI data source
Last modified: 15 May 2024