代码改变世界

mysql-jdbc创建connection理解

2014-11-28 01:02  张紫荣  阅读(977)  评论(0编辑  收藏  举报

jdbc源码分析(http://blog.csdn.net/brilliancezhou/article/details/5499738)

创建JDBC连接代码

1 Class.forName("com.mysql.jdbc.Driver");
2 DriverManager.getConnection("jdbc:mysql://localhost:3306/test","user","password")

其中的getConnection()方法最终会调用NonRegisteringDriver的connect(String url, Properties info)方法。

后续调用画图如下: