Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Accessing oracle from remote machine

 
Angela lewis
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
SJ Adnams
Ranch Hand
Posts: 925
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
are you running oracle personal edition? if so you cant connect from other boxes.
 
Angela lewis
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<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
author & internet detective
Marshal
Posts: 34375
345
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Angela,
Do you have a firewall that could be blocking the ports?
 
Angela lewis
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 925
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"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
Posts: 155
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Angela lewis
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did u Ping

Yes i did ping and it pings fine.
 
SJ Adnams
Ranch Hand
Posts: 925
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic