On 8/6/14 1:15 AM, Mark Thomas wrote:
> On 06/08/2014 01:34, Parth Patil wrote:
>> Hi Friends,
>> I am using DBCP2 in my project and I am pleased with the performance of the
>> library. Though I am only able to provide a single mysql host in the
>> connection string. What do I need to do inorder to make the DBCP connection
>> pool replication aware ?
> Write some code :). DBCP 2 is not replication aware. There was an
> enhancement request for this [1] but I resolved it as WONTFIX on the
> bases that:
> <quote>
> ...generally, failover requires some form of database replication and
> databases that provide that tend to provide JDBC drivers that support
> failover as well.
> </quote>
>
>> I am going to use 1 master and 2 slaves in my
>> setup. Am I correct in assuming that its possible to create connection pool
>> over several mysql hosts ?
> No, you are not correct.
>
>> I tried to use the replication aware mysql jdbc driver
>> (com.mysql.jdbc.ReplicationDriver)
> That is the correct way to do this.
>
>> but that doesn't seem to work and I am
>> getting an exception. Following is my test code
> <snip/>
>
>> Following is the exception that I am getting :
>>
>> [error] (run-main-0) java.lang.AbstractMethodError:
>> com.mysql.jdbc.ReplicationConnection.isValid(I)Z
> <snip/>
>
> DBCP2 uses JDBC4 (Java 1.6) and that is a new method introduced in that
> release.

I think you mean JDBC 4.1, Java 1.7 for DBCP2.

Phil
>
> You can avoid the call to that method by setting a validation query for
> your connection pool. For MySQL the following should work:
> /* ping */ SELECT 1
>
>
> Mark
>
> [1] https://issues.apache.org/jira/browse/DBCP-393
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
> For additional commands, e-mail: user-h...@commons.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org

Reply via email to