jQuery in Action, 2nd edition*
The moose likes JDBC 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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
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 agree. Here's the link: http://aspose.com/file-tools
 
subject: what is the function of this line code?
 
Similar Threads
Prepared statements question
preparedStatement with like where clause
PreparedStatement
Multiple Values in single parameter marker
CallableStatement PostgreSQL Error