Saturday, October 31, 2009

mysql-java-connector: ResultSet getObject failure on Timestamp column if null

I had strange situation working with ResultSet when fetching Timestamp column from MyTable.

import java.sql.DriverManager;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;

Connection connection = DriverManager.getConnection(
"username", "password");

Statement statement = connection.createStatement();
ResultSet rs = statement.executeQuery("SELECT timestamp_column FROM mytable");

while( {

The cause of the failure was due to null value in timestamp_column !

The solution suggested about (zeroDateTimeBehavior=convertToNull) in the article, helped me overcome the failure.

All you need to do is:
Connection connection = DriverManager.getConnection(
"username", "password");

Wednesday, October 28, 2009

Eclipse Editor - Setting Line Delimiter Style

Was going crazy with my eclipse as line delimiter was different than other editors. This was causing issue with SVN commits (mixed line delimiters!)

Finally, found the way of setting the line preferences for Eclipse.

It is located under: Windows > Preferences > General > Workspace

This page is powered by Blogger. Isn't yours?