Ragazzi finalmente credo di aver avuto una risposta... Non so se la fonte è attendibile o meno , ho spulciato un topic sul sito della Sun...
I will take connection Connection and explain.
'Sun' has given this 'Connection' interface to the database driver vendors to implement it.
When you say, Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); it will register the driver. Basically all the driver implementation will have a static block inside which they will register that driver with the DriverManager.
When you call DriverManager.getConnection() method, it will return the Connection object implemented in that driver. For example in the case of JdbcOdbcDriver, it will return JdbcOdbcConnection object. If you see this JdbcOdbcConnection it will be implementing java.sql.Connection.
And this JdbcOdbcConnection is no more an interface, it is class.
public class JdbcOdbcConnection implements java.sql.Connection, etc,etc.
Since it is implementing java.sql.Connection it must implement all the methods that are declared in the java.sql.Connection interface.
You may think that you are working with java.sql.Connection but actually JdbcOdbcConnection is what giving you the services.
Similarly it is jdbc.oracle.thin.OracleConnection in case of OracleDriver.
Hope this clarifies your doubt.
Sudha
Ora il mio inglese maccheronico mi lascia intendere che le nostre "pippe mentali" siano fondate su qualcosa di vero
In più in altri messaggi più avanti dice che il driver viene registrato in questo modo:
Each driver implementaion class (for example OracleDriver, JdbcOdbcDriver) will have a static block, inside which they will execute the statement
DriverManager.registerDriver(new driver_class()); This statement registers the driver with DriverManager. You can register as many drivers as you can
Il topic x intero è questo :
http://forums.sun.co...threadID=275243