List:General Discussion« Previous MessageNext Message »
From:Peter Chen Date:March 11 2010 11:25am
Subject:RE: How to modify the application to implement the separation of write/read
View as plain text  
Hi Mattia,

I use java with the Connector/L jdbc driver, I checked the webpage of
http://dev.mysql.com/doc/refman/5.1/en/connector-j-reference-replication-connection.html,
it suggests to use "ReplicationDriver" to replace common driver.

I use Hibernate to access Mysql, the connection poll is c3p0-0.9.0, can I just need to
modify the configuration of JDBC URL, like
"jdbc:mysql:replication://master,slave1,slave2,slave3/test" to implement the separation
of write/read? 

After configuring JDBC URL like this, can I make the query SQL requests to access the
Slave server, the update/insert/delete SQL requests to access the Master server, and if
the Master server is shotdown, the driver will failover to the Slave server?

I am not sure whether do I need to modify something else? Like my application code.

Expect your reply.
Thanks,
Peter


-----Original Message-----
From: Mattia Merzi [mailto:mattia.merzi@stripped] 
Sent: 2010年3月11日 19:01
To: Peter Chen
Cc: mysql@stripped
Subject: Re: How to modify the application to implement the separation of write/read

2010/3/11 Peter Chen <peter.chen@stripped>:
[...]
> Does someone have met this problem? How to implement the separation of
> read and write?

please, write us some more details about your application!

For example, if you use java with the Connector/j jdbc driver, you can
enjoy a really
nice feature already implemented in the driver:

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

Greetings,

Mattia.
Thread
How to modify the application to implement the separation of write/readPeter Chen11 Mar
  • Re: How to modify the application to implement the separation of write/readMattia Merzi11 Mar
    • RE: How to modify the application to implement the separation of write/readPeter Chen11 Mar
      • Re: How to modify the application to implement the separation of write/readMattia Merzi11 Mar
      • RE: How to modify the application to implement the separation of write/readDaevid Vincent11 Mar