This week's book giveaway is in the Design forum.
We're giving away four copies of Building Microservices and have Sam Newman on-line!
See this thread for details.
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


Win a copy of Building Microservices this week in the Design forum!
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
Author

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 ..ie..

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.........
thankyou
regards
Sagar


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

Joined: May 26, 2003
Posts: 32507
    
214

Sagar,
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
 
Have you checked out Aspose?
 
subject: Getparameter and then display a record--how?
 
It's not a secret anymore!