Code:
public int insertStudent(Bean b)
	{
		//This method is used for inserting values into the student account database
		PropertyConfigurator.configure(GenericConstants.LOGPATH);
		Statement statement=null;
		
		Connection con =c.getConnection();
		logger.error("["+DateUtil.getSysDateTime()+"]::Connection Established Successfully :: CreateAccount");

		logger.debug("["+DateUtil.getSysDateTime()+"]::Debugging CreateAccount "); 

		logger.info("["+DateUtil.getSysDateTime()+"]::This class has the functionality of creating both Student and Nsep Account"); 

		logger.warn("["+DateUtil.getSysDateTime()+"]::Inserting Student details"); 
		
		
		
		int flag=1;
		
		
		try 
		{
			
			statement= con.createStatement();
			statement.executeUpdate("Insert into Student1 values(" + b.studentId + "," + b.stdAccId+ "," + b.accnum+ "," + b.currentBal + ","+b.ystudy+","+b.commitAmt+")");
			
		
			
			ResultSet rs = statement.executeQuery("SELECT * FROM Student1" );
			
			
			
			while( rs.next())
			{		
			
					
				studentId.add(rs.getInt(1));
				accntId.add(rs.getInt(2));
				accnum.add(rs.getInt(3));
				 curntBal.add(rs.getInt(4));
				 curyr.add(rs.getInt(5));
				 
				 commitAmt.add(rs.getInt(6));
				
				
			}
			
			
		}
			
		catch (SQLException e)
		{
			flag=0;
			logger.error("SQLException in CreateAccount :: "+e);

		}finally{
			try {
				con.close();
			} catch (SQLException e) {
				
				logger.error("SQLException Unable to close connection in CreateAccount :: "+e);
				flag=0;
			}
		}

			return flag;
	}

Last edited by shabbir; 9Dec2011 at 09:19.. Reason: Code blocks