src/com/shrewdify/diaroser/utils/DbHelper.java
public void init(String className, String dbhost, String dbname,
			String dbuser, String dbpassword) throws SQLException,ClassNotFoundException{
			Class.forName(className);
			connection = DriverManager.getConnection("jdbc:mysql://" + dbhost
					+ ":3306/" + dbname, dbuser, dbpassword);
			psSta3 = connection
					.prepareStatement("SELECT connectcharge,ratetariff,blockperiod FROM charging_data_rates ccr WHERE ? LIKE CONCAT(ccr.dialprefix,'%') and ccr.idtariffplan = (SELECT a.idtariffmapper from charging_plans a where a._id = (select chargingplanid from userinfos where userid=?)) order by length(ccr.dialprefix) desc limit 1");
			psSta = connection
					.prepareStatement("SELECT * FROM activecallsdata where SessionId =?");
			psStaUpd = connection
					.prepareStatement("update activecallsdata set phoneData=? where SessionId=?");
			psStaUpd1 = connection
					.prepareStatement("insert into activecallsdata(SessionId,PhoneData)values(?,?)");
			psStaUpd2 = connection
					.prepareStatement("delete from activecallsdata where LastModified <= ?");
			psgetBalance = connection
					.prepareStatement("select * from userinfos where userid = ?");
			psUpdBalance = connection
					.prepareStatement("update userinfos set ReservedUnits= ? where userid = ?");
			psUpdUserFinaBal = connection
					.prepareStatement("update userinfos set ReservedUnits=ReservedUnits- ?, Units=Units- ? where userid = ?");
			psSta1 = connection
					.prepareStatement("SELECT mprice FROM charging_data_rates ccr WHERE ? LIKE CONCAT(ccr.dialprefix,'%') and ccr.idtariffplan = (SELECT a.idtariffmapper from charging_plans a where a._id = (select chargingplanid from userinfos where userid=?)) order by length(ccr.dialprefix) desc limit 1");
			psActiveCallLis = connection
					.prepareStatement("SELECT * FROM activecallsdata WHERE sessionId =? ");
			psCdrRecords = connection.prepareStatement("INSERT INTO pp_cdrecords(dlgid, stepnumber,src_username,"
					+ "src_hostname, dest_addr, start_time,end_time,account, cost, consumed_time, charge_mode, "
					+ "rate_card, connect_charge) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?)");
			psGetExpiredSessions= connection.prepareStatement("Select sessionid from activecallsdata where LastModified <= ?");
			
	}
/**
	 * 
	 * @param className   // Contains the type of Driver to be loaded
	 * @param dbhost 	  // Contains host address of Data Base.
	 * @param dbname 	  // Contains DataBase Name 
	 * @param dbuser 	  // User Name Used to connect.
	 * @param dbpassword  // Password for the user to connect.
	 * @throws SQLException
	 * @throws ClassNotFoundException
	 * 
	 * It initializes the data base connection With above parameters and creates all the prepared statements used for dbOperations.  
	 */
@param className   // Contains the type of Driver to be loaded
@param dbhost          // Contains host address of Data Base.
@param dbname          // Contains DataBase Name
@param dbuser          // User Name Used to connect.
@param dbpassword  // Password for the user to connect.

It initializes the data base connection With above parameters and creates all the prepared statements used for dbOperations.
@param className // Contains the type of Driver to be loaded @param dbhost // Contains host address of Data Base . @param dbname // Contains DataBase Name @param dbuser // User Name Used to connect . @param dbpassword // Password for the user to connect . It initializes the data base connection With above parameters and creates all the prepared statements used for dbOperations .
public void init(String className, String dbhost, String dbname,
			String dbuser, String dbpassword) throws SQLException,ClassNotFoundException{
			Class.forName(className);
			connection = DriverManager.getConnection("jdbc:mysql://" + dbhost
					+ ":3306/" + dbname, dbuser, dbpassword);
			psSta3 = connection
					.prepareStatement("SELECT connectcharge,ratetariff,blockperiod FROM charging_data_rates ccr WHERE ? LIKE CONCAT(ccr.dialprefix,'%') and ccr.idtariffplan = (SELECT a.idtariffmapper from charging_plans a where a._id = (select chargingplanid from userinfos where userid=?)) order by length(ccr.dialprefix) desc limit 1");
			psSta = connection
					.prepareStatement("SELECT * FROM activecallsdata where SessionId =?");
			psStaUpd = connection
					.prepareStatement("update activecallsdata set phoneData=? where SessionId=?");
			psStaUpd1 = connection
					.prepareStatement("insert into activecallsdata(SessionId,PhoneData)values(?,?)");
			psStaUpd2 = connection
					.prepareStatement("delete from activecallsdata where LastModified <= ?");
			psgetBalance = connection
					.prepareStatement("select * from userinfos where userid = ?");
			psUpdBalance = connection
					.prepareStatement("update userinfos set ReservedUnits= ? where userid = ?");
			psUpdUserFinaBal = connection
					.prepareStatement("update userinfos set ReservedUnits=ReservedUnits- ?, Units=Units- ? where userid = ?");
			psSta1 = connection
					.prepareStatement("SELECT mprice FROM charging_data_rates ccr WHERE ? LIKE CONCAT(ccr.dialprefix,'%') and ccr.idtariffplan = (SELECT a.idtariffmapper from charging_plans a where a._id = (select chargingplanid from userinfos where userid=?)) order by length(ccr.dialprefix) desc limit 1");
			psActiveCallLis = connection
					.prepareStatement("SELECT * FROM activecallsdata WHERE sessionId =? ");
			psCdrRecords = connection.prepareStatement("INSERT INTO pp_cdrecords(dlgid, stepnumber,src_username,"
					+ "src_hostname, dest_addr, start_time,end_time,account, cost, consumed_time, charge_mode, "
					+ "rate_card, connect_charge) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?)");
			psGetExpiredSessions= connection.prepareStatement("Select sessionid from activecallsdata where LastModified <= ?");
	}
public void init ( String className , String dbhost , String dbname , String dbuser , String dbpassword ) throws SQLException , ClassNotFoundException { Class . forName ( className ) ; connection = DriverManager . getConnection ( "jdbc:mysql://" + dbhost + ":3306/" + dbname , dbuser , dbpassword ) ; psSta3 = connection . prepareStatement ( "SELECT connectcharge,ratetariff,blockperiod FROM charging_data_rates ccr WHERE ? LIKE CONCAT(ccr.dialprefix,'%') and ccr.idtariffplan = (SELECT a.idtariffmapper from charging_plans a where a._id = (select chargingplanid from userinfos where userid=?)) order by length(ccr.dialprefix) desc limit 1" ) ; psSta = connection . prepareStatement ( "SELECT * FROM activecallsdata where SessionId =?" ) ; psStaUpd = connection . prepareStatement ( "update activecallsdata set phoneData=? where SessionId=?" ) ; psStaUpd1 = connection . prepareStatement ( "insert into activecallsdata(SessionId,PhoneData)values(?,?)" ) ; psStaUpd2 = connection . prepareStatement ( "delete from activecallsdata where LastModified <= ?" ) ; psgetBalance = connection . prepareStatement ( "select * from userinfos where userid = ?" ) ; psUpdBalance = connection . prepareStatement ( "update userinfos set ReservedUnits= ? where userid = ?" ) ; psUpdUserFinaBal = connection . prepareStatement ( "update userinfos set ReservedUnits=ReservedUnits- ?, Units=Units- ? where userid = ?" ) ; psSta1 = connection . prepareStatement ( "SELECT mprice FROM charging_data_rates ccr WHERE ? LIKE CONCAT(ccr.dialprefix,'%') and ccr.idtariffplan = (SELECT a.idtariffmapper from charging_plans a where a._id = (select chargingplanid from userinfos where userid=?)) order by length(ccr.dialprefix) desc limit 1" ) ; psActiveCallLis = connection . prepareStatement ( "SELECT * FROM activecallsdata WHERE sessionId =? " ) ; psCdrRecords = connection . prepareStatement ( "INSERT INTO pp_cdrecords(dlgid, stepnumber,src_username," + "src_hostname, dest_addr, start_time,end_time,account, cost, consumed_time, charge_mode, " + "rate_card, connect_charge) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?)" ) ; psGetExpiredSessions = connection . prepareStatement ( "Select sessionid from activecallsdata where LastModified <= ?" ) ; }
@param className   // Contains the type of Driver to be loaded
 @param dbhost          // Contains host address of Data Base.
@param className // Contains the type of Driver to be loaded @param dbhost // Contains host address of Data Base .