الانتقال إلى المحتوى
View in the app

A better way to browse. Learn more.

مجموعة مستخدمي أوراكل العربية

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

مشكلة فى كود بيرن التقارير

Featured Replies

بتاريخ:

السلام عليكم 

عندي مشكلة فى الكود اللي بيعمل run  للتقارير

انه بيسيب connection to database  مفتوحه

وبعد فتح 10 تقارير مش بيفتح تقارير تاني

وده الكود اللي شغال بيها

        public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        
        
        
        PreparedStatement st = null;

        String amDef = "STORE1.AppModuleSTORE1Impl";
        String config = "AppModuleSTORE1Local";

        AppModuleSTORE1Impl am = (AppModuleSTORE1Impl)Configuration.createRootApplicationModule(amDef, config);
        st = am.getDBTransaction().createPreparedStatement("select 1 from dual", 0);
        Connection conn = null;

        String reportName = request.getParameter("rn");
        String id = request.getParameter("id");
        
        try {
        conn = st.getConnection();
        } catch (SQLException e) {
        // TODO: Add catch code
        System.out.println("error 1 getDBTransaction jasper : " + e.getMessage());
        }

        InputStream input =
        new FileInputStream(new File(getServletConfig().getServletContext().getRealPath("/Reports/" + reportName +
                                                                                        ".jrxml")));
        JasperDesign design = null;

        try {
        design = JRXmlLoader.load(input);
        } catch (JRException e) {
        // TODO: Add catch code
        System.out.println("error 2 JasperDesign JRXmlLoader : " + e.getMessage());
        }

        JasperReport report = null;

        try {
        report = JasperCompileManager.compileReport(design);
        report = (JasperReport)JRLoader.loadObject(input);
        report.setWhenNoDataType(WhenNoDataTypeEnum.NO_DATA_SECTION);
        } catch (JRException e) {
        // TODO: Add catch code
        System.out.println("error 3 JasperReport JasperCompileManager.compileReport No Data : " + e.getMessage());
        }

        // Set Parm
        Map parm = new HashMap();
        parm.put("pr1", id); // DeptNo Name Parm Jasper Report

        JasperPrint jasperPrint = null;

        try {
        jasperPrint = JasperFillManager.fillReport(report, parm, conn);
        } catch (JRException e) {
        // TODO: Add catch code
        System.out.println("error 4 JasperPrint JasperFillManager.fillReport : " + e.getMessage());
        }

        // System.out.println("Report Created...");
        OutputStream ouputStream = response.getOutputStream();

        // Report PDF Format
        response.setContentType("application/pdf");
        response.setHeader("Cache-Control", "max-age=0");

        JRExporter exporter = new JRPdfExporter();
        exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
        exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, ouputStream);

        try {
        exporter.exportReport();
        } catch (JRException e) {
        System.out.println("error 6 JRExporter exporter formats : " + e.getMessage());
        throw new ServletException(e);
        } finally {
        if (ouputStream != null) {
            try {
                ouputStream.flush();
                ouputStream.close();

            } catch (IOException ex) {
                System.out.println(ex.getMessage());
                throw (ex);
            }
        }
        }
        // /jasperservlet?rn=allData&id=0
        // /jasperservlet?rn=parm&id=value
        // /jasperservlet?rn=#{requestContext.rightToLeft ? 'report arabic' : 'report english'}&id=0
        }
        }
        
    

بتاريخ:
  • كاتب الموضوع

تم الحل 

تم وضع conn.close();  داخل try 

انضم إلى المناقشة

يمكنك المشاركة الآن والتسجيل لاحقاً. إذا كان لديك حساب, سجل دخولك الآن لتقوم بالمشاركة من خلال حسابك.

زائر
أضف رد على هذا الموضوع...

برجاء الإنتباه

بإستخدامك للموقع فأنت تتعهد بالموافقة على هذه البنود: سياسة الخصوصية

Account

Navigation

البحث

إعداد إشعارات المتصفح الفورية

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.