Wrox Home  
Search P2P Archive for: Go

  Return to Index  

servlets thread: Problem in using connection pool in servlet


Message #1 by bikashpaul_2001@y... on Fri, 6 Jul 2001 10:30:00
If you are getting a NullPointerException in the try-catch of the code that creates the
Statement, then the only thing that could cause that is the con variable is null. That does seem
a little strange, though. I did not think the DriverManager could return a null reference. Check
the con variable for equality to null before trying to use it. If it is null, which I'm certain it is,
you'll need to determine why the driver or driver manager is returning a null connection.


K Mukhar

> Hi,
> 
> Error 
> from statement:java.lang.NullPointerException).

> 	try
> 	   {	
> 
> 		 con=DriverManager.getConnection
> ("jdbc:weblogic:pool:kdk",null);		
> 		
> 	   }
> 	catch(Exception e)
> 	   {
> 		System.out.println("Error from getConnection:" + e.toString
> ());
> 	   }
> 	
> 	 
> 	   try
> 		{
> 		 stmt=con.createStatement();
> 		}
> 	   catch(Exception e)
> 		{
> 		  System.out.println("Error from Statement:" + e.toString
> ());
> 		}		
> 

  Return to Index