<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Load balancing across MySQL servers using JDBC</title>
	<atom:link href="http://gabrito.com/post/load-balancing-across-mysql-servers-using-jdbc/feed" rel="self" type="application/rss+xml" />
	<link>http://gabrito.com/post/load-balancing-across-mysql-servers-using-jdbc</link>
	<description>Anecdotes on Technology Leadership, Ruby, Java, Scala, Cloud Computing, Open-Source, SEO, and Design</description>
	<lastBuildDate>Sun, 20 May 2012 19:43:02 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: MySQL Master/Slave Load Balancing with JPA and Spring &#8212; Dragisa Krsmanovic</title>
		<link>http://gabrito.com/post/load-balancing-across-mysql-servers-using-jdbc/comment-page-1#comment-254898</link>
		<dc:creator>MySQL Master/Slave Load Balancing with JPA and Spring &#8212; Dragisa Krsmanovic</dc:creator>
		<pubDate>Mon, 13 Jun 2011 20:25:15 +0000</pubDate>
		<guid isPermaLink="false">http://gabrito.com/post/load-balancing-across-mysql-servers-using-jdbc#comment-254898</guid>
		<description>[...] Load balancing across MySQL servers using JDBC by Todd Huss [...]</description>
		<content:encoded><![CDATA[<p>[...] Load balancing across MySQL servers using JDBC by Todd Huss [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Todd Huss</title>
		<link>http://gabrito.com/post/load-balancing-across-mysql-servers-using-jdbc/comment-page-1#comment-254858</link>
		<dc:creator>Todd Huss</dc:creator>
		<pubDate>Tue, 08 Mar 2011 05:05:17 +0000</pubDate>
		<guid isPermaLink="false">http://gabrito.com/post/load-balancing-across-mysql-servers-using-jdbc#comment-254858</guid>
		<description>Mike, I&#039;m no longer at the company where we implemented that but at the time we ended up defaulting everything to readonly. Then if a controller action needed to do something that might involte a write it called a method to switch the hibernate session to use a connection with the master db. 

However, nowadays I would probably just write a spring interceptor such that if the controller action were annotated with @ReadWrite I would call setReadOnly(false).</description>
		<content:encoded><![CDATA[<p>Mike, I&#8217;m no longer at the company where we implemented that but at the time we ended up defaulting everything to readonly. Then if a controller action needed to do something that might involte a write it called a method to switch the hibernate session to use a connection with the master db. </p>
<p>However, nowadays I would probably just write a spring interceptor such that if the controller action were annotated with @ReadWrite I would call setReadOnly(false).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mike</title>
		<link>http://gabrito.com/post/load-balancing-across-mysql-servers-using-jdbc/comment-page-1#comment-254857</link>
		<dc:creator>Mike</dc:creator>
		<pubDate>Tue, 08 Mar 2011 01:10:44 +0000</pubDate>
		<guid isPermaLink="false">http://gabrito.com/post/load-balancing-across-mysql-servers-using-jdbc#comment-254857</guid>
		<description>Hi Todd,

Do you happen to have example code for that interceptor?  You&#039;re right, Spring no longer calls setReadOnly on the JDBC connection.  The spring docs say that one can add custom advice to the transaction manager, but I can&#039;t seem to find a working example anywhere.</description>
		<content:encoded><![CDATA[<p>Hi Todd,</p>
<p>Do you happen to have example code for that interceptor?  You&#8217;re right, Spring no longer calls setReadOnly on the JDBC connection.  The spring docs say that one can add custom advice to the transaction manager, but I can&#8217;t seem to find a working example anywhere.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Todd Huss</title>
		<link>http://gabrito.com/post/load-balancing-across-mysql-servers-using-jdbc/comment-page-1#comment-4821</link>
		<dc:creator>Todd Huss</dc:creator>
		<pubDate>Sun, 13 Aug 2006 20:19:46 +0000</pubDate>
		<guid isPermaLink="false">http://gabrito.com/post/load-balancing-across-mysql-servers-using-jdbc#comment-4821</guid>
		<description>Hi Andy, last time I checked the Spring source code, they had changed it so that it doesn&#039;t call conn.setReadOnly so I do it myself in my own Spring interceptor. The best way to be sure is to try it yourself with some real code though and see.</description>
		<content:encoded><![CDATA[<p>Hi Andy, last time I checked the Spring source code, they had changed it so that it doesn&#8217;t call conn.setReadOnly so I do it myself in my own Spring interceptor. The best way to be sure is to try it yourself with some real code though and see.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andy</title>
		<link>http://gabrito.com/post/load-balancing-across-mysql-servers-using-jdbc/comment-page-1#comment-4411</link>
		<dc:creator>Andy</dc:creator>
		<pubDate>Sun, 06 Aug 2006 12:58:23 +0000</pubDate>
		<guid isPermaLink="false">http://gabrito.com/post/load-balancing-across-mysql-servers-using-jdbc#comment-4411</guid>
		<description>hi,
i am using the Spring transaction framework. this should set readOnly(true) automatically?

i am right ?</description>
		<content:encoded><![CDATA[<p>hi,<br />
i am using the Spring transaction framework. this should set readOnly(true) automatically?</p>
<p>i am right ?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Todd Huss</title>
		<link>http://gabrito.com/post/load-balancing-across-mysql-servers-using-jdbc/comment-page-1#comment-1131</link>
		<dc:creator>Todd Huss</dc:creator>
		<pubDate>Wed, 31 May 2006 16:00:38 +0000</pubDate>
		<guid isPermaLink="false">http://gabrito.com/post/load-balancing-across-mysql-servers-using-jdbc#comment-1131</guid>
		<description>Hibernate will not do it for you so the latter is what you need to do, however, I would abstract all of the transaction management and setting readonly of the connection out as an interceptor.</description>
		<content:encoded><![CDATA[<p>Hibernate will not do it for you so the latter is what you need to do, however, I would abstract all of the transaction management and setting readonly of the connection out as an interceptor.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jack Gorden</title>
		<link>http://gabrito.com/post/load-balancing-across-mysql-servers-using-jdbc/comment-page-1#comment-1129</link>
		<dc:creator>Jack Gorden</dc:creator>
		<pubDate>Wed, 31 May 2006 12:47:45 +0000</pubDate>
		<guid isPermaLink="false">http://gabrito.com/post/load-balancing-across-mysql-servers-using-jdbc#comment-1129</guid>
		<description>One question regarding Hibernate ... does it do the required con.setReadOnly calls behind the scenes or did you use the raw connection?

@@ Read/Write @@

factory.getCurrentSession().beginTransaction();

// Do some work
factory.getCurrentSession().save(...);

factory.getCurrentSession().getTransaction().commit();

Or:

boolean readOnly = factory.getCurrentSession().connection().getReadOnly();
factory.getCurrentSession().connection().setReadOnly(false);
factory.getCurrentSession().beginTransaction();

// Do some work
factory.getCurrentSession().save(...);

factory.getCurrentSession().getTransaction().commit();
factory.getCurrentSession().connection().setReadOnly(readOnly);

@@ Read-Only @@

factory.getCurrentSession().beginTransaction();

// Do some work

factory.getCurrentSession().getTransaction().commit();

Or:

boolean readOnly = factory.getCurrentSession().connection().getReadOnly();
factory.getCurrentSession().connection().setReadOnly(true);
factory.getCurrentSession().beginTransaction();

// Do some work

factory.getCurrentSession().getTransaction().commit();
factory.getCurrentSession().connection().setReadOnly(readOnly);</description>
		<content:encoded><![CDATA[<p>One question regarding Hibernate &#8230; does it do the required con.setReadOnly calls behind the scenes or did you use the raw connection?</p>
<p>@@ Read/Write @@</p>
<p>factory.getCurrentSession().beginTransaction();</p>
<p>// Do some work<br />
factory.getCurrentSession().save(&#8230;);</p>
<p>factory.getCurrentSession().getTransaction().commit();</p>
<p>Or:</p>
<p>boolean readOnly = factory.getCurrentSession().connection().getReadOnly();<br />
factory.getCurrentSession().connection().setReadOnly(false);<br />
factory.getCurrentSession().beginTransaction();</p>
<p>// Do some work<br />
factory.getCurrentSession().save(&#8230;);</p>
<p>factory.getCurrentSession().getTransaction().commit();<br />
factory.getCurrentSession().connection().setReadOnly(readOnly);</p>
<p>@@ Read-Only @@</p>
<p>factory.getCurrentSession().beginTransaction();</p>
<p>// Do some work</p>
<p>factory.getCurrentSession().getTransaction().commit();</p>
<p>Or:</p>
<p>boolean readOnly = factory.getCurrentSession().connection().getReadOnly();<br />
factory.getCurrentSession().connection().setReadOnly(true);<br />
factory.getCurrentSession().beginTransaction();</p>
<p>// Do some work</p>
<p>factory.getCurrentSession().getTransaction().commit();<br />
factory.getCurrentSession().connection().setReadOnly(readOnly);</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mathias Bogaert</title>
		<link>http://gabrito.com/post/load-balancing-across-mysql-servers-using-jdbc/comment-page-1#comment-27</link>
		<dc:creator>Mathias Bogaert</dc:creator>
		<pubDate>Thu, 02 Feb 2006 10:17:57 +0000</pubDate>
		<guid isPermaLink="false">http://gabrito.com/post/load-balancing-across-mysql-servers-using-jdbc#comment-27</guid>
		<description>Exactly what I needed. Didn&#039;t know this was possible, thanks!</description>
		<content:encoded><![CDATA[<p>Exactly what I needed. Didn&#8217;t know this was possible, thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark Matthews</title>
		<link>http://gabrito.com/post/load-balancing-across-mysql-servers-using-jdbc/comment-page-1#comment-26</link>
		<dc:creator>Mark Matthews</dc:creator>
		<pubDate>Wed, 01 Feb 2006 17:33:46 +0000</pubDate>
		<guid isPermaLink="false">http://gabrito.com/post/load-balancing-across-mysql-servers-using-jdbc#comment-26</guid>
		<description>Todd,

Let me know how it goes, and if you find any issues that need to be addressed! I&#039;m always glad to see folks try this kind functionality, as I think it&#039;s one of the value-add&#039;s MySQL&#039;s JDBC driver brings.</description>
		<content:encoded><![CDATA[<p>Todd,</p>
<p>Let me know how it goes, and if you find any issues that need to be addressed! I&#8217;m always glad to see folks try this kind functionality, as I think it&#8217;s one of the value-add&#8217;s MySQL&#8217;s JDBC driver brings.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

