• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

On connection: Array Index Out Of Bounds Exception: 4

 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When I try to connect to our Oracle Database, I am getting this exception:


Below is my code:


open is called by this code:

Where myhost, mydomain, and myport are something reasonable.

Any suggestions as to how I might go about debugging this problem? I saw the exact same problem described at an Oracle forum, but no one replied to the post.

Deb
 
Marshal
Posts: 79179
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
At least somebody will reply here.

I can't see anything which is likely to throw an out of bounds exception here.
Are you passing any arrays to anything which might pass them to T4C8 etc?
Are you passing any multiple parameters (look for an ellipsis ... in the last parameter of any methods you are calling)? It

Put your entire code onto an IDE like Eclipse. Run it until you get the same exception. When you get the stack trace, it has the lines underlined; they are rather like hyperlinks. If you click one of the hyperlinks in your stack trace, you might get sight of the original code.

Sorry I can't help any more. Try those things, and when they don't work, maybe somebody else will know what to do.
 
deb platt
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It appears that the problem was due to using the wrong release of Oracle's JDBC thin drivers. I am trying to connect to an Oracle8 RDMS. If I compile the above code with java1.5, I thought I should use Oracle's ojdbc5.jar for the drivers, as Oracle says these are the drivers corresponding to java1.5. So that's what I did.

I returned to the Readme.txt that was included in my download for ojdbc5.jar. It said that the package oracle.jdbc.driver has been removed in JDBC 11R1 (which is ojdbc5.jar). If you note above, I was using this package in the statement which loaded the driver:

According to Readme.txt, I should be able to fix the problem by replacing oracle.jdbc.driver with oracle.jdbc. I tried the following code:

However I still got ArrayIndexOutOfBoundsException: 4. I then tried using the DataSource method for opening a connection:

However, this threw an ORA-12514 exception saying that the listener didn't know the requested service. In the event that I was doing something syntactically wrong, I tried using ods.setServerName, ods.setPortNumber, and ods.setDatabaseName, but this time I got an exception saying that Oracle didn't know how to make the URL.

I am not sure if it is even possible to use ojdbc5.jar with oracle8, or whether I am making some error in my code. However if I use the originally posted code and instead use classes12.zip or classes111.zip, everything works fine. So for the time being I am going back to these earlier releases of Oracle's JDBC drivers.
[ March 05, 2008: Message edited by: deb platt ]
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic