bhagavatula indu sekhar

Ranch Hand
+ Follow
since Sep 17, 2006
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 bhagavatula indu sekhar

please tell me about the URL component in getConnection method.
in our college we have installed Oracle 9i.
if that is the case classes12.zip must be included in the classpath as i found it from other sites


what should be the url arguement to getConnection() method.
DriverManager.getConnection(url,user_name,password);

Oracle has been installed in E drive.
E:\Oracle
when i searched for jar files in my Oracle directory,i found these two jar files

1)i18n
2)rt

both of these are in E:\ORANT\JRE11\lib

i set the classpath as .;E:\jsdk2.1\servlet.jar;E:\jsdk2.1\server.jar;E:\ORANT\JRE11\lib\i18n.jar;E:\ORANT\JRE11\lib\rt.jar

when i ran the code the output is

java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at Oracle_dbconnectivity.<init>(Oracle_dbconnectivity.java:21)
at Oracle_dbconnectivity.main(Oracle_dbconnectivity.java:16)
i am sorry but the file jdbcodbc.dll is located in E:\ORANT\JRE11\bin folder.
i set the classpath to E:\ORANT\JRE11\bin

still the problem continues even after adjusting the classpath.now how should i connect to the database?
i forgot to mention that classpath variable is set to E:\ORANT\bin where jdbcodbc.dll is located.
i am expected to connect to database and for that purpose the following program is written.

import java.io.*;
import java.util.*;
import sun.jdbc.*;

public class Oracle_dbconnectivity {

public static void main(String[] args) {
new Oracle_dbconnectivity();
}

public Oracle_dbconnectivity(){
try{
Class.forName("oracle.jdbc.driver.OracleDriver");
System.out.println("Driver Registered");

System.exit(0);

}
catch(ClassNotFoundException cnfe){
cnfe.printStackTrace();
System.exit(-1);
}
}
}


Output :java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at Oracle_dbconnectivity.<init>(Oracle_dbconnectivity.java:21)
at Oracle_dbconnectivity.main(Oracle_dbconnectivity.java:16)

the version of oracle 8 is used . it is installed in E: drive.\\
"when i searched for the file java1java2 i found jdbc\odbc:" .
from file called jdbcodbc.dll which is present in E:\ORANT\BIN
but still the exception continues.

now do i connect to the database.


so how should i solve this problem.
i am expected to get the domain names of servers that are connected to Internet and keep them in a database.

it has been suggested by some members of this forum to make use of InetAddress class.

so just to test and know how to use InetAddress i wrote the following program
the jdk kit i have is jdk6.0

i need some clarifications about the output of the program.



import java.io.*;
import java.net.*;
import javax.swing.*;

public class Inetdemo {

public static void main(String[] args) {
Inetdemo in=new Inetdemo();

}
public Inetdemo(){
String site_name=JOptionPane.showInputDialog("Enter a site name");// accepts input the site name
try{

InetAddress inet=InetAddress.getByName(site_name);
System.out.println("Host name is "+inet.getHostName()+"\nHost Address is "+inet.getHostAddress()+"\nCanonical host name is "+inet.getCanonicalHostName());
}
catch(UnknownHostException ue){
ue.printStackTrace();
System.out.println("HostERROR!");
}
catch(Exception e){
e.printStackTrace();
System.out.print("Exception");
}
}
}


when the input to the program is

a) google.com the output is
Host name is google.com
Host Address is 64.233.187.99
Canonical host name is jc-in-f99.google.com

b) www.google.com the output is
Host name is www.google.com
Host Address is 216.239.37.99
Canonical host name is va-in-f99.google.com

c) 216.239.37.99 the output is
Host name is va-in-f99.google.com
Host Address is 216.239.37.99
Canonical host name is va-in-f99.google.com


doubt 1)
why is the address value is different when the input is google.com from that of www.google.com?

doubt 2)
what is the difference between getCanonicalHostName() and getHostName() methods?
i am expected to get the domain names of servers that are connected to Internet and keep them in a database.

it has been suggested by some members of this forum to make use of InetAddress class.

so just to test and know how to use InetAddress i wrote the following program
the jdk kit i have is jdk6.0

i need some clarifications about the output of the program.



import java.io.*;
import java.net.*;
import javax.swing.*;

public class Inetdemo {

public static void main(String[] args) {
Inetdemo in=new Inetdemo();

}
public Inetdemo(){
String site_name=JOptionPane.showInputDialog("Enter a site name");// accepts input the site name
try{

InetAddress inet=InetAddress.getByName(site_name);
System.out.println(inet.getHostName()+" "+inet.getHostAddress()+" "+inet.getCanonicalHostName());
}
catch(UnknownHostException ue){
ue.printStackTrace();
System.out.println("HostERROR!");
}
catch(Exception e){
e.printStackTrace();
System.out.print("Exception");
}
}
}

doubt1 )

when the input to the program is
the problem is with proxy server connection.
by changing the proxy server connection, the problem is solved.

thank you very much for your guidance.
i am sorry Joe Ess.
i will not repeat this again.

i will continue the dialog under this post itself with you.
i am sorry Joe Ess.
i will make sure that it will never happen again.
i will continue the dialog using the previous post itself

"problem with proxy server".
the program written is working at home but not in college.

the program takes in a URL of a web-page as input.
the program is expected to retrieve the content of a web-page which is then further analysed to find the emailids present in that web-page.

the web-pages present on the local hard disk are retrieved properly but when the URL is over Internet ex: http://google.com it is not working.

the college provides us Internet Service through a proxy server.
we are working on JDK6.0 kit and Windows XP SP2 Operating System.we are developing this application under eclipse2.0 IDE tool.
the college system has Pentium processor and 256MB RAM.

can you please help me in solving this problem?

Proxy Server settings :


method 1)
proxy server's address is 132.200.13.2
it is set using setProperty method.
proxy server's port is 80

method 2)
passing arguement to "java" command

java -Dhttp.proxyHost=132.200.13.2 -Dhttp.proxyPort=80 URLdemo

when either of the one is used the message i am getting error


the program is as follows

import java.net.*;
import java.io.*;
import javax.swing.*;

public class URLdemo {
URL url;
public static void main(String[] args) {
URLdemo ur=new URLdemo();
ur.getContent();
}


public void getContent(){

System.setProperty("http.proxyHost","132.200.13.2");
System.setProperty("http.proxyPort","80");
String sa=System.getProperty("http.proxyHost");
System.out.println(sa);


try{
url=new URL(JOptionPane.showInputDialog("Enter url"));
BufferedInputStream is=new BufferedInputStream(url.openStream());
String s="";
while( is.available() != 0 ){
s+=(char)is.read();
}
System.out.println(s);
}
catch( MalformedURLException murle){
System.out.println("URL error!");
murle.printStackTrace();
System.exit(-1);
}
catch( IOException ioe){
ioe.printStackTrace();
System.out.println("IOError!");
System.exit(-1);
}
catch( Exception e){
e.printStackTrace();
System.out.println("Error!");
System.exit(-1);
}
}
}



output along with stack trace

132.200.13.2
java.net.SocketException: Unexpected end of file from server
at sun.net.www.http.HttpClient.parseHTTPHeader(Unknown Source)
at sun.net.www.http.HttpClient.parseHTTP(Unknown Source)
at sun.net.www.http.HttpClient.parseHTTPHeader(Unknown Source)
at sun.net.www.http.HttpClient.parseHTTP(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at URLdemo.getContent(URLdemo.java:29)
at URLdemo.main(URLdemo.java:17)
IOError!
the program written is working at home but not in college.

the program takes in a URL of a web-page as input.
the program is expected to retrieve the content of a web-page which is then further analysed to find the emailids present in that web-page.

the web-pages present on the local hard disk are retrieved properly but when the URL is over Internet ex: http://google.com it is not working.

the college provides us Internet Service through a proxy server.
we are working on JDK6.0 kit and Windows XP SP2 Operating System.we are developing this application under eclipse2.0 IDE tool.
the college system has Pentium processor and 256MB RAM.

can you please help me in solving this problem?

Proxy Server settings :


method 1)
proxy server's address is 132.200.13.2
it is set using setProperty method.
proxy server's port is 80

method 2)
passing arguement to "java" command

java -Dhttp.proxyHost=132.200.13.2 -Dhttp.proxyPort=80 URLdemo

when either of the one is used the message i am getting error


the program is as follows

import java.net.*;
import java.io.*;
import javax.swing.*;

public class URLdemo {
URL url;
public static void main(String[] args) {
URLdemo ur=new URLdemo();
ur.getContent();
}


public void getContent(){

System.setProperty("http.proxyHost","132.200.13.2");
System.setProperty("http.proxyPort","80");
String sa=System.getProperty("http.proxyHost");
System.out.println(sa);


try{
url=new URL(JOptionPane.showInputDialog("Enter url"));
BufferedInputStream is=new BufferedInputStream(url.openStream());
String s="";
while( is.available() != 0 ){
s+=(char)is.read();
}
System.out.println(s);
}
catch( MalformedURLException murle){
System.out.println("URL error!");
murle.printStackTrace();
System.exit(-1);
}
catch( IOException ioe){
ioe.printStackTrace();
System.out.println("IOError!");
System.exit(-1);
}
catch( Exception e){
e.printStackTrace();
System.out.println("Error!");
System.exit(-1);
}
}
}



output along with stack trace

132.200.13.2
java.net.SocketException: Unexpected end of file from server
at sun.net.www.http.HttpClient.parseHTTPHeader(Unknown Source)
at sun.net.www.http.HttpClient.parseHTTP(Unknown Source)
at sun.net.www.http.HttpClient.parseHTTPHeader(Unknown Source)
at sun.net.www.http.HttpClient.parseHTTP(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at URLdemo.getContent(URLdemo.java:29)
at URLdemo.main(URLdemo.java:17)
IOError!
14 years ago
yes i am able to view the page through web browser IE.
output along with stack trace

132.200.13.2
java.net.SocketException: Unexpected end of file from server
at sun.net.www.http.HttpClient.parseHTTPHeader(Unknown Source)
at sun.net.www.http.HttpClient.parseHTTP(Unknown Sou