1.2 Connecting to Your Database

A connection is a SQL Developer object that specifies the necessary information for connecting to a specific database as a specific user of that database. You must have at least one database connection (existing or created) to use SQL Developer for VS Code.

You can connect to any target Oracle database schema using standard Oracle database authentication. Once connected, you can perform operations on objects in the database.

The actions that you can perform for connections are:

  • Add: To create a new connection. Click the Add icon next to Connections, enter the connection information and click Connect. For more information, see Creating a Connection.

  • Edit: To edit an existing connection. In the Connections panel, right-click the connection name and select Edit. Change any connection information except the connection name, and click Save or Connect.

  • Clone: To create a new connection when one or more connections already exist. In the Connections panel, select an existing connection, right-click and click Clone. Change the Connection name to the desired name, edit other connection information as needed, and click Save or Connect to create the new connection.

  • Refresh: To update the connection to include any changes that were made. Click the Refresh icon next to the connection name to refresh the connection.
  • Open SQL Worksheet: To open a SQL Worksheet pane for the connection. Right-click the connection name, and select Open SQL Worksheet. See Using the SQL Worksheet

  • Open SQLcl: To start the SQLcl command line in the Terminal tab for the opened database connection. Right-click the connection name, and select Open SQLcl.

  • Reconnect: To reconnect to a connection where the session has been terminated. Right-click the name in the Connections panel, and select Reconnect.

  • Disconnect: To disconnect from the current connection. Right-click the name in the Connections panel, and select Disconnect.

  • Delete: To delete a connection (that is, delete it from SQL Developer, not merely disconnect from the current connection), right-click the connection name in the Connections panel display and select Delete. Deleting a connection does not delete the user associated with that connection.

1.2.1 Creating a Connection

Perform the following steps to create a new connection:
  1. In the Connections panel, click the Add icon.

    The Create Connection pane appears.

  2. Enter the fields as follows:

    Connection Name: An alias for a connection to the database using the information that you enter. (The connection name is not stored in the database, and the connection is not a database object.) Suggestion: Include the database name (SID) and user name in the connection name. Example: personnel_joe for connecting to the personnel database as user Joe.

    User Info Tab

    • Role: The set of privileges to be associated with the connection. For a user that has been granted the SYSDBA system privilege, you can specify a connection that includes the privilege.
    • Username: Name of the database user for the connection. This user must have sufficient privileges to perform the tasks that you want to perform while connected to the database, such as creating, editing, and deleting tables, views, and other objects.
    • Password: Password associated with the specified database user.
    • Save Password: If this option is checked, the password is saved with the connection information, and you will not be prompted for the password on subsequent attempts to connect using this connection.
    • Connection Type: Select Basic, TNS, Cloud Wallet, or Custom JDBC URL. The display of fields changes to reflect any change in connection type. For any Oracle connection type, there is an Advanced tab that you can use to set custom JDBC properties.
      • Basic Connection Type
        • Hostname: Host system for the Oracle database.

        • Port: Listener port.

        • Type: Database name.

        • Service Name: Network service name of the database (for a remote database connection over a secure connection).

      • TNS Connection Type
        • Network Alias: Oracle Net alias for the database.

        • TNS File Location: Displays the directory where your TNSNAMES.ORA file is located. Click the Edit in Settings link to add or change the location.

        • Connect Identifier: Oracle Net connect identifier.

      • Cloud Wallet Connection Type

        This connection type is relevant for Oracle Cloud connections that use Oracle Wallet.

        • Configuration File: Client credentials zip file downloaded from the Cloud service console.

        • Service: Service name in the client credentials file. This field is automatically prefilled after the client credential file is selected.

        • Proxy tab: Cloud Wallet connections support a custom proxy.

      • Custom JDBC Connection Type

        • Custom JDBC URL: URL for connecting directly from Java to the database, it overrides any other connection type specification. If you are using TNS or a naming service with the OCI driver, you must specify this information: Example:

          jdbc:oracle:thin:scott/@localhost:1521:orcl
          

          Note that in this example, the "/" is required, and the user will be prompted to enter the password.

  3. Click Test to test the database connection before opening it.
  4. Click Save to save the connection details, or click Connect to open the connection.