Note that there are some explanatory texts on larger screens.

plurals
  1. POMySQL traffic compression with connection pool
    primarykey
    data
    text
    <p>I am trying to implement Connection Pooling using Commons Pool and DBCP. I am able to establish a connection to the database and everything works as expected, except traffic compression. <BR/> This is my configuration:<BR/> - Commons DBCP 1.4<BR/> - Commons Pool 1.6<BR/> - MySQL Connector Java 5.1.21<BR/> - MySQL Server 5.5 on Windows Server 2008<BR/> - Java 1.6<BR/></p> <p>Please consider this code snippet to instantiate the connection pool:</p> <pre><code>private void setupDataSource(Hashtable&lt;String, String&gt; data) { try { GenericObjectPool&lt;Connection&gt; pool = new GenericObjectPool&lt;Connection&gt;(); pool.setMinIdle(5); pool.setMaxActive(-1); pool.setTestOnBorrow(true); pool.setTimeBetweenEvictionRunsMillis(5000); pool.setMinEvictableIdleTimeMillis(300000); Properties props = new Properties(); props.setProperty("user", "root"); props.setProperty("password", "password"); props.setProperty("useCompression", "true"); ConnectionFactory cf = new DriverConnectionFactory(new com.mysql.jdbc.Driver(), "jdbc:mysql://" + ip + ":" + port, props); KeyedObjectPoolFactory&lt;String, GenericObjectPool&lt;Connection&gt;&gt; kopf =new GenericKeyedObjectPoolFactory&lt;String, GenericObjectPool&lt;Connection&gt;&gt;(null, 20, GenericObjectPool.WHEN_EXHAUSTED_GROW, 20, true, false); PoolableConnectionFactory pcf = new PoolableConnectionFactory(cf, pool, kopf, "Select 1;", false, true); PoolingDriver pd = new PoolingDriver(); pd.registerPool("MyPool", pool); }catch (Exception ex) { ex.printStackTrace(); } } </code></pre> <p>Then, to obtain a connection i use:</p> <pre><code>Connection conn = java.sql.DriverManager.getConnection("jdbc:apache:commons:dbcp:MyPool"); </code></pre> <p>First, is there another way to check if compression works, except comparing the outgoing network traffic in MSQL Tools?</p> <p>And what needs to be changed in order to enable compression?</p> <p>Thanks for your help</p> <p>klib</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload