Close

August 12, 2009

Netbeans 6.7 Database Explorer Timeout Workaround

I had small issue recently in that the Netbeans 6.7 database explorer was timing out just trying to connect to my production database. Apparently the Mysql server needs to respond back within a few mili-seconds and there are no configuration settings in Netbeans to increase this timeout. Our production database has an initial lag time when you first connect, but it is pretty zippy thereafter (I suspect my cheap home based switches or my Windows computer).

The problem is that I needed to use Netbeans’s built in Hibernate “reverse engineering” plugin for a new project. That piece depends on being able to connect to the database using the Netbeans database explorer. Since my poor database wouldn’t respond fast enough, I couldn’t use it in Netbeans.

Putty to the rescue! Using a putty tunnel, I setup a local tunnel for port 3306 (mysql’s default port) and created a direct connection to the linux box. Now my database connection is both secure AND is quickly recognized in netbeans. The direct tunnel approach cleared out the lag!

To make it even more useful, I created a quick COMMAND file that I copied into the folder that I keep putty. I can simply click my “secureMySQLProduction.cmd” file, and login to my remote server.

putty -L 3306:localhost:3306  [email protected]

Linux/Nix users can switch out “putty” and use the system default “ssh” program instead.

Hope this helps someone else out!