[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mysql-java
Subject:    Re: driver question
From:       Mark Matthews <mmatthew () thematthews ! org>
Date:       2000-07-12 14:07:39
[Download RAW message or body]


>
>At 09:03 AM 7/12/2000 -0400, you wrote:
>>Hi all,
>>I am curious about why the JDBC Driver needs to be dynamically loaded with
>>Class.forName(Driver name)
>>instead of it being imported like any other class.
>>ANy insight would be appreciated.
>
>Because the JDBC spec says so. If you import it like any other class you 
>are tied to that particular driver. By coding your application correctly, 
>and using the Class.forName() call you become database independent.
>
>This is a very common pattern in java when there is a need to load a class 
>that implements an API that someone else authored. It de-couples your code 
>from the implementations that allow you to use things like legacy systems, 
>XML, EJB, etc.
>
>         -Mark


---------------------------------------------------------------------
Please check "http://www.mysql.com/Manual_chapter/manual_toc.html" before
posting. To request this thread, e-mail java-thread1447@lists.mysql.com

To unsubscribe, send a message to the address shown in the
List-Unsubscribe header of this message. If you cannot see it,
e-mail java-unsubscribe@lists.mysql.com instead.

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic