> "Nusairat, Joseph F." wrote:
> 
> OK i have taken all your advice ... and i changed it to a clob ... set
> up a binary stream ... wohoo ... good to go right? well WRONG! i keep
> getting marshalling exceptions
> 
> Exception: ProjectAdd.saveInfo(): Transaction was rolled back:
> javax.transaction.SystemException:
> com.evermind.transaction.MarshallingXAException: null
> 
> What am i doing right?
> 
> I put the same code into a generic servlet and it worked fine ... any
> help would be apprecaited it :)

Hi Joseph.

This is a sample from some code where I am reading an InputStream from a
socket (an HTTP connection in this case), and writing the contacts to a
field in the database (a BLOB in this case).

-Steve

try
      {
         //Make preparedStatement
         ps = conn.prepareStatement( NEW_SQL );
         //Write Data to Database
         ps.setBinaryStream(ATTACHMENT_DATA, part.getInputStream(),
MAXREQSIZE );
         ps.executeUpdate();
      }
      catch (SQLException e)
      {
         log("Unable to write data to Database.", e);
         throw new HRNException( e, "com.hrnexus.common.databaseFailed"
);
      }
      finally
      {
         try
         { //Close Prepared Statement
            if ( ps != null ) ps.close();
         }
         catch (SQLException e)
         {
            //Finished, so just log and carry on.
            log("Error closing PreparedStatement", e );
         }
         
         try
         { //Close Connection to DB.
            if ( conn != null ) conn.close();
         }
         catch (SQLException e)
         {
            //Finished, so just log and carry on.
            log("Error closing Connection.", e );
         }
      }//End finally
   } //End saveFile

Reply via email to