• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Where is defination of inbuilt interfaces are written?

 
Ranch Hand
Posts: 385
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As questioned above, I am slight confused with it when i tracked classes

let me take example of JDBC Connection (i have not posted it in JDBC because asking it in general sense)

Example :


Register Driver is called within driver manager and the driver given in Argument is registered shown code below:


then getConnection is called and in procedure of getConnection it calls CONNECT() method if



When i see CONNECT method, i found it in DRIVER interface as shown below:

Connection connect(String url, java.util.Properties info)
throws SQLException; <----------- Picture ends here amd Connection type is returned....unable to find further role and control of "jdbc:oracle:thin:@12.16.5.1:11:vqa", "en", "e123"


Question is how connect acted internally(connect to db) ?
As it is interface, where is it's definition of connection?
Does JVM holds that internally? or JVM takes control?
i mean how it executes?

I hope you understand my question......sly i found for many things in java....

please respond
 
Ranch Hand
Posts: 296
Eclipse IDE Firefox Browser Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Specific to your question, the Driver Interface would be implemented by the provider of the driver, in your case it would be Oracle, since you are using Oracle driver. The implementation is never present in the JVM. The implementation needs to be provided by the vendors.

Hope this helps.
 
Azrael Noor
Ranch Hand
Posts: 385
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sumit ok I am getting into Oracle Driver Class now which is registered above

It contains following overridden on Driver.....please see below



I am unable to find control here too
 
Sumit Patil
Ranch Hand
Posts: 296
Eclipse IDE Firefox Browser Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This class will have compiled code, where they have implemented it.
You can use a decompiler to see the implementation details.

 
Azrael Noor
Ranch Hand
Posts: 385
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes Bro i am studying it

I have used this J Decompiler: http://java.decompiler.free.fr/?q=jdgui

I found




Let me study, it i will ask question again :p

Thank you for your help......i am reaching to the place where JVM actually takes whole control...i mean where control goes non visible to me :p

will ask again, if any problem occurs
 
Sumit Patil
Ranch Hand
Posts: 296
Eclipse IDE Firefox Browser Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You are welcome
 
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Azrael Noor wrote:
When i see CONNECT method, i found it in DRIVER interface as shown below:

Connection connect(String url, java.util.Properties info)
throws SQLException; <----------- Picture ends here amd Connection type is returned....unable to find further role and control of "jdbc:oracle:thin:@12.16.5.1:11:vqa", "en", "e123"


Question is how connect acted internally(connect to db) ?
As it is interface, where is it's definition of connection?



When you call DriverManager.getConnection(), it looks at its registered Drivers until it finds one that can understand the particular URL you've passed. In this case, it finds the OracleDriver, and asks it for a Connection. The driver returns an instance of a concrete class that implements the Connection interface. We don't know and we don't care what the specific class is.

(And by the way, you should not be doing DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver()). You shouldn't need to instantiate it. Just call Class.forName("oracle.jdbc.driver.OracleDriver") and it should register itself, and manage its own instantiation.)

Does JVM holds that internally? or JVM takes control?
i mean how it executes?



It executes just like any other code. You call a method, which class another method, and so on. These methods make use of various classes that are on the classpath. The classes may be your own, or part of the core API, or may have come from some third party library. It doesn't matter; it's all executed the same way.
 
Jeff Verdegan
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Sumit Patil wrote:The implementation is never present in the JVM.



Yes it it. The implementing class, like any other class, has to be loaded into the JVM at runtime in order to execute its code.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic