Advertisement
Guest User

Untitled

a guest
Mar 2nd, 2017
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.43 KB | None | 0 0
  1. import java.sql.Connection;
  2. import java.sql.PreparedStatement;
  3. import java.sql.SQLException;
  4. import java.util.*;
  5. import lotus.domino.*;
  6.  
  7.  
  8. public class BANCOLOMBIALandingZone {
  9.  
  10. private Session ss;
  11. private Database db;
  12. private View vwEstSigXEstIni;
  13. private View vwPorRadicado;
  14. private Document docSolCredito;
  15. private DateTime dtmHoy;
  16. private IASJavaLog objLog;
  17. private IASJavaConexion objConexion;
  18. private BANCOLOMBIAAccesoParamInterno objAccesoParam;
  19. private MemoryUsageMetter metter;
  20.  
  21. public BANCOLOMBIALandingZone(BANCOLOMBIAAccesoParamInterno objAccesoParam, IASJavaLog objLog) {
  22. String strEncabezadoError = "Error en el constructor BANCOLOMBIALandingZone. ";
  23. try {
  24. this.ss = NotesFactory.createSession();
  25. this.db = ss.getAgentContext().getCurrentDatabase();
  26. this.objAccesoParam = objAccesoParam;
  27. this.objLog = objLog;
  28. this.objConexion = new IASJavaConexion(objLog);
  29. this.metter = new MemoryUsageMetter(Runtime.getRuntime(), objLog);
  30. this.metter.check();
  31.  
  32. } catch (Exception e) {
  33. objLog.setRegistroError(0, strEncabezadoError + "\n" + "Excepción: " + e.toString());
  34. System.out.println("Excepcion Constructor Bancolombia Landing Zone");
  35.  
  36. }
  37. }
  38.  
  39. public void GenearaReporte() {
  40. String strEncabezadoError = "Error en el método carga informe LZ. ";
  41. DocumentCollection docCol = null;
  42. Document docConfigGral = null;
  43.  
  44. try {
  45. insertarRegistro();
  46.  
  47.  
  48.  
  49. } catch (Exception e) {
  50. objLog.setRegistroError(0, strEncabezadoError + "\n" + "Excepción: " + e.toString());
  51. objConexion.desconectar();
  52. }
  53. }
  54.  
  55. private void insertarRegistro() throws Exception {
  56.  
  57. Connection dbConnection = null;
  58. PreparedStatement ps = null;
  59. String strNombreTabla = "TBANCOL_LZ";
  60. String strIdConsulta = "CLIENTE";
  61.  
  62. String sql = "INSERT INTO " + strNombreTabla
  63. + "(SOLFECCRE, SOLFECAPR, SOLCODVEN, SOLUSRCRE, SOLCODAPR, SOLNROSOL, SOLVALAPR, SOLESTADO, SOLIDENT, SOLTIPOID) "
  64. + "VALUES (?,?,?,?,?,?,?,?,?,?)";
  65.  
  66. try {
  67. objConexion.conectar("jdbc:oracle:thin:@//192.168.1.251:1522/DBSURA",
  68. "IASPIC_DLL",
  69. "IASPIC_DLL",
  70. "ORACLE");
  71.  
  72. objLog.setRegistro("Realiza conexion");
  73.  
  74. dbConnection = objConexion.con;
  75.  
  76. objLog.setRegistro("Preparar preparestatement");
  77.  
  78. ps = dbConnection.prepareStatement(sql.toString());
  79.  
  80. ps.setString(1, "2017/02/01");
  81. ps.setString(2, "2017/02/30");
  82. ps.setString(3, "PRUEBA1");
  83. ps.setString(4, "PRUEBA2");
  84. ps.setString(5, "PRUEBA3");
  85. ps.setString(6, "PRUEBA4");
  86. ps.setString(7, "PRUEBA5");
  87. ps.setString(8, "PRUEBA6");
  88. ps.setString(9, "PRUEBA7");
  89. ps.setString(10, "PRUEBA8");
  90.  
  91. ps.execute();
  92. objLog.setRegistro("Ejecuta insercción");
  93.  
  94.  
  95. } catch (SQLException e) {
  96.  
  97. System.out.println(e.getMessage());
  98. objLog.setRegistro("Error: " + e.getMessage());
  99.  
  100. } finally {
  101.  
  102. if (ps != null) {
  103. ps.close();
  104. }
  105.  
  106. if (dbConnection != null) {
  107. dbConnection.close();
  108. }
  109. }
  110. }
  111. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement