0

Hello I got stuck in below scenarios. I have a method(Insert_values) in my java program that will get database connection & store the value in Database connection. Scenario 1 : If i ran the method by creating main function in that class (as a java application) no error its connected with database & store the value in DB Scenario 2: If i ran the same in server its given No suitable driver found for jdbc:oracle while calling that particular method(Insert_values).

Server Name -Tomcat8.0

API - Ojdbc14

Can any one give me solution for this scenario.

William Robertson
  • 15,273
  • 4
  • 38
  • 44

1 Answers1

1

You need to include the Oracle JDBC driver .jar file in the library path of your server, or if you're writing a web application (that's not clear from your question) include it in the .war file that you're building.

SeverityOne
  • 2,476
  • 12
  • 25
  • *that's not clear from your question* Then, you should have waited – Ravi Feb 01 '18 at 16:38
  • And does that invalidate the answer, you think? – SeverityOne Feb 01 '18 at 16:42
  • do you have complete understanding of what has happened in case 1 and case 2 ? If yes, then I don't have issue. If no, then your answer is completely on assumption – Ravi Feb 01 '18 at 16:47
  • As a matter of fact it *is* perfectly clear from the question. The OP mentioned Tomcat, so he can can only be writing a webapp. @Ravi – user207421 Feb 01 '18 at 17:10
  • True, I overlooked that. Still, you can still decide to put the Oracle driver into Tomcat's library directory. It'll save you a bit of memory and since JDBC is a tun-time dependency, it doesn't matter too much where you put it. – SeverityOne Feb 01 '18 at 20:52