Win a copy of Bad Programming Practices 101 (e-book) this week in the Beginning Java forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

ojdbc netbeans error :No suitable driver found, jar already added  RSS feed

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Friends,
I am using Netbeans 8.2
Below is the code that I am using for a test program:


I have added ojdbc7 jar using project > properties > libraries > add jar/folder option

If I am executing my DAO class code using main method, It is able to connect to DB.
but when triggered by jsp > servlet > dao. It leads to below error:


Mar 03, 2018 12:47:22 PM org.apache.catalina.core.StandardContext reload
INFO: Reloading Context with name [/SimpleProject] has started
Mar 03, 2018 12:47:22 PM org.apache.catalina.startup.TldConfig execute
INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
Mar 03, 2018 12:47:22 PM org.apache.catalina.core.StandardContext reload
INFO: Reloading Context with name [/SimpleProject] is completed
User Name:m
Password :n
DEBUG   2018-03-03 12:47:30,298 [http-apr-9001-exec-65] dao.UserLoginDao  - Query executed :Insert into test1(name,id) values(?,?)
ERROR   2018-03-03 12:47:30,298 [http-apr-9001-exec-65] dao.UserLoginDao  - Error due to :java.sql.SQLException: No suitable driver found for jdbc:oracle:thin:@localhost:1521:xe
Log4J configuration file :E:\tomcat\bin\log4j.properties
DEBUG   2018-03-03 12:47:30,314 [http-apr-9001-exec-65] dao.UserLoginDao  - Created user:0
 
kishor Das
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tried above code on eclipse as well. But faced same issue.
On registering DriverManager explicitly the issue was resolved:


Can someone tell me why that was required when driver registration was supposed to be done automatically?
 
Tell me how it all turns out. Here is a tiny ad:
Why should you try IntelliJ IDEA ?
https://coderanch.com/wiki/696337/IntelliJ-IDEA
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!