Forum Stats

  • 3,838,234 Users
  • 2,262,343 Discussions


Can't connect to Oracle Database via tnsnames on VS Code

User_ZQB2Q Member Posts: 2 Green Ribbon


I'm trying to connect to my company's enterprise Oracle database via VS Code but I keep getting the following error:

ORA-12545: Network Transport: Unable to resolve connect hostname

I'm on an Arm M1 Mac. To test my tnsnames configuration, I installed instant client drivers and SQL*Plus and I'm able to successfully connect to the database. I've put all the required wallet files along with sqlnet.ora and tnsnames.ora file under /Users/%USERPROFILE%/Oracle/network/admin folder. I've also set the environment variables $ORACLE_HOME, $TNS_ADMIN, $OCI_LIB_DIR, $OCI_INC_DIR, and DYLD_LIBRARY_PATH.

If I use SQL Developer, I don't need wallets or tnsnames as I'm using the jdbc connection string and this method also successfully connects to the database. Not sure if it's relevant, but my company uses Oracle Connection manager to avoid direct connections to the DB.

I'm guessing since I can successfully connect via SQL*Plus and SQLDeveloper, I'm missing some configuration in VS Code. I really like VS Code as my universal editor, so would like to configure it for Oracle DB.

I would be grateful if someone can help me solve this issue.


  • This error means that the connection is failing due to an underlying "failure to resolve" the hostname to the IP address. In most cases the issue resolves when the hostname is replaced with appropriate IP address.

    Try modifying the connect descriptor in tnsnames.ora to use the IP address rather than the hostname.

    Also, connecting with M1 and ODT VSCode requires .NET 6.0

    Please do a dotnet --info to make sure it is installed.

    Are you trying to connect to Oracle Autonomous DB?

  • User_ZQB2Q
    User_ZQB2Q Member Posts: 2 Green Ribbon

    Hi Christian,

    Thanks for your response and the suggestions that you provided. Unfortunately, changing to ip-address also doesn't resolve the issue. I'm still getting the same error.

    I checked the dotnet --info and the output suggests that my computer has the right .NET 6.0 and required SDKs.

    I'm trying to connect to an on-prem version of Oracle Exadata. Our DB team doesn't allow direct access to the database, which is controlled via Oracle Connection Manager (CMAN). CMAN is basically a proxy server that forwards connection requests to the database and operates on a session level. So the entires in the tnsnames.ora has the common name of CMAN server followed by DB hostname.

    Any follow-up suggestions based on the provided info?