This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes JDBC and Relational Databases and the fly likes what is the function of this line code? 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 "what is the function of this line code?" Watch "what is the function of this line code?" New topic
Author

what is the function of this line code?

vijay joseph
Greenhorn

Joined: Feb 26, 2007
Posts: 18
hi friends, can anyone tell me what is the function of following lines in servlet?what is the difference between prepareStatement,PreparedStatement?
Connection con;
PreparedStatement pstmt=null;
query="select emp_fname, emp_lname, address, dept, age, desig from Employee_master where emp_id=?";

pstmt=con.prepareStatement(query);
pstmt.setInt(1,Integer.parseInt(req.getParameter("emp_id")));
[ March 02, 2007: Message edited by: vijay joseph ]
Muhammad Saifuddin
Ranch Hand

Joined: Dec 06, 2005
Posts: 1321

you just need to read this one page and I am 100% sure that this page will be clear and proficient to you in using Prepared Statement.

[Edited]
Suggestion:

Javaranch have separate room for Database related query with the name of JDBC.
please choose appropriate room before posting you question.
[ March 02, 2007: Message edited by: Saif uddin ]

Saifuddin..
[Blog][Linkedin] How To Ask Questions On JavaRanch My OpenSource
 
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: what is the function of this line code?
 
jQuery in Action, 3rd edition