This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Exception coming while connecting to database

 
Megha Singhal
Ranch Hand
Posts: 225
IBM DB2 Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
for the following code

i 'm getting following ouput
"Connection Pooling Example.
A general Exception has occured!null "

why the above exception is coming?

 
Kumaravadivel Subramani
Ranch Hand
Posts: 171
Java Linux Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could be the problem of extracting the parameters from the request. what printStackTrace() is printed? Try to print "e" as it is when e.getMessage() is null. Debug would be the best option to find the exact problem you encountered.
 
Santhosh ayiappan
Ranch Hand
Posts: 80
Eclipse IDE Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check the stack trace.

Regards
Santhosh
 
Amit Ghorpade
Bartender
Posts: 2854
10
Fedora Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The very first chance of getting the null value is at the following location in your code



If the request does not contain the parameter P_ID, then the above code will throw a NPE.
Also why are you calling toString() on a string ??
Does not make sense.
 
Piyush Mangal
Ranch Hand
Posts: 196
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The following sql seems to be incorrect. Do you want to do update or insert?

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic