0

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...

1
  • c3p0 is a good connection pooling framework as well. Commented Jul 1, 2011 at 12:34

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Ok, i understood... Though the answers are reversed :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.