User_DXS0C
 Posts: 3

 editado novembro 24

does anyone have a problem to create the connection in vs code?

Error: An error occurred when attempting to connect to the database.The following error occurred: ORA-12541: Cannot connect. No listener at host localhost port 1521. (CONNECTION_ID=ihIJSm01TnOkCpkR0vEX/w==) https://docs.oracle.com/error-help/db/ora-12541/.Consult your database documentation for information on how to resolve the specified error code


cunhaengineer 

The error ORA-12541: No listener means that the Oracle Net Listener is not running on the specified host and port. Here’s how to resolve this issue:

Steps to Fix ORA-12541 in VS Code

Verify Listener Status: lsnrctl status

  • Check Listener Configuration

Open the listener.ora file located in the $ORACLE_HOME/network/admin directory.

LISTENER = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521)) ) )

  • Ensure the Database Is Running
  • Verify Connection String in VS Code

Testing the Connection

After making these changes, test the connection in VS Code:

  1. Open the database connection interface in VS Code.
  2. Reconfigure the connection with the updated host, port, and service name.
  3. Click Connect to verify the setup.

Discussion: https://community.oracle.com/ou/discussion/comment/24370#Comment_24370