Ludger Zachewitz wrote:
Hello, I have the following problem accessing postgres (version: 8.2.X) from java 1.6_03 using driver (currently version: postgresql-8.2-508.jdbc4.jar) and hope someone can help me. I have created an table 'files' with the columns 'file_id', 'filename' and 'file_content'. 'file_content'is of type bytea and should store large binary files. A method for storing files in that table also exists and work fine. Now I am trying to select a stored 'file_content' from the table and store it directly on the filesystem. Because the files could be very large, i don't want to hold them in the main memory -- so I am using Input- and Outputstreams (see source code below).
If you don't want the whole field at once, you don't want a bytea. The large-object interface offers lo_read/lo_write to let you grab data in smaller chunks.
See the manuals for details, I'm afraid I'm not sure of the procedure for accessing lo_read from JDBC.
-- Richard Huxton Archonet Ltd ---------------------------(end of broadcast)--------------------------- TIP 6: explain analyze is your friend