File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes Getparameter and then display a record--how? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Getparameter and then display a record--how?" Watch "Getparameter and then display a record--how?" New topic

Getparameter and then display a record--how?

Raja Sagar Panamgipalli
Ranch Hand

Joined: Aug 13, 2003
Posts: 109
Hi Guys,

I'm kinda new to JDBC ...i haven't been able to resolve this problem

Consider a html page that takes an employee name ...which through
form method =get action= \servletJdbcVlidation post the parameter to the servlet.
There in the servlet i have the code like follows...

stmt.executeQuery("select passwd from employee where username like"+ vart);
how do i give the String stored in vart to the SQL statement...i dont get the trick in giving the syntax.
plz help.........

SCJP 1.4<br />SCBCD 1.3
Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 33117

To do an exact match, you need single quotes around the parameter.

Is the user passing in the wildcards in the like clause? If not, you may want to do:

That will return any matches containing the parameter, not just exact matches.

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
I agree. Here's the link:
subject: Getparameter and then display a record--how?
It's not a secret anymore!