Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
    Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Bear Bibeault
  • Liutauras Vilda
  • Devaka Cooray
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • Henry Wong
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Tim Holloway
Bartenders:
  • salvin francis
  • Frits Walraven
  • Piet Souris

Why Statemet interface is not Deprecated ?

 
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
 
No more fooling around. Read this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!