Oracle Corporation has released a free 100% JAVA driver. It is available at their Web site. According to the security rule, the Oracle server must be on the same machine as the Web server, since the communication with the Applet is done through Sockets. This is not always possible, so you will need something called a Connection Manager (from Oracle) or DBAnywhere from Symantec (demo version available for testing) to act as a bridge between the client, the Web server and the Database server.
import java.sql.*; public class connectToOracle extends java.applet.Applet { Driver driver; Connection conn = null; static String driverUsed = "oracle.jdbc.driver.OracleDriver"; static String serverAddress = "jdbc:oracle:thin:scott/tiger@www.myCompany.com:1243:myInstance"; // jdbc:oracle:thin is the driver used // scott/tiger is user/password // www.myServer.com is the same machine from where the Applet was loaded // 1234 is the port used // myInstance is where my data is public void init(){ makeConnection(serverAddress); } public void makeConnection(String svr) { try { System.out.println("Loading ... " + driverUsed); driver = (Driver)Class.forName(driverUsed).newInstance(); System.out.println("Connecting ... " + svr); conn = DriverManager.getConnection(svr); System.out.println("Ready."); } catch (Exception e) { e.printStackTrace(); } } } |
Also check the parameter sqlnet.expiretime in the SQLNET.ORA file, if there is one try to remove it or increase the value (Oracle 7.3).