jQuery in Action, 3rd edition
The moose likes JDBC and Relational Databases and the fly likes Exception coming while connecting to database Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Exception coming while connecting to database" Watch "Exception coming while connecting to database" New topic

Exception coming while connecting to database

Megha Singhal
Ranch Hand

Joined: Feb 28, 2012
Posts: 225

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

Joined: Jul 05, 2008
Posts: 171

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.

No pain, No gain.
OCJP 1.6, Liferay Certified Developer 6.1
Santhosh ayiappan
Ranch Hand

Joined: Jan 30, 2007
Posts: 80

Check the stack trace.

Amit Ghorpade

Joined: Jun 06, 2007
Posts: 2851

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.

|Asking Good Questions|
Piyush Mangal
Ranch Hand

Joined: Jan 22, 2007
Posts: 196
The following sql seems to be incorrect. Do you want to do update or insert?

I agree. Here's the link: http://aspose.com/file-tools
subject: Exception coming while connecting to database
It's not a secret anymore!