Quantcast
Channel: Indrayan's SOA Blog
Viewing all articles
Browse latest Browse all 62

Fetch Order Payload From Orabpel Schema

$
0
0

Introduction

Objective is to fetch order payload from ORABPEL schema tables based on Sales Order Number.Cube_Instance contains all instance details like InstanceId, ProcessId, Title,State, CreatedTiem etc.Audit_Details contains payload for the instances.Payloads are kept in compressed Binary format.

The payload can be fetched from Audit_Detail table based on Title based on cikey.


import java.io.File;

import java.io.FileOutputStream;

import java.io.InputStream;

import java.sql.*;


public class ReadOrderPayload{

private static String url = "jdbc:oracle:thin:@162.22.200.124:1521:WIUSERDB";

private static String username = "orabpel";

private static String password = "orabpel";


public static void main(String[] args) throws Exception {

Connection conn = null;

try {

System.out.println("1");

Class.forName("oracle.jdbc.driver.OracleDriver");

System.out.println("2");

conn = DriverManager.getConnection(url, username, password);

System.out.println("3");

String sql =

"select length(UTL_COMPRESS.LZ_UNCOMPRESS(b.BIN)), UTL_COMPRESS.LZ_UNCOMPRESS(b.BIN) from cube_instance a,audit_details b where a.process_id ='ProcessSalesOrderSiebelReqABCSImpl' and a.cikey=b.cikey and a.title like '%1-2953781%' and rownum<2 ";

PreparedStatement stmt = conn.prepareStatement(sql);

System.out.println("4");

ResultSet resultSet = stmt.executeQuery();

while (resultSet.next()) {

File f = new File("D:\\payload.xml");

FileOutputStream fos = new FileOutputStream(f);

Blob blob=resultSet.getBlob(2);

byte[] bdata = blob.getBytes(1, (int) blob.length());

String text = new String(bdata);

fos.write(bdata);

System.out.println("payload = " + text);

fos.close();

}

} catch (SQLException e) {

e.printStackTrace();

} finally {

if (conn != null && !conn.isClosed()) {

conn.close();

}

}

}

}



Viewing all articles
Browse latest Browse all 62

Trending Articles