0

I have a Java code for Oracle with which I keep a file in the database, the file is stored in a Blob field, for this purpose I use a "select for update" and put the connection in "autocommit (false ) "to keep the channel open to that record, after that I keep that result in a Blob and then write content to an OutputStream, then do" commit "and put the connection back to" autocommit (true) ".

The question is, how I can do a "select for update" for SQL Server 2008? I've been reading that possibly with a "WITH (ROWLOCK)" in my select, but if I do so, after you commit to writing the OutputStream object is unlocked automatically? or what is the procedure?

Thanks for listening.

Mariah
  • 1,073
  • 1
  • 14
  • 33
  • Do you really need to get the old blob out? Or do you need to just replace it? – John Sobolewski Oct 25 '12 at 18:09
  • I just need to replace it but I want to avoid blocking problem if another user comes to modify the same record – Mariah Oct 25 '12 at 18:12
  • Similiar to http://stackoverflow.com/questions/1643627/how-to-insert-a-blob-into-a-database-using-sql-server-management-studio – John Sobolewski Oct 25 '12 at 18:13
  • ok, the issue is that I am getting the file using a servlet and I have the array of bytes, the solution I offer also applies to insert an array of bytes? thanks – Mariah Oct 25 '12 at 18:20
  • josobo already tried what you told me the query executes successfully but when I check in SQL Server is blank ... Any idea what can be? thanks – Mariah Oct 25 '12 at 23:00
  • if you post some code folks might be able to help you. – John Sobolewski Nov 08 '12 at 16:06

0 Answers0