This is how I did it for Oracle 8.1.6 access using JRun 3.0 servlet engine.
You need to install the Oracle Client Software (for the version of Oracle you
want to access) on the machine your servlets execute on. If you already have the
client installed then you can go to Oracle's web site for the JDBC driver you
want to use (I use the thin driver) and place the zip file downloaded in the
jdbc\lib directory. If you use the CD to install the 8.1.6 client it will
install the drivers in C:\Oracle\Ora81\jdbc\lib. This driver directory must be
added to the classpath of the servlet engine (assuming you want to access the
database by servlet).
If you didn't do it during Oracle Client software install, you will need to
create a net service name for your Oracle instance. You can do this by using the
Net8 Configuration Assistant. The server running the Oracle instance you want to
connect to must also have a TCP/IP listner active.
In your servlet code you will need at least the following:
try {
Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
con =
DriverManager.getConnection("jdbc:oracle:thin:@OraServerIPAddress:OraPort:OraServiceName",
"userid", "passwd");
}
catch(IllegalAccessException e) {
out.println("Couldn't load database driver: " + e.getMessage());
}
catch(InstantiationException e) {
out.println("Couldn't load database driver: " + e.getMessage());
}
catch(ClassNotFoundException e) {
out.println("Couldn't load database driver: " + e.getMessage());
}
catch(SQLException e) {
out.println("SQLException caught: " + e.getMessage());
}
finally {
try {
if (con != null) con.close();
}
catch (SQLException ignored) { }
}
}
Where:
OraServerIPAddress = IP Address of server running Oracle instance
OraPort = Port number of Oracle instance (not sure but this may be Port number
for Oracle TCP/IP listner. Accept default during Net8 Config)
OraServiceName = Service name you assigned to Oracle instance during Net8 Config
userid = Oracle userid
passwd = Oracle password
Good Luck
"<John Thomas>" <[EMAIL PROTECTED]>@JAVA.SUN.COM> on 09/22/2000 01:53:14 AM
Please respond to "A mailing list for discussion about Sun Microsystem's Java
Servlet API Technology." <[EMAIL PROTECTED]>
Sent by: "A mailing list for discussion about Sun Microsystem's Java Servlet
API Technology." <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
cc:
Subject: connection to oracle w\o using jdbc-odbc bridge
Hi,
Can some one tell me, how to make a connection to db in Oracle
w/o using jdbc-odbc bridge.
Pls also inform what are the components i would need & from where i
would get them
Thanking u
John Thomas
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html