The main loop of the code is as follows :
while(rs.next()) // 2.5 million rows loop
{
Customer custObj = new Customer();
Hashtable attr_name_values = custObj.getAttributesBuffer();
usr_id=rs.getString("usr_id").trim();
Enumeration xmlnames=primary_info_ht.keys();
while(xmlnames.hasMoreElements())
{
column_key =(
String)xmlnames.nextElement();
attr_name=(String)primary_info_ht.get(column_key);
attr_value=(String)rs.getString(column_key);
if(attr_value != null)
{
attr_name_values.put(attr_name, attr_value);
}
}
1. Executes first prepared statement and closes the result set.
2. Executes second prepared statement and closes the result set.
3. Executes third prepared statement and closes the result set.
custObj.generateXML(fos); // This function uses a string buffer creates valid xml elements for a customer and prints to a file (not using dom or sax)
attr_name_values = null;
custObj = null;
}
All prepared statements are created before looping through the main result set.