aspose file tools*
The moose likes JDBC and the fly likes Tell me the main difference between Statement and PreparedStatement? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Tell me the main difference between Statement and PreparedStatement?" Watch "Tell me the main difference between Statement and PreparedStatement?" New topic
Author

Tell me the main difference between Statement and PreparedStatement?

Rama Satti
Greenhorn

Joined: Jun 24, 2008
Posts: 3

Hai to all,

Can any one tell me the important differences between Statement and PreparedStatement?

Thanks in Advance

Regards
SRK
Deepak Bala
Bartender

Joined: Feb 24, 2006
Posts: 6657
    
    5

Google can help

Search


SCJP 6 articles - SCJP 5/6 mock exams - More SCJP Mocks
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60053
    
  65

Please take the time to choose the correct forum for your posts. This forum is for questions on Servlets.

For more information, please read this.

This post has been moved to a more appropriate forum.

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Amaan khan
Greenhorn

Joined: Nov 29, 2008
Posts: 14

The main difference is PreparedStatement can be used to supply the parameters to the SQL queries on the runtime using some html /jsp forms or things like that. Statement Object cannot allow us to do that.
There are many more differences but significantly this one more than enough for us to use PreparedStatement in place of Statement.

Bye


OCPJP (SCJP) 6.0 93%

--- Fear Thy Lord ---
Prashant Langade
Ranch Hand

Joined: Jul 01, 2009
Posts: 71
The basic difference is

Statement is not compiled and PreparedStatement is pre-compiled.


Thanks and Regards
Prashant
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Tell me the main difference between Statement and PreparedStatement?
 
Similar Threads
PreparedStament and Statement
what are checked and unchecked exceptions ?
PreparedStatement's executeQuery() returning resultset with no rows
Diff b/w Statement and PreparedStatement
Difference between Statement/Prepared statement?