Hi John,
What is the driver and database you are using? If you are using Oracle db +
type 2/type 4 drivers, and you have JDeveloper 3.0, check out the file
'templates.htm' in the jdeveloper/jdbc/doc directory. It has templates of code
which you can cut and paste into your own code. Section 4 of this document
deals with streams of large amounts of data (both selects and inserts).
Regards
Michael
John John Tobias wrote:
> Good day!
>
> Is there any idea on how to insert large amount of data in database using
> JDBC? (let say 50MB of data). Or, could you please help me to find out what
> is wrong in my code, I used the method updateAsciiStream(String,
> java.io.InputStream, int) in ResultSet Class which is capable to update the
> content of the database, but it does'nt work.
>
> try {
> stmt = conn.createStatement( ResultSet.TYPE_SCROLL_SENSITIVE,
> ResultSet.CONCUR_UPDATABLE );
>
> stmt.execute("insert into attachments(attID,msgID,filename,"
> + "contentType,encoding,attBody) values(100,'Dummy',"
> +"'dummy.dat','text','7bit','test data')" );
>
> rs = stmt.executeQuery("SELECT attBody FROM attachments where
> attID=100" );
>
> if( rs != null ) rs.next();
> FileInputStream f = new FileInputStream( "filename.txt" );
> InputStream is = f;
> rs.updateAsciiStream( "attBody", is, is.available() );
> }
> catch( .... ) {}
>
> but some exception has occured as shown below,
>
> java.sql.SQLException: JZ0BT: The updateAsciiStream(String,
> java.io.InputStream, int) method is not supported for ResultSets of type
> CONC.
>
> Thank you in advance,
>
> John John Tobias
>
> ______________________________________________________
> Get Your Private, Free Email at http://www.hotmail.com
>
> ___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
begin:vcard
n:Bamford;Michael
tel;cell:0410-601-301
tel;work:(02)9900-1367
x-mozilla-html:FALSE
url:www.oracle.com.au
org:Oracle Corporation;Business Solutions
version:2.1
email;internet:[EMAIL PROTECTED]
title:Senior Business Solutions Consultant
adr;quoted-printable:;;Level 7=0D=0A1 Pacific Hwy=0D=0A;North Sydney;NSW;2060;Australia
fn:Michael Bamford
end:vcard