• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JDBC connectivity problem

 
kiruthika raghunathan
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I dont have the client application Oracle in my sys.
If i use oracle thin jdbc it is not necessary to have oracle in the ys.
i downloaded the driver ojdbc14.jar from the site
i donno whether i have to include anything in the class path
and my code is
import java.sql.*;
import java.io.*;
import java.util.*;
public class OraTest
{

public static void main(String args[])
{
try{
String User="scott";
String Passwd="tiger";
String OraConStr = "jdbc racle:thin:scott/tiger@(description=(address_list=(address=(protocol=tcp)(host=192.168.4.45)(port=1521)))(connect_data=(SERVICE_NAME = test)))";
StringBuffer stbTmp = new StringBuffer();
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
Connection OraCon=DriverManager.getConnection(OraConStr,User,Passwd);
System.out.println("Connected to Oracle");
}
catch(Exception ex)
{
System.out.println(ex);
}
}
}
If i run this iam getting some run time exception
java.sql.SQLException: Io exception: The Network Adapter could not establish the connection
wat is the problem?
 
Joe Ess
Bartender
Posts: 9312
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by kiruthika raghunathan:

java.sql.SQLException: Io exception: The Network Adapter could not establish the connection
wat is the problem?

Make sure 192.168.4.45 is the right IP address for the Oracle server, that you can ping that IP, that the port you have specified is the correct one for the Oracle DB, and that the service name you have specified exists.
 
kiruthika raghunathan
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanx a lot for ur reply
ur right the ip address is wrong in the code
 
Kay Liew
Ranch Hand
Posts: 112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good to hear that you have solve the problem. The error message can also means your services did not started properly. Either the TNSagent or the database services.
EQ
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic