01.01.2013 Views

CICS Transaction Gateway V5 The WebSphere ... - IBM Redbooks

CICS Transaction Gateway V5 The WebSphere ... - IBM Redbooks

CICS Transaction Gateway V5 The WebSphere ... - IBM Redbooks

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

374 <strong>CICS</strong> <strong>Transaction</strong> <strong>Gateway</strong> <strong>V5</strong><br />

try<br />

{<br />

ECIManagedConnectionFactory mcf = new ECIManagedConnectionFactory();<br />

// set details<br />

mcf.setConnectionURL(gatewayURL);<br />

mcf.setServerName(cicsServer);<br />

mcf.setPortNumber(Integer.toString(gatewayPort));<br />

if (username.equals("") == false)<br />

{<br />

mcf.setUserName(username);<br />

}<br />

if (password.equals("") == false)<br />

{<br />

mcf.setPassword(password);<br />

}<br />

if (mirror.equals("") == false)<br />

{<br />

mcf.setTranName(mirror);<br />

}<br />

Figure B-40 Instantiating an ECIManagedConnectionFactory directly<br />

We use the various setter methods on ECIManagedConnectionFactory to set the<br />

<strong>Gateway</strong> daemon URL, <strong>Gateway</strong> daemon port, <strong>CICS</strong> server, <strong>CICS</strong> user ID, <strong>CICS</strong><br />

password and <strong>CICS</strong> transaction.<br />

In the next section of code, shown in Figure B-41 on page 375, we set the <strong>CICS</strong><br />

ECI resource adapter trace level and set trace output to go to standard error. We<br />

use the createConnectionFactory() method of ECIManagedConnectionFactory to<br />

create a ConnectionFactory, then we get a Connection and Interaction using<br />

the same methods as for a managed connection factory.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!