Oracle SQL Developer新建连接失败求助:Cannot create new connection
Hey there, sorry you're stuck with this connection issue—let's walk through the most common fixes to get you up and running.
1. Double-check your connection details (the #1 culprit!)
Small typos or mix-ups here are super common. Verify:
- Username/Password: Oracle credentials are case-sensitive if you enabled that during database setup—make sure you’re entering them exactly as configured.
- Hostname: For local databases, try
localhostor127.0.0.1instead of a network name if you’re having trouble resolving it. For remote servers, confirm the correct IP/hostname with your DBA. - Port: The default is
1521, but if your database uses a custom port, cross-check with your setup notes. - SID vs Service Name: Don’t confuse these two! Newer Oracle versions often use pluggable database service names (like
ORCLPDB1) instead of the traditional SID (ORCL). Try both if you’re unsure.
2. Confirm the Oracle Database & Listener are running
If your database isn’t active, you can’t connect at all:
- Windows: Open the Services app (search "Services" in the Start menu), look for
OracleService[YourDBName]andOracleOraDB[Version]Home1TNSListener—both should show "Running". - Linux/macOS: Run these terminal commands to check status:
# Check if the database is open sqlplus / as sysdba SQL> select status from v$instance; # Should return 'OPEN' # Check listener status lsnrctl status # Look for "READY" next to your database service entry
3. Ensure JDBC drivers are configured correctly
SQL Developer usually includes built-in drivers, but they might be missing or outdated for newer database versions:
- Go to Tools > Preferences > Database > Third Party JDBC Drivers in SQL Developer.
- If you don’t see an Oracle driver (named
ojdbc*.jar), add it manually. You can find this file in your Oracle database installation folder underORACLE_HOME/jdbc/lib.
4. Check firewall settings
If your database is on a remote server, your local firewall might be blocking port 1521. Temporarily disable your firewall (or add an exception for SQL Developer/Oracle’s port) to test if this is the issue.
5. Repair or reinstall SQL Developer
Corrupted installations can cause weird connection glitches:
- Uninstall SQL Developer completely, delete leftover folders (like
C:\Users\<YourName>\AppData\Roaming\SQL Developeron Windows), then download the latest version and reinstall. - Also, confirm you’re using a compatible Java version: SQL Developer 22+ requires Java 11 or higher. Check your version with
java -versionin terminal.
6. Test connectivity with TNSPing (Windows)
Run tnsping <your_service_name> in Command Prompt. If it returns "OK", your network connection to the listener is working. If not, your tnsnames.ora file (found in ORACLE_HOME/network/admin) might be misconfigured. A valid entry should look like this:
ORCL = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = ORCL) ) )
If none of these steps fix the problem, sharing the exact error message you’re seeing would help narrow things down even further!
内容的提问来源于stack exchange,提问作者Doonie Darkoo

