Hi folks,

I have images in database as BLOBs and retrieving it with JDBC (not good
code, just test at the moment)
with this (just snip of the code):

conn = Utils.makeConnection();//make connection with JDBC
try
{
        conn.setAutoCommit(false);
        st = conn.createStatement();
        rs = st.executeQuery("SELECT * FROM testdatabase.images");
        LargeObjectManager lobj = ((org.postgresql.PGConnection)
conn).getLargeObjectAPI();
        while(rs.next())
        {
                Long oid = rs.getLong(7);
                LargeObject obj = lobj.open(oid, LargeObjectManager.READ);
                byte buf[] = new byte[obj.size()];
                obj.read(buf, 0, obj.size());
                //-->now I have image data in buf[], how can I put them into
html?
                obj.close();
        }
        rs.close();
        st.close();
        conn.commit();
}
catch(SQLException e)
{
        e.printStackTrace();
}

How can I put this image data into html page? Save it as file onto file
system and then
insert in src atribute of img tag? Or something else? Example is welcome.

Thanks in advance,

Miro


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to