package xin.glue.user.common; import java.sql.CallableStatement; import java.sql.SQLException; import com.posdata.glue.context.PosContext; import com.posdata.glue.dao.PosGenericDao; import com.posdata.glue.util.log.PosLog; import com.posdata.glue.util.log.PosLogFactory; public class LogGpError { private static PosLog logger = PosLogFactory.getLogger(LogGpError.class); private static PosGenericDao getDao(String daokey) { return (PosGenericDao)PosContext.getBeanFactory().getBeanObject(daokey); } public static void logMessageToDB (String V_PGM_ID, String V_TABLE_ID, String V_TABLE_MODE, String V_ERR_DESC, String V_RTN_NAME) { //CallableStatement cStmt = getDao("mesdao").getCallableStatement("{call GP_ERROR(?, ?, ?, ?, ?, ?, ?, ?)}"); CallableStatement cStmt = null ; cStmt = getDao("mesdao").getCallableStatement("GP_ERROR"); try { cStmt.setString(1, V_PGM_ID); cStmt.setString(2, V_TABLE_ID); cStmt.setString(3, V_TABLE_MODE); cStmt.setString(4, V_ERR_DESC); cStmt.setString(5, V_RTN_NAME); cStmt.setString(6, ""); cStmt.setString(7, ""); cStmt.registerOutParameter(8, java.sql.Types.VARCHAR); cStmt.execute(); } catch (Exception ex) { logger.logFatal(V_ERR_DESC + " GP_ERROR PROCESS ERROR", ex); } finally { if (cStmt != null) { try { cStmt.close(); } catch (SQLException ex) { logger.logWarn(ex.getMessage(), ex); } } } } }