الانتقال إلى المحتوى
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.

مساعدة عرض الصور المخزنة في قاعدة البيانات على صفحة Adf

Featured Replies

بتاريخ:

 


أنا عندي مشكلة عرض الصور المخزنة في قاعدة البيانات على صفحة ADF , استخدمت ShowImage Servlet  لعمل ذلك ولكن للأسف الصور لاتظهر
كود السيرفلت هو كالتالي :


public class showImage extends HttpServlet {
    private static final String CONTENT_TYPE = "image/gif; charset=utf-8";

    public void init(ServletConfig config) throws ServletException {
        super.init(config);
    }

    public void doGet(HttpServletRequest request,
                      HttpServletResponse response) throws ServletException,
                                                           IOException {
        

        response.setContentType(CONTENT_TYPE);
        String imageId = request.getParameter("id");
        OutputStream os = response.getOutputStream();
        Connection conn = null;
        try {
            Context ctx = new InitialContext();            
            conn = getOracleConnection();
            PreparedStatement statement =
                conn.prepareStatement("SELECT Employee_id,pic " +
                                      "FROM Employees " +
                                      "WHERE Employee_id = ?");
            statement.setInt(1, new Integer(imageId));
            ResultSet rs = statement.executeQuery();

            if (rs.next()) {
                Blob blob = rs.getBlob("PIC");                
                BufferedInputStream in = new BufferedInputStream(blob.getBinaryStream());
                int b;
                byte[] buffer = new byte[10240];
                while ((b = in.read(buffer, 0, 10240)) != -1) {
                    os.write(buffer, 0, ;
                }
                os.close();
            }
        } catch (Exception e) {
            System.out.println(e);
        } finally {
            try {
                if (conn != null) {
                    conn.close();
                }
            } catch (SQLException sqle) {
                System.out.println("SQLException error");
            }
        }
    }
    public static Connection getOracleConnection() throws Exception {
      String driver = "oracle.jdbc.driver.OracleDriver";
      String url = "jdbc:oracle:thin:@localhost:1521:xe";
      String username = "hr";
      String password = "hr";

      Class.forName(driver); // load Oracle driver
      Connection conn = DriverManager.getConnection(url, username, password);
      return conn;
    }

}





 

بتاريخ:

يبدو الكود سليماً ، ما المشكلة فيه؟

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

الصورة لاتظهر في الصفحة مع أني عدلت على خاصية source

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

شكرًا مهندس ماجد
هل ممكن أرسل المثال اللي عملته على الايميل علما بانه على إسكيمة HR فقط أضفت عمودين pic و notes على جدول الموظفين

بتاريخ:

وكيف تم عرضها على الصفحة؟

بتاريخ:

 wedada

 

imageId تم تعريفه بالأعلى على أنه String 

إذن الخطأ في السطر التالي لم تتعامل معه كـ String

statement.setInt(1, new Integer(imageId));

الصحيح هو 

statement.setString(1,(imageId));

تأكدت من الكود بعد التعديل الذي ذكرته أعلاه وتم التفيذ عندي بشكل صحيح 

بتاريخ:

مفيش طريقة لعرض الصور غير الservet

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

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

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

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

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

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.