• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

Problem connecting to database

 
Ranch Hand
Posts: 211
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ("jdbc:oracle: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
 
author and cow tipper
Posts: 5009
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 1143
1
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
    reply
      Bookmark Topic Watch Topic
    • New Topic