Search code examples
connectionoracle-sqldeveloperbootcamp

Error when trying to create a new local connection in SQL Developer


I just recently installed SQL Developer on Bootcamp, and tried to create a new basic connection with the following attributes:

Connection name: conn1
Username: user1
Password: ****

Connection type: basic, Role: default
Hostname: localhost
Port: 1521
SID: xe

When tested, the error was: Network adapter could not establish the connection, no matter the type of role was given, or the type of authentication. I also tried entering IP as a hostname to replace localhost, and changing port. Still same issue.

Thanks.


Solution

    1. Hostname: localhost means that you connecting to your local database, and NOT remotely. For example, i you have created an instance on your laptop. If you have database in the server and just want to connect to it, then put the server hostname.

    2. SID: xe seems to be incorrect at first place. you must provide the correct SID that you provided while creating the instance. Once again, if you are connecting to remote database server, then give the SID of that database you are pointing to.

    3. You have not mentioned the database version. You should try using SERVICE_NAME. For example, in 12c, you connect using SERVICE_NAME.

    4. Use tnsnames.ora to connect to the remote database server. you will find it in $ORACLE_HOME/bin/network/admin/tnsnames.ora make sure it has proper connection and address details.