• Post Reply 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

JDBC - Statement is an interface?

 
Ranch Hand
Posts: 207
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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:
 
Ranch Hand
Posts: 189
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Wanderer
Posts: 18671
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Follow-up here.
reply
    Bookmark Topic Watch Topic
  • New Topic