sudah saya tutup kok.. di kelas ini ada beberapa method untuk akses ke 
database. diantaranya method ini :

 public ArrayList nm_method( String no, String tgl, String tipe) throws 
DAOException {

        Connection connection = null;
        PreparedStatement ps = null;
        ResultSet rs = null
        ArrayList arrayList = new ArrayList();

        try {
            connection = getConnection();
            String queryL = "SELECT bla bla bla";
            ps = connection.prepareStatement(queryL );
            ps.setObject(1, no);
            ps.setObject(2, tgl);
            ps.setObject(3, tipe);
            rs = ps.executeQuery();

            while (rs.next()) {
                arrayList.add(rs.getString("type"));
            }

        } catch (Exception ex) {
            
            System.out.println("error : " + ex.getMessage());
            
            arrayList = null;
        } finally {
            try {
                if (rs != null)rs.close();
                if (ps!= null)ps.close();

                if (connection != null)connection.close();

            } catch (SQLException ex) {
                ex.printStackTrace();
                System.out.println("Error  : " + ex.getMessage());
                throw new DAOException ();
            }
        }

        return arrayList;
    }

getConnecttion itu extends ke kelas DAOJava..
kira2 knp yach ?



Kirim email ke