Had Oracle8i database and Tomcat servlet on the same machine working
with the thin driver for Java 1.4. Brought up a cluster on two other
machines keeping the servlet (and 8i) on the original machine. When I
try to connect to the cluster I get "Connection refused" or "Oracle not
available" depending on which values I use for sid and hostname.
I'd post the code but I dont have it here at home - no newsgroups at work.
Chuck
IIRC there is a bug with 9i which might cause ORA-600 when connecting with
a pre-9i jdbc-driver. I haven't checked lately, but this should be fixed with
the latest patchset for 9i.
Check if setting event 10841 helps, but you're better off using the 9i JDBC
driver.
HTH
Holger
Thanks, I used the latest from technet. I think before that I used the
one from the patched 9i. I'll hunt for a later version. I'm getting a
12505. If anything else comes to you please let me know.
Thanks
Chuck
Here is more detail:
All machines are Windows 2000 and the latest technet download
ojdbc14.jar and Jdk 1.4.2_01.
We had one server machine with Oracle8i, Apache Web Server and Apache
Tomcat. Servlets used the thin jdbc driver to connect to Oracle to
retrieve data. Evertything was on one machine.
We brought up a RAC cluster (9i Release 2) on two additional machines
and moved one system (of three) from the 8i box to the cluster.
The Tomcat stayed where it was, so now it must connect to the cluster
(different machine/host).
I changed the host and service name in my Java code but I cannot
connect. I get Oracle not available or connection refused. I also tried
using the form "jdbc:oracle:thin:@(DESCRIPTION..."
Below are two of the tnsnames file entries generated during install on
one of the RAC servers:
SHFC =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = shf.spawar.navy.mil)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = shf2.spawar.navy.mil)(PORT = 1521))
(LOAD_BALANCE = yes)
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = shfc)
)
)
SHFC1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = shf.spawar.navy.mil)(PORT = 1521))
(CONNECT_DATA =
(SERVICE_NAME = shfc)
(INSTANCE_NAME = shfc1)
)
)
============== Test program
import java.sql.*;
class Simple extends Object {
public void go(String args[]) {
String driverName = "oracle.jdbc.driver.OracleDriver";;
String dBOptions =
"jdbc:oracle:thin:@shf.spawar.navy.mil:1521:shfc"; // Tried shfc and shfc1
Connection conn = null;
try {
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
conn = DriverManager.getConnection(dBOptions, args[0], args[1]);
System.out.println("connected: " + dBOptions + "\n\n\n");
} catch(Exception ex) {
System.out.println("Not connected: " + dBOptions + "\n\n\n");
ex.printStackTrace();
}
return;
}
public Simple(String args[]) {
go(args);
}
public static void main(String args[]) {
System.out.println("Starting Simple...");
Simple mainFrame = new Simple(args);
}
}
============== output:
java.sql.SQLException: Io exception: Connection
refused(DESCRIPTION=(TMP=)(VSNNU
M=153092864)(ERR=12505)(ERROR_STACK=(ERROR=(CODE=12505)(EMFI=4))))
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:334)
at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:418)
at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.ja
va:521)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:325)
at java.sql.DriverManager.getConnection(DriverManager.java:512)
at java.sql.DriverManager.getConnection(DriverManager.java:171)
at Simple.go(Simple.java:26)
at Simple.<init>(Simple.java:35)
at Simple.main(Simple.java:40)
Press any key to continue...
Chuck
I found a patch with files dated 10/10/2003. I'll try it
Chuck
I finally got it working with a newer driver from Metalink. It was
dated October 2003. Had to use the syntax that sends the text from the
body of the entry in the tnsnames.ora file. Took much grief.
Thanks
Chuck
your tns attempts for a thin driver are pointless, since thin doesn't
see your tns file.
Note:247135.1
Subject: How to Implement Load Balancing With RAC Configured System
Using JDBC
Type: BULLETIN
Status: UNDER_EDIT
Content Type: TEXT/PLAIN
Creation Date: 27-AUG-2003
Last Revision Date: 27-AUG-2003
*** This article is being delivered in Draft form and may contain
errors. Please use the MetaLink "Feedback" button to advise Oracle of
any issues related to this article.
*** PURPOSE ------- This document discusses how to implement load
balancing from a JDBC application that connects to a RAC configured
system.
SCOPE & APPLICATION ------------------- This material is intended for
developers or analysts.
How to Implement Load Balancing With RAC Configured System Using JDBC
---------------------------------------------------------------------
url="jdbc:oracle:thin:@(DESCRIPTION= (LOAD_BALANCE=on)
(ADDRESS=(PROTOCOL=TCP)(HOST=host1) (PORT=1521))
(ADDRESS=(PROTOCOL=TCP)(HOST=host2)(PORT=1521))
(CONNECT_DATA=(SERVICE_NAME=service_name)))"
or
url="jdbc:oracle:thin:@(DESCRIPTION=
(ADDRESS=(PROTOCOL=TCP)(HOST=cluster_alias) (PORT=1521))
(CONNECT_DATA=(SERVICE_NAME=service_name)))"