d3f9f475b9232904bb5aff9b13a3b3a96f52b5f4.svn-base 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. package xin.glue.user.common;
  2. import java.sql.CallableStatement;
  3. import java.sql.SQLException;
  4. import com.posdata.glue.context.PosContext;
  5. import com.posdata.glue.dao.PosGenericDao;
  6. import com.posdata.glue.util.log.PosLog;
  7. import com.posdata.glue.util.log.PosLogFactory;
  8. public class LogGpError
  9. {
  10. private static PosLog logger = PosLogFactory.getLogger(LogGpError.class);
  11. private static PosGenericDao getDao(String daokey)
  12. {
  13. return (PosGenericDao)PosContext.getBeanFactory().getBeanObject(daokey);
  14. }
  15. public static void logMessageToDB (String V_PGM_ID, String V_TABLE_ID, String V_TABLE_MODE, String V_ERR_DESC, String V_RTN_NAME)
  16. {
  17. //CallableStatement cStmt = getDao("mesdao").getCallableStatement("{call GP_ERROR(?, ?, ?, ?, ?, ?, ?, ?)}");
  18. CallableStatement cStmt = null ;
  19. cStmt = getDao("mesdao").getCallableStatement("GP_ERROR");
  20. try
  21. {
  22. cStmt.setString(1, V_PGM_ID);
  23. cStmt.setString(2, V_TABLE_ID);
  24. cStmt.setString(3, V_TABLE_MODE);
  25. cStmt.setString(4, V_ERR_DESC);
  26. cStmt.setString(5, V_RTN_NAME);
  27. cStmt.setString(6, "");
  28. cStmt.setString(7, "");
  29. cStmt.registerOutParameter(8, java.sql.Types.VARCHAR);
  30. cStmt.execute();
  31. } catch (Exception ex)
  32. {
  33. logger.logFatal(V_ERR_DESC + " GP_ERROR PROCESS ERROR", ex);
  34. } finally
  35. {
  36. if (cStmt != null)
  37. {
  38. try
  39. {
  40. cStmt.close();
  41. }
  42. catch (SQLException ex)
  43. {
  44. logger.logWarn(ex.getMessage(), ex);
  45. }
  46. }
  47. }
  48. }
  49. }