Two Laptop Bag*
The moose likes JSP and the fly likes Unable to connect to database Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Unable to connect to database" Watch "Unable to connect to database" New topic
Author

Unable to connect to database

Harshal Gurav
Ranch Hand

Joined: May 29, 2008
Posts: 151
Hi,
Here is my jsp page where i trying to display the data from table. Here form1 is the name of drop down list in my searchuser.jsp page. The content in the drop down list is a name of one column of the database. I am able to connect firstjsp page showing item available in drop down menu.But when I am running this page I am failing to connect it to database.
Whether My marked query is right or wrong?

Any suggestion is highly appreciated.
Thanks and Regards
Harshal
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41186
    
  45
What's the actual error message of the exception? In which line of the code does the exception happen?

Do you really have a parameter called "form1" that contains an email address?

As a side note, the form you're creating in this page doesn't contain form tags, so you will have problems later on.

And on yet another unrelated note, you should NEVER perform DB accesses in a JSP page; it's considered bad design. Use a servlet or backing bean instead.
[ July 12, 2008: Message edited by: Ulf Dittmer ]

Ping & DNS - my free Android networking tools app
Harshal Gurav
Ranch Hand

Joined: May 29, 2008
Posts: 151
Hi Ulf,
In my searchuser.jsp page I created drop down list where one can find user. Once user select particular name from drop down list and click on submit, in next page i.e. above posted updateuser.jsp I am trying to obtain the related information available in same table in database. But when I run the updateuser.jsp page it runs successfully and shows the message:
Illegal operation on empty result set.
Here is my search.jsp page

Kindly help me.
Thanks and Regards
harshal

[ July 12, 2008: Message edited by: Harshal Gurav ]
[ July 12, 2008: Message edited by: Harshal Gurav ]
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41186
    
  45
So the first page has "userid" as the option, while the second page uses that to access the "emailid" field? Sure sounds like a problem :-)
Harshal Gurav
Ranch Hand

Joined: May 29, 2008
Posts: 151
Hi Ulf,
Thank you very very much.
You are really genius.
Now IF I want to update all this field i.enow showing in updateuser.jsp page into database, Can you suggest me required update code in my updateuser.jsp.
Frankly Speaking I am newbie here.
Thanks and Regards
Harshal
Rajkumar balakrishnan
Ranch Hand

Joined: May 29, 2008
Posts: 445

We always recommend newbie's to do some homework first and then if they find anu difficulties in the code that they developed,this is the place to ask their doubts. But for the past few days i look at your post and you seems to be not showing any interest in learning.Instead you want us to do the coding for you.

We already suggest you some method and please go through the sun's website where they had lot of sample code for JDBC and some other sites for the SQL Queries.

If you experience problem after studying those tutorials then ranchers were ready to help you happily...
If you not put your efforts then we can't able to help you..Please don't expect us to do your homework....


Never try to be a hard-worker. Be a smart-worker.
My Blog
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Unable to connect to database
 
Similar Threads
javax. servlet. Servlet Exception: java. sql. SQLException
Error shows while retreving data from database
Problem With jsp:forward
error showing while retrieving the data from drop down list
error :java.lang.NullPointer Exception in searchuser.jsp page