Hi.
I want to upload binary files to my PostgreSQL database server from my jsp-pages.
I found this:
File file = new File("myimage.gif");
FileInputStream fis = new FileInputStream(file);
PreparedStatement ps = conn.prepareStatement("INSERT INTO images VALUES (?, ?)");
ps.setString(1, file.getName());
ps.setBinaryStream(2, fis, file.length());
ps.executeUpdate();
ps.close();
fis.close();
in the PostgreSQL Docs.
Here are the used methods (the file object) and the result:
getName(): C:\notebook-backup-20030217.tar.gz - length(): 0 - exists(): false -
isFile(): false
It is possible to get the files name but nothing else.
Any solutions?
Best regards,
Lars nielsen Lind