Advertisement
Guest User

Untitled

a guest
Mar 25th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.67 KB | None | 0 0
  1. import java.io.File;
  2. import java.io.FileInputStream;
  3. import java.sql.Connection;
  4. import java.sql.Driver;
  5. import java.sql.DriverManager;
  6. import java.sql.PreparedStatement;
  7.  
  8.  
  9. /**
  10. * Created by joander on 08/05/17.
  11. */
  12. public class Import {
  13.  
  14. public static void main( String[] args )
  15. throws Exception {
  16.  
  17. PreparedStatement pstmt = null;
  18. Connection conn = null;
  19. FileInputStream in = null;
  20. try {
  21.  
  22. System.out.println( "inicio" );
  23.  
  24. String path =
  25. "/home/joander/developer/algar/algarcrm/source/algarcrm/source/scripts/workflow/AC_Enviar_Documento_Cliente.xml";
  26.  
  27. String sql = "UPDATE ALGARCRM.OS_WORKFLOWDEFS SET WF_DEFINITION = ? WHERE WF_NAME = 'AC_Enviar_Documento_Cliente'";
  28.  
  29. //Sales_Order_v2
  30. //AC_Activity_Equipment_Delivery
  31.  
  32. //HOMOLOGACAO
  33. DriverManager.registerDriver( (Driver) Class.forName( "oracle.jdbc.driver.OracleDriver" ).newInstance() );
  34. conn = DriverManager.getConnection( "jdbc:oracle:thin:@10.11.133.188:1521:crmhbase", "algarcrmdev", "alga4crmdev$" );
  35. conn.setAutoCommit( false );
  36.  
  37. pstmt = conn.prepareStatement( sql );
  38.  
  39. File blob = new File( path );
  40. in = new FileInputStream( blob );
  41.  
  42. pstmt.setBinaryStream( 1, in, (int) blob.length() );
  43.  
  44. pstmt.executeUpdate();
  45. conn.commit();
  46.  
  47. System.out.println( "fim" );
  48.  
  49. } catch ( Exception e ) {
  50. e.printStackTrace();
  51.  
  52. } finally {
  53. pstmt.close();
  54. conn.close();
  55. in.close();
  56. }
  57. }
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement