• 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
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

JDBC connectivity problem

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanx a lot for ur reply
ur right the ip address is wrong in the code
 
Ranch Hand
Posts: 112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Everybody's invited. Even this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic