• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
C C Campbell
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • 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
 
Keith Lynn
Ranch Hand
Posts: 2409
  • Mark post as helpful
  • send pies
  • 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
  • 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: 2409
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
I will double check thank you
 
Dave Tolls
Ranch Hand
Posts: 2091
15
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
I will try that, thank you Dave.
 
K. Tsang
Bartender
Posts: 3583
16
Android Java
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
Thank you K. Tsang
 
C C Campbell
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • 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]
 
Paul Clapham
Sheriff
Posts: 21559
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • 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
  • 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
Sheriff
Posts: 21559
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • 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
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic