• Post Reply Bookmark Topic Watch Topic
  • New Topic

JDBC - Statement is an interface?  RSS feed

 
thomas davis
Ranch Hand
Posts: 207
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would like to know that who does the implementation of this interface and how does it return the statement for executing the query form the connection object?
How does the database recognize that the call is for Simple/Prepared/Callable Statement?
:roll:
 
Philip Shanks
Ranch Hand
Posts: 189
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have a look at the "Factory" pattern. It can have a series of interfaces that define specific behaviors, with the implementations provided by a factory class.
In this case the object handle is declared using the type of interface needed. The instance is received from the Connection class via one of its methods: createStatement(), prepareCall() or prepareStatement(). Considering the tight coupling between a Statement object and the associated Connection object, this makes a lot of sense.
The Statement interface provides access to the base behavior, and is extended by the PreparedStatement, which is further extended by the CallableStatement.
Hope I got that right!
[ July 07, 2003: Message edited by: Philip Shanks ]
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, Philiip.
I'm going to get this moved to the JDBC forum. This is not a Servlet question.
Dave
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Follow-up here.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!