A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
The Java EE 7 Tutorial Volume 1 or Volume 2
this week in the
jQuery UI in Action
querying a database within a servlet
Joined: Sep 23, 2004
Nov 23, 2004 18:03:00
I am trying to execute a query in a
. I have a connection.
--a static html page--
The user clicks on a radio button for one of the following
this is all in a form and the form works)
Then there is a text box to enter in criteria(This works too)
Then they click submit and it takes them to my results.java page (this works)
In my init method I have my employeeSearch object instantiated and loaded.
(this makes a connection and does a
query)- this works
???Now I have to run a query on the database. How do I do this?
I know this goes in my doGet method. Please help me.
Joined: Aug 15, 2004
Nov 23, 2004 23:01:00
No what you know is not right, sorry. Ofcourse you can so that but you should not. It is strongly discouraged.
Please make your servlet and your
code seperate. Servlet should be just to entertain the requests and giving responses. You can do your jdbc stuff in simple, normal
Joined: May 26, 2003
Nov 24, 2004 18:01:00
Have you seen the
It walks you through how to get started with JDBC. And Adeel is correct that it is best not to put the JDBC in the servlet. The servlet would instead call your database class.
How To Ask Questions The Smart Way
Blogging on Certs:
SCEA Part 1
Part 2 & 3
Core Spring 3
TOGAF part 1
I agree. Here's the link:
subject: querying a database within a servlet
Applet/Servlet Http tunneling
Advice needed on how to connect to a database in JSP
request.getAttribute from servlet on jsp page load
Please help clarify this!
maintaining a connection
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014