This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JDBC and the fly likes What wrong? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "What wrong?" Watch "What wrong?" New topic
Author

What wrong?

Rajiv Musunuru
Greenhorn

Joined: Mar 19, 2012
Posts: 13
I am trying to implement a hit counter.
I am using Oracle 11g xe, Eclipse IDE.
I created a table count with single column hit_counter. created a row with hit_counter = 0

I put ojdbc6.jar in web-inf/lib folder from what i read in the internet. I am getting nullpointerexception when I run the following servlet:

and the jsp code for hitdisplay.jsp as used in RequestDispatcher

This is the first time I am using jdbc api. I am stuck. Please help.
T Mishra
Ranch Hand

Joined: Apr 04, 2006
Posts: 108

Its not a good practice to create connection in init() method. Read more here ..database connection in init() of servlet


Thanks,
Tushar (SCJP 1.5)
 
Don't get me started about those stupid light bulbs.
 
subject: What wrong?
 
Similar Threads
@EJB
user registration via Servlet/JSP/JDBC
Html Input to oracle through servlet and JSP output
Error in connecting oracle 10g XE with java
@EJB