Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Statement, PreparedStatement, CallableStatement  RSS feed

Tony Morris
Ranch Hand
Posts: 1608
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The inheritance hierarchy for JDBC statements puzzles me a little.
Specifically, why would PreparedStatement and CallableStatement want to inherit some of the methods of Statement?

For example, I tried the following:

I tried code similar to the above with MS SQL Server 2000 driver, only to be given an exception.
Why does the JDBC API allow this behaviour?
Is there ever a reason why you'd do such a thing?
Is it a fair statement that some of the Statement methods should never be called on a PreparedStatement (and CallableStatement) instance?

Advice is most appreciated.
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!