}
static
{
if(JdbcOdbcObject.isTracing())
JdbcOdbcObject.trace("JdbcOdbcDriver class loaded");
JdbcOdbcDriver jdbcodbcdriver = new JdbcOdbcDriver();
try
{
DriverManager.registerDriver(jdbcodbcdriver);
}
catch(SQLException sqlexception)
{
if(JdbcOdbcObject.isTracing())
JdbcOdbcObject.trace("Unable to register driver");
}
}
}
public interface JdbcOdbcDriverInterface
extends Driver
{
...
}
3 连接过程
jdbc.sql.Connection con =
DriverManager.getConnection("jdbc:odbc:pubs","sa","");
public class DriverManager {
public static synchronized Connection getConnection(String url,
String user, String password) throws SQLException {
java.util.Properties info = new java.util.Properties();
// Gets the classloader of the code that called this method, may
// be null.
ClassLoader callerCL = DriverManager.getCallerClassLoader();
if (user != null) {
info.put("user", user);
}
if (password != null) {
info.put("password", password);
}
return (getConnection(url, info, callerCL));
}
private static synchronized Connection getConnection(
String url,
java.util.Properties info,
ClassLoader callerCL) throws SQLException
{
...
Connection result = di.driver.connect(url, info);
...
}
}
4 结构图:
请点击查看 结构图 http://jdeveloper.myrice.com/doc/jdbc/images/howjdbc.jpg
请到 http://jdeveloper.myrice.com/ 看更多的Java文章






