Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Exception while testing JDBC connection

 
somashaker goud
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Below is my sample code to test JDBC connection. Earlier it used to work.




but i dont know what went wrong I am getting below exception.

 
Paul Clapham
Sheriff
Posts: 21961
36
Eclipse IDE Firefox Browser MySQL Database
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Line 11 says "I'm going to use Sun's antique JDBC-ODBC driver".

Line 13 says "Connect to that driver using this Oracle JDBC URL".

Evidently the JDBC-ODBC driver doesn't understand what to do with that, so it throws an exception. I'd suggest choosing one driver or the other and writing the appropriate code for that driver.

(And it isn't clear to me what part Spring plays in this problem, so I'll put the post into the JDBC forum as well. It might get better answers there.)
 
somashaker goud
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Paul for your help !
 
Dave Tolls
Ranch Hand
Posts: 2369
25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As Paul says, that driver hasn't seen any work done on it for over 15 years, and even then it was only intended as an example of a JDBC Driver and not really supposed to be used.

Any modern database has a JDBC Driver written specifically for it, so you should always find the driver related to the db you are using.
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!