File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Oracle/OAS and the fly likes Accessing oracle from remote machine Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Products » Oracle/OAS
Bookmark "Accessing oracle from remote machine" Watch "Accessing oracle from remote machine" New topic
Author

Accessing oracle from remote machine

Angela lewis
Ranch Hand

Joined: Mar 01, 2004
Posts: 100
I am running a JSP application on Tomcat Server with oracle 8i as database.
Oracle server is maintained on a seperate machine and all the developers access the same Oracle server for developing while they have tomcat installed seperately on their respective machines.
If i install tomcat on the machine in which oracle is installed and try to access oracle using the following code in my JSP, it works perfectly fine.
Class.forName("oracle.jdbc.driver.OracleDriver");
return DriverManager.getConnection ("jdbc racle:thin:@127.0.0.1:1521 rcl", "scott", "tiger");
But if the same code(changing the ip to oracle server's id, so the code would be
return DriverManager.getConnection ("jdbc racle:thin:@192.168.27.32:1521 rcl", "scott", "tiger");
), is used by a developer in his JSP using his local tomcat server and trying to access the orace server, she gets the following error.
java.sql.SQLException:Io Exception: The Network adapter could not establish a connection.
What we want to acheive is that although every developer has a web server seperately on her machine, the oracle server should be installed on only one machine and each developer should access that for developing her JSP application.
Thanks
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17249
    
    6

Each machine needs the Oracle client installed on it. Then you put your server information into your tnsnames.ora file. Then everyone will be able to access the Oracle server. You can ask your DBA for help on this.
Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
SJ Adnams
Ranch Hand

Joined: Sep 28, 2001
Posts: 925
are you running oracle personal edition? if so you cant connect from other boxes.
Angela lewis
Ranch Hand

Joined: Mar 01, 2004
Posts: 100
<quote>
are you running oracle personal edition? if so you cant connect from other boxes
</quote>
No I am using Oracle 8i Enterprise Edition
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30057
    
149

Angela,
Do you have a firewall that could be blocking the ports?


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Angela lewis
Ranch Hand

Joined: Mar 01, 2004
Posts: 100
Thanks everyone for replying.
No I don't have a firewall installed.
Is installing the Oracle clients the only way, can't it be done without that?
If i do install Oracle client what else needs to be done after that?
SJ Adnams
Ranch Hand

Joined: Sep 28, 2001
Posts: 925
make sure you can ping the boxes (i.e. check subnet masks), check the listener is running, check with sqlplus..
you dont need sqlnet (i.e. oracle client) or tnsnames.ora installed & setup to use the thin driver (just the classes12.zip) like you are doing.
maybe have a look at the 'ask tom' website for more ideas.
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17249
    
    6

"you dont need sqlnet (i.e. oracle client) or tnsnames.ora installed & setup to use the thin driver (just the classes12.zip) like you are doing."
That is true. I forget that that is the wonder of the thin driver, in that you don't need to install the client on the clients.
SJ has very good suggestions.
Here is the link to Ask Tom.
Mark
Brahim Bakayoko
Ranch Hand

Joined: Aug 29, 2003
Posts: 155
Originally posted by Angela lewis:
Thanks everyone for replying.
No I don't have a firewall installed.
Is installing the Oracle clients the only way, can't it be done without that?
If i do install Oracle client what else needs to be done after that?


You don't have to install any oracle client as you are using only jdbc.
Make sure the remote machine is accessible.
Did you ping?


SCJP, SCWCD, SCBCD, IBM CSD WebSphere v5, <br />A+, MCP 2000 and 2000 server, CST, and few incompleted certification tracks.<br /> <br />Ivory Coast<br /> <br />Analyze your web Request/Response @ <a href="http://webtools.servehttp.com" target="_blank" rel="nofollow">http://webtools.servehttp.com</a> down for a while...
Angela lewis
Ranch Hand

Joined: Mar 01, 2004
Posts: 100
Did u Ping

Yes i did ping and it pings fine.
SJ Adnams
Ranch Hand

Joined: Sep 28, 2001
Posts: 925
do a "netstat -a" & make sure oracle is listening on port 1521
do you have some sort of personal firewall running?
Angela lewis
Ranch Hand

Joined: Mar 01, 2004
Posts: 100

do a "netstat -a" & make sure oracle is listening on port 1521

I did netstat -a and oracle is listeneing on port 1521
do you have some sort of personal firewall running?

No i have no firewall running
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Accessing oracle from remote machine
 
Similar Threads
Oracle JDBC
TNSAddress.SOException
getting connection
JSP cannot connect to Oracle on remote machine
Newbie: How doy I connect to Oracle Using JDBC