0

This is my database data retrieve code, this can only retrieve String data but I want to display image also. How to do it?

    <%
        try {
            connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/distributed","root","");
            statement = connection.createStatement();
            String sql = "select * from product where id = '1'";
            resultSet = statement.executeQuery(sql);
            while (resultSet.next()) {
    %>

        <h3><%=resultSet.getString("name")%></h3>
        <%=resultSet.getString("cost")%>
        <%=resultSet.getString("description")%>




    <%
        }
            connection.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
    %>
sandwood
  • 2,038
  • 20
  • 38
Manoj Piyumal
  • 219
  • 1
  • 2
  • 10

1 Answers1

0

If you have field in database for storing files like images and audio. You should use BLOB datatype.

Here's an example of retrieving images from database

pritam parab
  • 85
  • 2
  • 10