And Todays’s Quote Would Be..

Life begins at the end of your comfort zone.

Neale Donald Walsch

Error No Buffer Space Available when Using Java, MyBatis and MySql

I’ve met a very weird error, that are not supposed to happen, when using MyBatis and MySql. Somehow my Windows OS is running out of ports, this is the complete stacktrace.

Caused by: No buffer space available (maximum connections reached?): connect
    at Method)
    at Source)
    at Source)
    at Source)
    at Source)
    at Source)
    at Source)
    at<init>(Unknown Source)
    at<init>(Unknown Source)
    at com.mysql.jdbc.StandardSocketFactory.connect(
    at com.mysql.jdbc.MysqlIO.<init>(]

I found out it happened because im using traditional unpooled connection, changing it into pooled connection in MyBatis solved it.

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE configuration
PUBLIC "-// Config 3.0//EN"
    <environments default="development">
        <environment id="development">
            <transactionManager type="JDBC"/>
            <dataSource type="POOLED">
                <property name="driver" value="com.mysql.jdbc.Driver"/>
                <property name="url" value="jdbc:mysql://localhost/xxxx"/>
                <property name="username" value="xxxx"/>
                <property name="password" value=""/>
                <property name="poolMaximumActiveConnections" value="20"/>


[Weird Issue] Slow Database Query Which only Happen in Windows Server 2008 64Bit

Several days ago, i was asked by my friend to fix one of his weird issue. A same java webapp deployed on two different Operating System, Windows Server 2003 32bit and Windows Server 2008 64bit, gives two different performance. The webapp runs well on Windows Server 2003, while at the same time have a very poor performance on Windows Server 2008. Same identical infrastructure, the only differences is the Windows Server version.

Later i will show you how to fix this issue, but first let me show what the infrastructure looks like. Basically, it’s a three tier infrastructure, a load balancer, multiple webserver and database server. At first, i thought that the bottleneck is on network infrastructure, but the network guy says that there is nothing wrong on network’s monitoring.

After several days monitoring, i found out that the main culprit is Windows Server 2008. Somehow there are some issues on network outbound causing a very slow database queries.

So this is to fix it, first via netsh interface

netsh interface tcp set global rss=disabled
netsh interface tcp set global autotuning=disabled
netsh interface tcp set global chimney=disabled



Next is disabling QoS Packet Scheduler,

And last is adding a TcpNoDelay variable in windows server’s regedit, which located at HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Tcpip\Parameters

After i run those command and restart my machine, my application on Windows Server 2008 run smoothly.


Download A Free Screen Recorder Software (CamStudio), and get A Lot of Crapware

Today i decided to download free Camstudio application from, and perhaps it’s my fault for not reading Terms and Condition, just simple next and next, accept and accept, but what i got is so many crapware.

This is for example,

And i dont even know, what else crapware that i got.
TL;DR, dont use CamStudio, because i uninstalled like 5 minutes after i download this application.


remove highstair application from control panel, it will help remove the unwanted ads on your browsers.


Database KodePos Seluruh Indonesia

Awalnya iseng-iseng mencari data kodepos seluruh Indonesia, akhirnya dapet juga setelah email secara resmi ke PT Pos Indonesia. Namun file yang dikirimkan oleh PT Pos berupa file Excel (xls), walaupun dengan sedikit effort akhirnya bisa juga diimport ke database MySql.

Oh ya, file SQL-nya bisa didownload dari Github gw,

Semoga bisa membantu :-)


[Java] Creating a Microsoft Word Report Easily using Servlet and A Plain HTML Template

Yesterday one of my friend, Edward Barchia, asked me a very simple question, “how can i creating an MSWord Report without using Jasper Report”. Because somehow, jasper report creates a very weird output when exported into Word file (.doc).

One fastest solution is using a html file, and renamed into .doc. Not an elegant solution, but perhaps (at that moment) is the best solution we had.

Okay, so basically what i need is only 2 files, 1 html template and a java servlet files. This is my HTML template, i put it on drie E and name it hello.html

		Test, hello ${name}

And this is my servlet file,

package com.edw.testdownloaddoc.servlet;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@WebServlet(name = "downloadServlet", urlPatterns = {"/downloadServlet"})
public class DownloadServlet extends HttpServlet {

    protected void processRequest(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        BufferedReader downloadFile = new BufferedReader(new FileReader("e:\\hello.html"));
        FileInputStream inputStream = null;
        OutputStream outStream = null;
        try {
            String s;
            StringBuilder sb = new StringBuilder();
            while ((s=downloadFile.readLine()) != null) {
                    s = s.replace("${name}", "Edwin");
            response.setContentLength((int) sb.toString().length());
            // response header
            String nameFile = "hello.doc";
            String headerKey = "Content-Disposition";
            String headerValue = String.format("attachment; filename=\"%s\"",nameFile);
            response.setHeader(headerKey, headerValue);
            // Write response
            outStream = response.getOutputStream();
            IOUtils.write(sb.toString(), outStream);
        } catch (Exception e) {
        } finally{

    protected void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        processRequest(request, response);

Oh, and before i forgot, this is my pom.xml dependencies


This is the final output looks like,