Wondering where does Windows Service pick the Locale Settings from?

Boy! couple of months back I had encountered an issue where my application which is running as Windows NT Service, always used the Locale settings thats entirely different from what is set in the control panel by the logged in user.

I thought if I had provided an User Account to be used as the credentials for the service, then the windows service might use that particular user’s locale settings. But Hard Luck!

Later on further weaving thru the Windows Registry, realized that windows captures the Locale Settings that I had provided during the initial Installation of the WinXP Operating System.

This basically means Windows maintains TWO Locale information, one about the logged in user and the other which is the default that was provided during Windows Installation.

The following Registry Key stores Current Users Locale Configuration
HKEY_CURRENT_USER\Control Panel\International

The following Registry Key stores the Default Users Locale Configuration
HKEY_USERS\.DEFAULT\Control Panel\International

Tough Find !!!

Oracle 10g Thin Driver setFetchSize() can corrupt Data

Recently, we had our application database upgraded from Oracle 9i to Oracle 10g. And therefore we also upgraded oracle jdbc thin driver accordingly.

We were surprised by a nice “ArrayIndexOutOfBoundsException” when reading data from the ResultSet.

After lots of research, I learnt about an inherent bug in Oracle 10g thin driver where if we set the fetchSize on the PreparedStatement we have to set the same fetchSize on the ResultSet as well. This certainly was not the case with previous versions of Oracle.

To my knowledge this bug is not fixed yet. The workaround until then is to set the FetchSize on the ResultSet object whenever you set the FetchSize on the PreparedStatement.

Code snippet:

PreparedStatement ps = conn.prepareStatement(“Select * from some_table”);
ps.setFetchSize(20);
ResultSet rs = rs.executeQuery();
//rs.setFetchSize(20); //Uncomment this line to reproduce the issue.
while (rs.next()) {
// … process the row
}