I have been trying to get an image into an access database. I have read that you need to convert it to a byte array to do this. This is the code I have right now, and it throws a ClassCastException. Any ideas what I'm doing wrong?!
Image img = Toolkit.getDefaultToolkit().getImage("C:\\isas\\isas\\images\\bj5.gif");
int[] pix = new int[img.getWidth(null) * img.getHeight(null)];
PixelGrabber pg = new PixelGrabber(img, 0, 0, img.getWidth(this), img.getHeight(this), pix, 0, img.getWidth(this));
pg.grabPixels();
byte[] pixels = new byte[img.getWidth(this) * img.getHeight(this)];
pixels = (byte[])pg.getPixels();
pstmt.setBytes(1, pixels);
pstmt.executeUpdate();