aspose file tools*
The moose likes Servlets and the fly likes problem in accesing a db from a servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "problem in accesing a db from a servlet" Watch "problem in accesing a db from a servlet" New topic
Author

problem in accesing a db from a servlet

rammie singh
Ranch Hand

Joined: Mar 26, 2009
Posts: 116
hi every body

first i will give you the code of my function.



here the function is not entering in 2nd while loop.
and is giving java.sql.SQLException

and when i do like this




it enters the 2nd while loop but it gives error as
java.lang.NullPointerException

and it also prints hi.


here EmpJavaBean is my bean class where i am all the function of getters and setters.


although i am getting the desired result when i am doing only this




it means my java bean functions are working fine.

emp is object of my bean class.

still i will give you the code for my second function in the bean class EmpJavaBean.






here my main aim is that on making the privileges query that is

"select PRIVILEGES from PRIVILEGE where EMP_ID= '"+empid+"'";

i would be getting 3 to 4 rows of different privileges which i want to set in the emp object privileges which is represented by an

ArrayList empPrivilege

can any body please help me why i am getting this error.

i hope my problem is clear.
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336


here the function is not entering in 2nd while loop.
and is giving java.sql.SQLException

What does the SQLException message say?


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: problem in accesing a db from a servlet