Performance issue with JDBC Oracle BLOB insert !

Hi All,

I'm facing a peroformance issue in inserting BLOB data in Oracle db using standard jdbc. Here's a code snippet I'm using :

File binaryFile = new File(fileName);

InputStream is = new FileInputStream(fileName);

insertSql = "INSERT INTO JMS_MESSAGE_TEST ( JMS_MESSAGE_KEY, JMS_MESSAGE_TEXT )" +" VALUES(?,?)";

System.out.println(" sql..."+insertSql);

stmt = con.prepareStatement(insertSql);

stmt.setString(1,jmsKey);

stmt.setBinaryStream(2,is,(int)binaryFile.length());

stmt.executeUpdate();

is.close();

This method is inserting a filesize of 4 mb in 22 sec (excluding the db connection time). Is there anyway to improve performance, for our current req, 22 sec is way high. I'm using OCI driver.

I've tried couple of other ways of inserting BLOB data, for eg. inserting a EMPTY_BLOB and then use Select on UPDATE to write the stream.

Any pointer on this will be highly appreciated.

Thanks,

Shamik

[1004 byte] By [bronze-starDukes] at [2007-11-26 12:13:39]
# 1
stmt.setBinaryStream(2,is,(int)binaryFile.length());If 'is' is a FileInputStream inabove code try wrapping with a BufferedInputStream with a sufficient buffer size.
silverstar at 2007-7-7 14:15:13 > top of Java-index,Archived Forums,Socket Programming...
# 2

This Process which u r using It will costly (in respect of CPU time and DataBase Time and also N/w time)

It depends on yr recquirment

but u can aslo do the this........

1.put only relative path in the database with file name

2.And Place the File in Relative Location

it Saves the DataBase Time and Increase yr system performance

bronzestar at 2007-7-7 14:15:13 > top of Java-index,Archived Forums,Socket Programming...