You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by Fernando Padilla <fe...@alum.mit.edu> on 2009/03/05 21:30:17 UTC

Mysql Connector/J ReplicantConnection

Have you heard of this?

http://dev.mysql.com/doc/refman/5.1/en/connector-j-reference-replication-connection.html

I was wondering if OpenJPA was good at calling the 
Connection.setReadOnly() method as appropriate ( true when new 
connection, false once transaction is started )??

If OpenJPA did so, then anyone could use the Mysql Replication 
Connector, and get some easy distribution of read queries to replicants, 
without any application changes..

Re: Mysql Connector/J ReplicantConnection

Posted by Michael Dick <mi...@gmail.com>.
I don't believe OpenJPA does this automatically right now. It sounds
promising to me though and would make for a good feature to add.

-mike

On Thu, Mar 5, 2009 at 2:30 PM, Fernando Padilla <fe...@alum.mit.edu> wrote:

> Have you heard of this?
>
>
> http://dev.mysql.com/doc/refman/5.1/en/connector-j-reference-replication-connection.html
>
> I was wondering if OpenJPA was good at calling the Connection.setReadOnly()
> method as appropriate ( true when new connection, false once transaction is
> started )??
>
> If OpenJPA did so, then anyone could use the Mysql Replication Connector,
> and get some easy distribution of read queries to replicants, without any
> application changes..
>

Re: Mysql Connector/J ReplicantConnection

Posted by Pinaki Poddar <pp...@apache.org>.
Hi,
I have placed some basic support for the MySQL replication driver. But I do
not have the provisions for testing replicated databases. The driver seems
to be smart to identify any attempt to cheat such as an URL
"jdbc:mysql://localhost,127.0.0.1/test". Also
"jdbc:mysql://localhost,remote/test" hangs when there is no "remote"
machine.
If any of you have the requisite environment/machines for testing this
configuration then please give it a try.
openjpa.ConnectionDriverName: com.mysql.jdbc.ReplicationDriver
openjpa.ConnectionFactoryProperties:
autoReconnect=true,roundRobinLoadBalance=true 


Fernando Padilla wrote:
> 
> Thank you.
> 
> I have no idea if anyone else uses this field for any other 
> optimizations, or what not.. but it most like can't hurt. :) :)
> 
> Pinaki Poddar wrote:
>> Hi,
>>   JIRA [1] created.
>> 
>> [1] https://issues.apache.org/jira/browse/OPENJPA-966
>> 
>> 
> 
> 

-- 
View this message in context: http://n2.nabble.com/Mysql-Connector-J-ReplicantConnection-tp2431984p2445487.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: Mysql Connector/J ReplicantConnection

Posted by Fernando Padilla <fe...@alum.mit.edu>.
Thank you.

I have no idea if anyone else uses this field for any other 
optimizations, or what not.. but it most like can't hurt. :) :)

Pinaki Poddar wrote:
> Hi,
>   JIRA [1] created.
> 
> [1] https://issues.apache.org/jira/browse/OPENJPA-966
> 
> 

Re: Mysql Connector/J ReplicantConnection

Posted by Pinaki Poddar <pp...@apache.org>.
Hi,
  JIRA [1] created.

[1] https://issues.apache.org/jira/browse/OPENJPA-966


-- 
View this message in context: http://n2.nabble.com/Mysql-Connector-J-ReplicantConnection-tp2431984p2444912.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: Mysql Connector/J ReplicantConnection

Posted by MiƂosz Tylenda <mt...@o2.pl>.
Hi Fernando,

Maybe it is possible to implement custom JDBCListener and/or TransactionListener and from within them call Connection.setReadOnly() in the desired places.

Greetings,
Milosz


> Have you heard of this?
> 
> http://dev.mysql.com/doc/refman/5.1/en/connector-j-reference-replication-connection.html
> 
> I was wondering if OpenJPA was good at calling the 
> Connection.setReadOnly() method as appropriate ( true when new 
> connection, false once transaction is started )??
> 
> If OpenJPA did so, then anyone could use the Mysql Replication 
> Connector, and get some easy distribution of read queries to replicants, 
> without any application changes..
>