Forum Stats

  • 3,874,231 Users
  • 2,266,692 Discussions


Connecting to Oracle Instance in Visual Studio

Computer System: MacBook Pro vs 11.4

Browser: Chrome

IDE: Visual Studio

Thank you to anyone who attempts to help. I've downloaded the extension for Oracle on visual studio.

I am now trying to establish a connection to my account on Oracle Cloud. After looking online ( and here ( I've created a config file saved to ~/.oci.

I also tried creating a connection using the visual studio extension (by hitting the plus symbol), but nothing occurred. I also downloaded oci and oci_cli on both my local machine and the folder directory that my visual studio terminal accesses files. I'm really struggling and would appreciate any guidance I could get. Thank you to those who attempt to help.

Best Answer


  • Please read through this blog entry - it is more relevant than the one you read:

    In that article, I mention this link.... check it out to make sure you are creating the config file and pem file correctly:

    If you still can't get it working after following those steps, let me know exactly what you do and exactly what error you get.

    da bears
  • da bears
    da bears Member Posts: 9 Green Ribbon

    Thank you very much Christian.

    I read your guide and it was very well written, but my question refers to a relatively simple step in the process.

    The instructions state:

    • "Paste the contents of the clipboard into a file named config and save it to ~/.oci if using Linux or macOS, or %HOMEDRIVE%%HOMEPATH%\.oci if on Windows.
    • Modify the config file to set the key_file entry to the location of the private key (.pem file ) you downloaded earlier.
    • Save the config file and close it.

    I followed these steps and created a config file saved to a folder "~/.oci" (that's why I included the snippet above). The Oracle extension in VS is still not registering my account, so I believe this means the file was saved to the wrong location....but I'm not quite sure where else to save it?

    Thank you again

  • Christian.Shay -Oracle
    Christian.Shay -Oracle Posts: 2,241 Employee
    edited Nov 9, 2021 3:27PM

    Your screenshot of Oracle Infrastructure Explorer is unusual because there is no child nodes at all. If we can't find the config file, we put a child node there with a message saying so. And you say nothing is happening when you click the plus sign on Database Explorer. This tells me that this is most likely a severely failed installation or an unusual installation.

    For now, let us forget about cloud connectivity and focus on getting the connection dialog opening when you click the + sign.

    Can you tell me more details about how you installed this... did you install it from the marketplace? Did you see any unusual errors or messages when you installed? Are you running this in a VM or a container? This extension requires .NET Runtime... what version did you install?

    And of course, if you have only installed this once, try reinstalling, close VS Code, then reopen it...

    da bears
  • da bears
    da bears Member Posts: 9 Green Ribbon
    edited Nov 10, 2021 5:06PM

    Thank you Christian. That was absolutely right. I uninstalled/reinstalled the extension and now can see the drop down menu for the OCI account profile. (snippet below)

    Now, it appears to establish a connection to my instance (and to the boot volume attached to this instance), I have to establish a connection. After some Googling--I made the following equivalences:

    1) Port number: 1521 by default

    2) Username: website username

    3) Password: website password

    4) Database host name: Is this the tenancy?

    5) Service name: I'm not sure here. When logging in directly from the terminal, the only data points needed are the key, username (generally opc) and the IP address (generally XXX.XX.XXX.XX). All of these data points can be pulled from looking at the instance detail's on Oracle's website. It appears that the service name cannot be pulled from the website...I saw other users applying SQL code, but I was a bit lost about why we should use SQL code in the terminal.

    Thank you again!

  • Christian.Shay -Oracle
    Christian.Shay -Oracle Posts: 2,241 Employee
    edited Nov 12, 2021 7:27PM Answer ✓

    You can't use the Basic connection type with the cloud. It needs to use your wallet which is not possible there.

    Now that you got the install fixed, it is easiest to follow along my blog and use the Create Connection in Database Explorer menu item.

    This will open a prepopulated connection dialog and all you will need to do is choose a tns alias and provide the username and password.

    da bears
  • da bears
    da bears Member Posts: 9 Green Ribbon

    Thank you Christian. It's working beautifully now.