Thread:
 Oracle BLOB 
 l.masini   11 Nov 2003, 09:51 
 Oracle BLOB 
 valeriasalviati   02 Jan 2004, 18:40 
 Re: Oracle BLOB 
 udoo   08 Jan 2004, 07:41 

Comment
Prev. thread 
 Next thread
 
Prev. posting 
 Next posting
From: l.masini (11 Nov 2003, 09:51) Replies: 2, Views: 41177
Subject: Oracle BLOB
I modified (db) nullSafeGet to let it work with Oracle that uses BLOB:

....
		else if (st instanceof oracle.jdbc.OraclePreparedStatement)
		{
			oracle.sql.BLOB blob =
				oracle.sql.BLOB.createTemporary(st.getConnection(),
					false,
					oracle.sql.BLOB.DURATION_SESSION);

			blob.open(BLOB.MODE_READWRITE);

			OutputStream out = blob.getBinaryOutputStream();

			try
			{
				out.write((byte[]) value);
				out.flush();
				out.close();
			}
			catch (IOException e)
			{
				throw new SQLException("failed write to blob" + e.getMessage());
			}

			blob.close();

			(
				(oracle
					.jdbc
					.OraclePreparedStatement)
						(st)
					)
					.setBLOB(
				index,
				blob);
		}
.....

Now I am asking if this will work with some kind of connection pooling...
Time will say.
L.
Prev. thread 
 Next thread
 
Prev. posting 
 Next posting
© Copyright 2006, Red Hat Middleware, LLC. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc. [Privacy Policy]