Home » Developer & Programmer » JDeveloper, Java & XML » java.sql.SQLException: Io exception: Undefined Error (JDBC with RAC Oracle Cluster)
java.sql.SQLException: Io exception: Undefined Error [message #289096] Wed, 19 December 2007 12:29
rlear
Messages: 1
Registered: December 2007
Location: Toronto, Canada
Junior Member
Hi all.

This post is to document an otherwise frustrating problem when connecting to a RAC system when you have a broken URL for the JDBC connection.

I have spent some hours trying to track down what the problem was, and, having found it, and finding no other references to it in Google, I decided it should be published somewhere that Google indexes ....

Using the Oracle Net connection descriptor style for a JDBC URL you have a URL of the form:

jdbc:oracle:thin:@(DESCRIPTION= (LOAD_BALANCE=on)
(FAIL_OVER=on)
(ADDRESS=(PROTOCOL=TCP)(HOST=host01-vip)(PORT=1521))
(ADDRESS=(PROTOCOL=TCP)(HOST=host02-vip)(PORT=1521))
(CONNECT_DATA=(SERVICE_NAME=DEVRAC)) )

We are just busy building our first RAC system, and, to test how our existing code interacts with the system I typed in the following URL using just one of the RAC Nodes:

jdbc:oracle:thin:@(DESCRIPTION= (LOAD_BALANCE=on)
(FAIL_OVER=on)
(ADDRESS=(PROTOCOL=TCP)(HOST=host01-vip)(PORT=1521))
(CONNECTDATA=(SERVICE_NAME=DEVRAC)) )

Note how I mis-typed the URL and used CONNECTDATA instead of CONNECT_DATA You can mis-spell any other parameter, but if you get CONNECT_DATA wrong then you get this 'Undefined Error'

Using the above *broken* URL you get the not-so-useful exception trace (note: if you have more than one Address configured you get a different exception):

Exception in thread "main" java.sql.SQLException: Io exception: Undefined Error
        at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:145)
        at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:190)
        at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:363)
        at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:401)
        at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:466)
        at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:165)
        at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:35)
        at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:839)
        at java.sql.DriverManager.getConnection(DriverManager.java:562)
        at java.sql.DriverManager.getConnection(DriverManager.java:186)
        at rac.main(rac.java:15)


Hopefully this will save someone a few hours in the future as they try to resolve a frustrating exception. For the record, here's the exception trace you get with two addresses configured, but with a mis-typed CONNECTIONDATA

Exception in thread "main" java.sql.SQLException: Io exception: End of TNS data channel
        at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:145)
        at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:190)
        at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:363)
        at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:401)
        at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:466)
        at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:165)
        at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:35)
        at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:839)
        at java.sql.DriverManager.getConnection(DriverManager.java:562)
        at java.sql.DriverManager.getConnection(DriverManager.java:186)
        at rac.main(rac.java:15)


Rolf
Previous Topic: ClassNotFound exception (split topic)
Next Topic: extract data
Goto Forum:
  


Current Time: Sun Dec 11 06:36:45 CST 2016

Total time taken to generate the page: 0.04345 seconds