• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 268
  • Last Modified:

Accessing Oracle Database from JAVA?

The setup is as follows:
The webserver (internet host server) is in the USA. There is a page for online resume.

The database server (Oracle 8) is in Bangalore, India.

Both these locations have a 64kbps leased line.

When the online resume page is accessed via internet and the resume is submitted after keying in all the details, the data keyed in should get inserted/updated into the database in Bangalore.

Is it possible?

If Yes, How to do it?

If No, any alternatives?
0
sunitha
Asked:
sunitha
1 Solution
 
Ravindra76Commented:

Hi, Try with this

 Class.forName("oracle.jdbc.driver.OracleDriver")

conn = DriverManager.getConnection
             ("jdbc:oracle:thin:@"+x.getOraIP()+":"+
                    x.getOraPort()+":"+x.getOraSID(),
                    x.getOraLogin(),    
              x.getOraPass());

x is a file where your will store private variables and public methods like

    private static String oracleServerIP = "xxx.xxx.xxx.xxx";
    private static String oraclePort = "1521";
    private static String oracleSID = "1521";
    private static String oracleLogin = "name"
    private static String oraclePassword = "password"




 public static String getOraIP(){
        return oracleServerIP;
    }

    public static String getOraPort(){
        return oraclePort;
    }

    public static String getOraSID(){
        return oracleSID;
    }

    public static String getOraLogin(){
        return oracleLogin;
    }

    public static String getOraPass(){
        return oraclePassword;
    }

   
0
 
sunithaAuthor Commented:
ravindra76:

I have this code with me already and it is working fine.

Let me make it clear to you that the database connection is via the internet from the USA server to my Bangalore server.

Technical details:
The web server and my servlet is on the USA server.

The Oracle database is here in Bangalore.

when I post the online form to my servlet, the details entered in the form should be saved in the oracle tables which is in Bangalore.

with the code u have given I should have a registered IP address for the machine on which the oracle server is installed.

If I have a registred IP address I am leaving the oracle server open to the internet which I dont want to do.
 
0
 
Ravindra76Commented:
You must have registered ip address for the oracle server.

The same thing. we are doing by putting oracel server in
one machine and webserver in another machine. both are
connected through internet 64kbps line. The servlet which is
invoked from the webserver with  some ipaddress,
will connect to database server through the oracleserver ip address and store the all details entered by the user .
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
Ravindra76Commented:
You must have registered ip address for the oracle server.

The same thing. we are doing by putting oracel server in
one machine and webserver in another machine. both are
connected through internet 64kbps line. The servlet which is
invoked from the webserver with  some ipaddress,
will connect to database server through the oracleserver ip address and store the all details entered by the user .
0
 
Ravindra76Commented:
You must have registered ip address for the oracle server.

The same thing. we are doing by putting oracel server in
one machine and webserver in another machine. both are
connected through internet 64kbps line. The servlet which is
invoked from the webserver with  some ipaddress,
will connect to database server through the oracleserver ip address and store the all details entered by the user .
0
 
heyhey_Commented:
>> If I have a registred IP address I am leaving the oracle server

you need either internet connection (registered IP address) or LAN connection (Oracle server is behind a firewall)
0
 
rsalgadoCommented:
Do you want the client (web browser) to save the data directly to the Oracle server? if so, you need to do just what your doing, (Oracle server will be open to internet, less some user id password).  

If you want no one to see the oracle server then you need a 3 tier system where the Browser talks to the oracle server through the web server. Only the web server makes the connections/insert/updates.

Sybase has somthing is its jconnect product which will relay to the server through the web server. This also helps with security issues and the sandbox.
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now