Win a copy of Soft Skills: The software developer's life manual this week in the Jobs Discussion forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem connecting to database

 
Mathews P Srampikal
Ranch Hand
Posts: 211
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I am getting the following exception while connecting to databse.

1. driver is loaded
2. Database server is running
what can be the problem. i gave ip address instead of machine name in place of URL

the code is:

Class.forName("oracle.jdbc.driver.OracleDriver");//works fine
System.out.println("Oracle driver loaded: ");
Connection conn = DriverManager.getConnection ("jdbcracle:thin:@mats:1521:ORCL", "system", "orcl");
System.out.println("Connecting to oracle database: ");

The Exception is:

java.sql.SQLException: Io exception: The Network Adapter could not establish the connection
 
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper
Posts: 4968
1
Hibernate Spring Tomcat Server
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you ping the IP address and connect on that port? You might have a proxy or something blocking that port. Any firewalls?

-Cameron McKenzie
 
Avi Abrami
Ranch Hand
Posts: 1141
1
Java Oracle
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mathews,
When I did an Internet search on your error message I got over 4,000 hits.
Did none of them answer your question?
The cause of the error is usually one (or more) of the following:
  • Database server is not running.
  • Database connection listener is not running.
  • Connection URL is incorrect.

  • Check first one via SQL*Plus.
    Check second one via "lsnrctl" utility.
    Refer to documentation for correct syntax of third one and then check TNS configuration to verify the correct parameters required.

    Good Luck,
    Avi.
     
    Don't get me started about those stupid light bulbs.
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic