Results 1 to 3 of 3

Thread: JDBC-Implementation of Connection,Resultset,Statement

  1. #1
    Junior Member
    Join Date
    Sep 2007
    Answers
    8

    Smile JDBC-Implementation of Connection,Resultset,Statement

    Hi all,

    In JDBC We use Connection,Resultset,Statement..etc.
    All these are interfaces, but we are using it..
    My Question is:
    1.Where is the implementation of these interfaces?
    2. We will load the JDBC driver in the first step.. Instead can we put the driver class in class path? Why loading class using Class.forName()
    3.What is the difference between using JDBC driver and datasource?

    Any information about the question will be appreciated..


  2. #2
    Junior Member
    Join Date
    Apr 2007
    Answers
    3

    Smile Re: JDBC-Implementation of Connection,Resultset,Statement

    Quote Originally Posted by Raghunath.ek View Post
    Hi all,

    In JDBC We use Connection,Resultset,Statement..etc.
    All these are interfaces, but we are using it..
    My Question is:
    1.Where is the implementation of these interfaces?
    2. We will load the JDBC driver in the first step.. Instead can we put the driver class in class path? Why loading class using Class.forName()
    3.What is the difference between using JDBC driver and datasource?

    Any information about the question will be appreciated..
    Hi,

    Eventhough the Connection,Statement and ResultSet are interfaces the implementation for these will exist in the driver classes taht we are losding while connection creation.

    we can put the driver class in the class path, ifwe do like tis each java class will take this which is not necessary.

    Only for Type1 driver we create datasource,as there is no direct interaction between jdbc and odbc, but this is not the case with Oracle (Type4) driver.

    I hope this may give u some clarification.

    Regards,
    Bhargavi.


  3. #3
    Junior Member
    Join Date
    Sep 2007
    Answers
    5

    Re: JDBC-Implementation of Connection,Resultset,Statement

    Quote Originally Posted by raghunath.ek View Post
    hi all, in jdbc we use connection,resultset,statement..etc. All these are interfaces, but we are using it.. My question is: 1.where is the implementation of these interfaces? 2. We will load the jdbc driver in the first step.. Instead can we put the driver class in class path? why loading class using class.forname() 3.what is the difference between using jdbc driver and datasource? any information about the question will be appreciated..
    hi, using jdbc driver makes database url, user, password bound to your java codes. Now imagine a situation when ur database url, username & password becomes something different, in that senerio u need to update all the codes which make the use of hardcore connection object. Also when u use jdbc driver u make physical connection to database everytime u want to connect. Using datasource, (1) your application is portable because all the url, user, password can be specifed in descriptor file (web.xml) (2) by default datasoruce uses pool connection, so when u request for connection, one already in pool is connected (no physical connection) and when u close a connection, it returns to pool. Vj


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact