开发者

java Connection Pooling from Oracle

I'm trying to make a connection pool following this link: http://192.9.162.55/developer/onlineTraining/Programming/JDCBook/conpool.html

I don't understand something: Somewhere in the class JDCConnectionDriver implements Driver开发者_如何学运维 you can find this method:

public static final String URL_PREFIX = "jdbc:jdc:";
public Connection connect(String url, Properties props) 
                                   throws SQLException {
    if(!url.startsWith(URL_PREFIX) {
         return null;
    }
    return pool.getConnection();
}

so, if you use mysql (for example), the url it will always start with jdbc... so the method connect it will never return you a connection... Why is that?

Also I would like to ask you which is the best connection pooling framework...


so, if you use mysql (for example), the url it will always start with jdbc... so the method connect it will never return you a connection... Why is that?

This driver is specifically written to connect to a JDC Connection. That's why. It's looking for a url starting with jdbc:jdc: and not just jdbc:.

Also I would like to ask you which is the best connection pooling framework...

The most well known Connection Pooling library out there and used on many application servers and servlet containers is Apache Object Pool. The most common connection pooling is Apache DBCP (DataBase Connection Pooling).

Also, as stated by Rocky Triton, c3p0 is another JDBC library that included Connection and Statement Pooling.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜