import java.io.*;
import java.sql.*;
import java.lang.reflect.*;
import oracle.jdbc.*;
import java.util.*;
public class CallProc {
public static void main(String args[]) throws Exception {
DriverManager.registerDriver(new oracle.jdbc.OracleDriver());
//intg6i
//Connection conn =DriverManager.getConnection("jdbc:oracle:thin:@(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = godzilla)(PORT = 1541))(CONNECT_DATA =(SERVER = DEDICATED)(SERVICE_NAME = DI55)))", "mars", "mars");
String url = "jdbc:oracle:thin:@godzilla:1541:DI55";
Properties props = new Properties();
props.put("user", "mars");
props.put("password", "mars");
props.put("SetBigStringTryClob", "true");
Connection conn = DriverManager.getConnection(url, props);
CallableStatement cstmt = null;
ResultSet rs = null;
System.out.println("Here");
cstmt = conn.prepareCall("{ call MS_2262_TRAN_EMAIL_STG_I(?,?,?,?,?,?,?,?,?,?,?,?,?,? )}");
cstmt.setString(1,"SKamble@phxa.com");
cstmt.setString(2,"VSavvich@phxa.com");
cstmt.setString(3,"ARavindran@phxa.com;NSarmadzhiev@phxa.com;NGodavarthi@phxa.com");
cstmt.setString(4,"");
cstmt.setString(5,"FW: Natixis WO for web services F/O/R and fulfillment");
cstmt.setString(6,"
cstmt.setString(7,"01/25/2010 16:44:25");
cstmt.setString(8,"Y");
cstmt.setString(9,"00000000A49F721FD035D511808D009027A83B5007003937B623EDADD3118071009027A83B50000000AA28D70000499E0AB23BD25A45AAE078142A9F1989000003B2D8CC0000");
String str =readFileAsString(args[0]);
cstmt.setString(10, str);
cstmt.setString(11,"KMILLER");
cstmt.setString(12,"KMILLER");
cstmt.setString(13,"KMILLER");
cstmt.registerOutParameter(14,OracleTypes.CURSOR);
System.out.println("Here");
cstmt.executeQuery();
rs = (ResultSet)cstmt.getObject(14);
}
private static String readFileAsString(String filePath)
throws java.io.IOException{
StringBuffer fileData = new StringBuffer(1000);
BufferedReader reader = new BufferedReader(
new FileReader(filePath));
char[] buf = new char[1024];
int numRead=0;
while((numRead=reader.read(buf)) != -1){
String readData = String.valueOf(buf, 0, numRead);
fileData.append(readData);
buf = new char[1024];
}
reader.close();
return fileData.toString();
}
}
No comments:
Post a Comment