aspose file tools
The moose likes JDBC and the fly likes Exception coming while connecting to database Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Databases » JDBC
Reply Bookmark "Exception coming while connecting to database" Watch "Exception coming while connecting to database" New topic
Author

Exception coming while connecting to database

Megha Singhal
Ranch Hand

Joined: Feb 28, 2012
Posts: 128

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: 162

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
Santhosh ayiappan
Ranch Hand

Joined: Jan 30, 2007
Posts: 70

Check the stack trace.

Regards
Santhosh
Amit Ghorpade
Bartender

Joined: Jun 06, 2007
Posts: 2552
    
    2

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.

SCJP, SCWCD.
|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://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Exception coming while connecting to database
 
Similar Threads
SQLException
Exception in thread "main" java.lang.NoClassDefFoundError:
cannot find symbol
else loop not working
Data source name not found and no default driver specified