Win a copy of React Cookbook: Recipes for Mastering the React Framework this week in the HTML Pages with CSS and JavaScript forum!
  • 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
  • Ron McLeod
  • Paul Clapham
  • Rob Spoor
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Tim Holloway
  • Piet Souris
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Frits Walraven
  • Himai Minh

Help with accessing a table in Oracle 11g with Java Eclipse

 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I was trying to connect to an Oracle database 11g table via Eclipse.

When I enter values in the search box created I am getting exception handling errors.

I have attached a copy of the exception handling messages. I would really appreciate any tips anyone can give if you have the time.
Thank you.
Exception-Handler-messages-part-1.jpg
[Thumbnail for Exception-Handler-messages-part-1.jpg]
Exception handling message part 1W
Exception-Handler-messages-part-2.jpg
[Thumbnail for Exception-Handler-messages-part-2.jpg]
Exception handling message part 2
 
Ranch Hand
Posts: 2410
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
are you sure the connection is being established? It looks like conn may be null
 
C C Campbell
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I believe that is the issue as well Keith I was not sure how to connect? I also had an error message that I ignored because I am not using Git that said that my Home variable was not set. Would that effect this in anyway?
 
Keith Lynn
Ranch Hand
Posts: 2410
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm not sure about the git message.

Can you double-check you have the correct URL for connecting to Oracle?
 
C C Campbell
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I will double check thank you
 
Rancher
Posts: 4801
50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
All these things in your catch blocks:

should be replaced by something like:


At the moment you are losing all the information about what exception has been thrown and from where, and why.

In some of these case (especially the stuff around the start up), until you have something for presenting a nice failure screen to the user you may as well crash out completely, as you need the connection to actually do anything useful.
 
C C Campbell
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I will try that, thank you Dave.
 
Bartender
Posts: 3648
16
Android Mac OS X Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's in the connection url, depending on whether you using service name or SID. Assuming both is "xe"



Also if you using JDBC 4 technically the Class.forName is not needed. By the way, even this line is wrong
Class.forName("oracle.jdbc.OracleDriver") or Class.forName("oracle.jdbc.OracleDriver").newInstance()


 
C C Campbell
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you K. Tsang
 
C C Campbell
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
New errors the url I tried but the driver error is still present I was told to build a path and add a class12.jar but that jar class does not support java 1.8 do you know another jar file to add that will work instead?
Compilation-errors.jpg
[Thumbnail for Compilation-errors.jpg]
 
Marshal
Posts: 26749
81
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't know where you got that advice; my web search keywords were oracle 11g jdbc driver, which led me directly to this official Oracle page. I'm not an Oracle expert and you're the one with the Oracle database so I will leave you to choose (and download, if necessary) the driver suitable for your needs.
 
C C Campbell
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Paul it was part of the original instructions I received, apparently it was for an older version I tried the suggested jars under the link you provided initially and decide to go with what was originally requested when I still had errors. Thanks though
 
Paul Clapham
Marshal
Posts: 26749
81
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ah, okay, I didn't realize you had instructions about which driver to use. But if that was the case you should just have gone back to the person instructing you with your problem. Would have been more straightforward, no?
 
C C Campbell
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Apparently I was in the wrong forum for this topic. Thank you all for your helpful and kind comments it turns out it was less of a driver issue and more of an Eclipse issue. I appreciate your help.
 
There's a city wid manhunt for this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic