I was visiting recently one of our customer’s site . Customer complaint about one module which didn’t work for him. Finally I found that the problem is with the following piece of code
PreparedStatement stmt = _dbConn.prepareStatement(“select decode(attr,‘ATTRIBUTE1’,’COLUMN’,null) from xx_entities”);
stmt.setString(1, packageName);
stmt.setInt(2, packageLineNum);
rs= (ResultSet)stmt.executeQuery();
 StringBuffer result= new StringBuffer(); result.append("<parameters>"); while (rs.next())result.append("<argument><name>"+rs.getString("param_name")+"</name><value>"+rs.getString("column_value")+"</value></argument>");
 result.append("</parameters>");        return result.toString();The funny part what SQL statement was running just fine from any SQL client and retuned good result, but when running from java the ResultSet object was always empty!! I always got "<parameters></parameters>”
After straggling for several hours, one of my colleagues found the solution. He told me "Hei, check the LC_ALL variable” , and so I did. The value was “ru_RU.cp1251”. As soon as I changed it to “en-US” it worked immediately.
 
 
No comments:
Post a Comment