Allam Rosaiah

Greenhorn
+ Follow
since Dec 25, 2011
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Allam Rosaiah

Hi,

m pasting java code below please observe clearly.type1 driver connecting db successfully ,but type4 is the problem creating.I started all the services in services area and global name is orcl also.please help to solve this problem.

try {
Class.forName("oracle.jdbc.driver.OracleDriver");
//Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
Connection con =DriverManager.getConnection("jdbc:oracle:thin:@172.20.10.51:1521:orcl","scott","manager");
// Connection con =DriverManager.getConnection("jdbc:odbc:arosa","scott","manager");
if(con!=null)
System.out.println("conection is connected");
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}



Error is :

java.sql.SQLException: Io exception: The Network Adapter could not establish the connection
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:111)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:145)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:254)





Hi i am connected spring to hibernate database is oracle.but whenever i used type 4 driver m getting like this exception.
java.sql.SQLException: Io exception: The Network Adapter could not establish the connection

But in type1 driver working fine may i know what is the reason.