0
Answer

Database application in java

Please Good people I have been able to create a database and application so now I can used the app interface to populate data into the database and also retrieve them into the jframe but am unable to retrieve the image from the database when I do a search. pls help.

below is the code I used to retrieve the data from the database.

try {
            String str = jTextField1.getText();
            Class.forName("org.apache.derby.jdbc.ClientDriver");
           
            con = DriverManager.getConnection("jdbc:derby://localhost:1527/EmployeeDB","administrator","weert");
            PreparedStatement st = con.prepareStatement("select* from administrator.employees where employeeid = ?");
            st.setString(1, jTextField1.getText());
            re = st.executeQuery();
             if(re.next()){
                  //String s = re.getString(1);
                  String s1 = re.getString(2);
                  String s2 = re.getString(3);
                  String s3 = re.getString(4);
                  String s4 = re.getString(5);
                  String s5 = re.getString(6);
                  String s6 = re.getString(7);
                  String s7 = re.getString(8);
                  String s8 = re.getString(9);
                  String s9 = re.getString(10);
                  String s10 = re.getString(11);
                  String s11 = re.getString(12);
                  String s12 = re.getString(13);
                  String s13 = re.getString(14);
                 
                 jLabel2.setText("First Name:");
                 jLabel3.setText(s1);
                 jLabel4.setText("Last Name:");
                 jLabel5.setText(s2);
                 jLabel6.setText("SSNIT No.");
                 jLabel7.setText(s3);
                 jLabel8.setText("Phone Number:");
                 jLabel9.setText(s4);
                 jLabel10.setText("Date of Employment:");
                 jLabel11.setText(s5);
                 jLabel12.setText("Salary:");
                 jLabel13.setText(s6);
                 jLabel14.setText("Gender:");
                 jLabel15.setText(s7);
                 jLabel16.setText("Birth Date:");
                 jLabel17.setText(s8);
                 jLabel18.setText("Department:");
                 jLabel19.setText(s9);
                 jLabel20.setText("Email Address:");
                 jLabel21.setText(s10);
                 jLabel22.setText("Address:");
                 jLabel23.setText(s11);
                 jLabel24.setText("Residence:");
                 jLabel25.setText(s12);              
                 jLabel27.setText("Person to Contact");
                 jTextField11.setText(s13);
             
               
             }else{
                 JOptionPane.showMessageDialog(null, "Name not Found");
             }
              
            } catch (Exception ex) {
                System.out.println(ex);
        }