Hello Ulises!

Try [EMAIL PROTECTED], there's some traffic there
and people seem helpful. You've got to subscribe, maybe send a letter
with subject subscribe and body subscribe.. If you have trouble,
contact me, I did it somehow.

Of course it's not a DB2, but websphere mail list.. The best I could
help you with, sorry!

UP> Hi all:

UP> Plaese, if somebody can help me.

UP> I wnt to insert one rocord in a DB2 table with a BLOB field. But when I
UP> execute this code, the third executeUpdate (insert into...) give me this
UP> message:

UP> CLI0125E Function sequence error.

UP> What is wrong wit this Java code?



UP> import java.io.*;
UP> import java.sql.*;


UP> public class db2SONDAframe
UP> {

UP>   static String[] asImages =
UP>   {
UP>     "photo.jpeg"
UP>   };

UP>   public static void main(String[] args)
UP>   {
UP>     Connection con = null;
UP>     File fImage;
UP>     InputStream isImage;
UP>     int iRowCount = 0;
UP>     PreparedStatement pstmt = null;
UP>     Statement stmt = null;

UP>     String sDriver =
UP>       "COM.ibm.db2.jdbc.app.DB2Driver";
UP>     String sURL =
UP>       "jdbc:db2:sframe";
UP>     String sUsername = "administrator";
UP>     String sPassword = "sbs";

UP>     try
UP>     {
UP>         Class.forName( sDriver ).newInstance();
UP>     }
UP>     catch( Exception e )
UP>     {
UP>       System.err.println(
UP>         "Failed to load current driver.");
UP>       return;
UP>     }

UP>     try
UP>     {

UP>       con = DriverManager.getConnection ( sURL,
UP>                                           sUsername,
UP>                                           sPassword);
UP>       stmt = con.createStatement();
UP>     }
UP>     catch ( Exception e)
UP>     {
UP>       System.err.println( "problems connecting to " +
UP>                            sURL + ":" );
UP>       System.err.println( e.getMessage() );

UP>       if( con != null)
UP>       {
UP>         try { con.close(); }
UP>         catch( Exception e2 ) {}
UP>       }

UP>       return;
UP>     }

UP>     try
UP>     {
UP>       stmt.executeUpdate( "delete from turbine_group;" );
UP>       try { stmt.close();}
UP>       catch (Exception e) {}
UP>       stmt = null;

UP>       pstmt = con.prepareStatement(
UP>         "INSERT INTO TURBINE_GROUP VALUES( ?, ?, ? )" );

UP>       pstmt.setInt( 1, 1 );
UP>       pstmt.setString( 2, "GLOBAL" );

UP>       fImage = new File( asImages[0] );
UP>       isImage = new FileInputStream( fImage );
UP>       pstmt.setBinaryStream( 3, isImage, (int)( fImage.length() ) );

UP>       pstmt.executeUpdate();

UP>     }
UP>     catch ( Exception e )
UP>     {
UP>       System.err.println(
UP>         "problem with SQL sent to " + sURL + ":" );
UP>       System.err.println( e.getMessage() );
UP>     }
UP>     finally
UP>     {
UP>       if( stmt != null)
UP>       {
UP>         try { pstmt.close(); }
UP>         catch( Exception e2 ) {}
UP>       }
UP>       try { pstmt.close(); }
UP>       catch( Exception e ) {}

UP>       try { con.close(); }
UP>       catch( Exception e ) {}
UP>     }

UP>   }

UP> }

UP> ___________________________________________________________________________
UP> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
UP> of the message "signoff SERVLET-INTEREST".

UP> Archives: http://archives.java.sun.com/archives/servlet-interest.html
UP> Resources: http://java.sun.com/products/servlet/external-resources.html
UP> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html


UP> __________
UP> http://www.newhost.ru - ����� ����, �������� ����



- Anton
[EMAIL PROTECTED]
[EMAIL PROTECTED]

___________________________________________________________________________
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

Reply via email to