Bookmark Topic Watch Topic
  • New Topic

Why Statemet interface is not Deprecated ?  RSS feed

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Report post to moderator
Can any one please tell me that why Statement interface in java.sql package is not Deprecated as all fuctionality are provided with PreparedStatment?
 
Ranch Hand
Posts: 208
  • Mark post as helpful
  • send pies
  • Report post to moderator
Don't forget

Fields inherited from interface java.sql.Statement
CLOSE_ALL_RESULTS, CLOSE_CURRENT_RESULT, EXECUTE_FAILED, KEEP_CURRENT_RESULT, NO_GENERATED_KEYS, RETURN_GENERATED_KEYS, SUCCESS_NO_INFO


and

Methods inherited from interface java.sql.Statement
addBatch, cancel, clearBatch, clearWarnings, close, execute, execute, execute, execute, executeBatch, executeQuery, executeUpdate, executeUpdate, executeUpdate, executeUpdate, getConnection, getFetchDirection, getFetchSize, getGeneratedKeys, getMaxFieldSize, getMaxRows, getMoreResults, getMoreResults, getQueryTimeout, getResultSet, getResultSetConcurrency, getResultSetHoldability, getResultSetType, getUpdateCount, getWarnings, setCursorName, setEscapeProcessing, setFetchDirection, setFetchSize, setMaxFieldSize, setMaxRows, setQueryTimeout


http://java.sun.com/j2se/1.5.0/docs/api/java/sql/PreparedStatement.html

If you compare e.g. PreparedStatement.addBatch with Statement.addBatch you will find they are not identical.
[ November 29, 2006: Message edited by: �dne Brunborg ]
 
Ranch Hand
Posts: 196
  • Mark post as helpful
  • send pies
  • Report post to moderator
Also, Statement is still a perfectly valid interface. In fact, if you have a set statement, that is not dependant on a lot of variables to create, does not use user input (which could introduce SQL injection attacks), and is not going to be run mulitple times in succession, then Statement is actually preferable to PreparedStatement.
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Report post to moderator
Please don't post the same question in multiple forums. It creates duplicate conversations and wastes the time of the people trying to help you.

Thanks,
Dave
 
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!