1 23 24 26 27 package sample; 28 29 import javax.naming.*; 30 import javax.resource.cci.*; 31 import java.util.Iterator ; 32 import java.sql.SQLException ; 33 import javax.resource.ResourceException ; 34 35 public class SampleResultSetScenario { 36 37 public void method() { 38 39 try { 40 Context nc = new InitialContext(); 41 42 ConnectionFactory cf = (ConnectionFactory)nc.lookup( 44 "java:comp/env/eis/ConnectionFactory"); 45 Connection cx = cf.getConnection(); 46 47 Interaction ix = cx.createInteraction(); 49 50 InteractionSpecImpl ixSpec = new InteractionSpecImpl(); 52 ixSpec.setFunctionName("<NAME OF FUNCTION>"); 53 ixSpec.setInteractionVerb(InteractionSpec.SYNC_SEND_RECEIVE); 54 55 RecordFactory rf = cf.getRecordFactory(); 56 57 MappedRecord input = rf.createMappedRecord("Name of Record"); 63 input.put("<key: element1>", new String ("<VALUE1>")); 64 input.put("<key: element2>", new String ("<VALUE2>")); 65 66 ResultSet rs = (javax.resource.cci.ResultSet )ix.execute(ixSpec, input); 68 69 rs.beforeFirst(); 74 while (rs.next()) { 75 } 77 } 78 catch (NamingException ne) { 79 return; 80 } 81 catch (ResourceException e) { 82 return; 83 } 84 catch (SQLException e) { 85 return; 86 } 87 } 88 89 90 91 public static void main(String [] args) { 92 } 93 94 } 95 | Popular Tags |