<docbook><section><title>JDBCAppServerWebsphereLinux</title><para> </para><title> Using UDA with IBM WebSphere 6 (Linux) </title> Using UDA with IBM WebSphere 6 (Linux) 
<bridgehead class="http://www.w3.org/1999/xhtml:h2"> Required components </bridgehead>
<para>You will need to download the following components</para><itemizedlist mark="bullet" spacing="compact"><listitem> IBM WebSphere - <ulink url="http://www.ibm.com">download</ulink> </listitem>
<listitem> opltest.war Web Application - <ulink url="./opltest.war">download</ulink> </listitem>
<listitem> <ulink url="OpenLink">OpenLink</ulink> jar file - one of these, appropriate to the selected JDK/JRE - 
<table><title /><tgroup><thead /><tbody>
<row />
<row><entry>  1.1  </entry><entry>  [[<ulink url="http://www.openlinksw.com/">http://www.openlinksw.com/</ulink>][opljdbc.jar]]  </entry></row>
<row><entry>  1.2 or 1.3  </entry><entry>  [[<ulink url="http://www.openlinksw.com/">http://www.openlinksw.com/</ulink>][opljdbc2.jar]]  </entry></row>
<row><entry>  1.4 or 1.5  </entry><entry>  [[<ulink url="http://www.openlinksw.com/">http://www.openlinksw.com/</ulink>][opljdbc3.jar]]  </entry></row>
<row><entry>  1.6  </entry><entry>  [[<ulink url="http://www.openlinksw.com/">http://www.openlinksw.com/</ulink>][opljdbc4.jar]]  </entry></row>
<row><entry>  1.7  </entry><entry>  [[<ulink url="http://www.openlinksw.com/">http://www.openlinksw.com/</ulink>][opljdbc4_1.jar]]  </entry></row>
<row><entry>  1.7  </entry><entry>  [[<ulink url="http://www.openlinksw.com/">http://www.openlinksw.com/</ulink>][opljdbc4_2.jar]]  </entry></row>
</tbody></tgroup></table>
</listitem>
</itemizedlist><para> </para><bridgehead class="http://www.w3.org/1999/xhtml:h2"> Install IBM WebSphere </bridgehead>
<para>Currently, there is only a graphical install available on Linux.</para><para>The <computeroutput>-console</computeroutput> command line option is not currently implemented.</para><para>Extract the .tar.gz into a suitable temporary directory, such as -- <computeroutput>/tmp/websphere</computeroutput></para><para>Double click on -- <computeroutput>/tmp/websphere/WAS/install</computeroutput> -- to initiate the installation process.</para><para>Select <computeroutput>Next</computeroutput>, Accept the license agreement then <computeroutput>Next</computeroutput> again.</para><para>A System Prerequisites Check will be performed.</para><para>NOTE: You may be warned that the Operating System is not supported.
 Ignore this warning.</para><para>Select Next several times leaving all options at their default values to begin the installation.</para><para>Untick <computeroutput>Launch the First Steps Console</computeroutput> then select <computeroutput>Finish</computeroutput>.</para><para> </para><bridgehead class="http://www.w3.org/1999/xhtml:h2"> Starting IBM WebSphere Server </bridgehead>
<para>Start IBM WebSphere Server using the command -- <computeroutput>/opt/IBM/WebSphere/AppServer/bin/startServer server1</computeroutput></para><para>Browse to the following url to verify that Sun Java Application Server is up and running -- <computeroutput>http://websphere_server:9060/ibm/console/</computeroutput></para><para>NOTE: The IBM WebSphere Server may take several minutes to start.</para><para> </para><bridgehead class="http://www.w3.org/1999/xhtml:h2"> Install OpenLink jar files </bridgehead>
<para>Copy the <computeroutput>.jar</computeroutput> file chosen for your JDK/JVM/JRE into the directory -- <computeroutput>/opt/IBM/WebSphere/AppServer/openlink/lib</computeroutput></para><para>NOTE: Create this directory if it does not exist.</para><para>Open the Admin Console -- <computeroutput>http://websphere_server:9060/ibm/console/</computeroutput></para><para>Enter any User ID then select <computeroutput>Log in</computeroutput></para><para>Select <computeroutput>Environment -&gt; WebSphere Variables</computeroutput></para><para>Select the variable -- <computeroutput>User-defined_JDBC_DRIVER_PATH</computeroutput></para><para>Edit the <computeroutput>Value</computeroutput> property to read-- <computeroutput>${WAS_INSTALL_ROOT}/openlink/lib</computeroutput></para><para>Select <computeroutput>Apply</computeroutput></para><para>The page will refresh with a message ot the top prompting to save the changes to the master configuration.</para><para>Select <computeroutput>Save</computeroutput> then select <computeroutput>Save</computeroutput> again.</para><para>The WebSphere Variables page will redisplay.</para><para>Restart WebSphere -- <computeroutput>/opt/IBM/WebSphere/AppServer/bin/stopServer server1/opt/IBM/WebSphere/AppServer/bin/startServer server1</computeroutput></para><para>NOTE: The IBM WebSphere Server may take several minutes to start.</para><para> </para><bridgehead class="http://www.w3.org/1999/xhtml:h2"> Configure Resources </bridgehead>
<para>NOTE: These instructions must be followed precisely.</para><bridgehead class="http://www.w3.org/1999/xhtml:h3"> Create the JDBC Provider </bridgehead>
<para>Open the Admin Console -- <computeroutput>http://websphere_server:9060/ibm/console/</computeroutput></para><para>and enter any User ID then select <computeroutput>Log in</computeroutput></para><para>Select <computeroutput>Resources -&gt; JDBC Providers</computeroutput></para><para>Select <computeroutput>New</computeroutput></para><para>In the <computeroutput>Step 1</computeroutput> list box select <computeroutput>User-defined</computeroutput> then <computeroutput>Next</computeroutput></para><para>Enter the <computeroutput>General Properties</computeroutput> --
</para><table><title /><tgroup><thead /><tbody><entry> *Name*  </entry><entry> opljdbc3  </entry>
<row><entry> *Class path*  </entry><entry> ${User-defined_JDBC_DRIVER_PATH}/opljdbc3.jar  </entry></row>
<row><entry> *Implementation class name*  </entry><entry> openlink.javax.OPLConnectionPoolDataSource  </entry></row>
</tbody></tgroup></table>
<para>Select <computeroutput>Apply</computeroutput></para><para>The page will refresh with a message at the top prompting to save the changes to the master configuration.</para><para>Select <computeroutput>Save</computeroutput> then select <computeroutput>Save</computeroutput> again.</para><para>The <computeroutput>JDBC providers</computeroutput> page will redisplay with the provider <computeroutput>opljdbc3</computeroutput> added to the list.</para><para> </para><bridgehead class="http://www.w3.org/1999/xhtml:h3"> Create the data source </bridgehead>
<para>Select the provider you just created.</para><para>Select <computeroutput>Data Sources</computeroutput> to the right of the providers <computeroutput>General Properties</computeroutput></para><para>Select <computeroutput>New</computeroutput></para><para>Enter the <computeroutput>General Properties</computeroutput> --
</para><table><title /><tgroup><thead /><tbody><entry> *Name*  </entry><entry> o32opljdbc3  </entry>
<row><entry> *JNDI name*  </entry><entry> jdbc/o32opljdbc3  </entry></row>
</tbody></tgroup></table>
<para>Select the <computeroutput>Select a data store helper class</computeroutput> radio button and highlight the class -- <computeroutput>(com.ibm.websphere.rsadapter.GenericDataStoreHelper)</computeroutput></para><para>Select <computeroutput>Apply</computeroutput></para><para>The page will refresh with a message at the top prompting to save the changes to the master configuration.</para><para>Select <computeroutput>Save</computeroutput> then select <computeroutput>Save</computeroutput> again.</para><para>The <computeroutput>Data sources</computeroutput> page will redisplay with the data source <computeroutput>o32opljdbc3</computeroutput> added to the list.</para><para> </para><bridgehead class="http://www.w3.org/1999/xhtml:h3"> Create the data source custom property </bridgehead>
<para>Select the data source you just created.</para><para>Select <computeroutput>Custom properties</computeroutput> to the right of the providers <computeroutput>General Properties</computeroutput></para><para>Select <computeroutput>New</computeroutput></para><para>Enter the <computeroutput>General Properties</computeroutput> --
</para><table><title /><tgroup><thead /><tbody><entry> *Name*  </entry><entry> URL  </entry>
<row><entry> *Value*  </entry><entry> jdbc:openlink:<emphasis>192.168.0.150:5000/SVT<para>Odbc/Database</para><para>sqlserver/UID</para><para>sa/PWD</para><para>sa  </para></emphasis></entry></row>
<row><entry> *Type*  </entry><entry> java.lang.String  </entry></row>
</tbody></tgroup></table>
<para>Select <computeroutput>Apply</computeroutput></para><para>The page will refresh with a message ot the top prompting to save the changes to the master configuration.</para><para>Select <computeroutput>Save</computeroutput> then select <computeroutput>Save</computeroutput> again.</para><para>The Custom properties page will redisplay with the custom property added to the list.</para><para> </para><bridgehead class="http://www.w3.org/1999/xhtml:h2"> Test the data source </bridgehead>
<para>Select <computeroutput>Data sources</computeroutput> in the navigation structure at the top of the page.</para><para>Tick the data source you just created.</para><para>Select <computeroutput>Test connection</computeroutput></para><para>You will need to repeat the above for the following providers / data sources / JNDI Names --
</para><table><title /><tgroup><thead /><tbody>
<row><entry> opljdbc2  </entry><entry> o32opljdbc2  </entry><entry> jdbc/o32opljdbc2  </entry></row>
<row><entry> opljdbc2  </entry><entry> m32opljdbc2  </entry><entry> jdbc/m32opljdbc2  </entry></row>
<row><entry> opljdbc3  </entry><entry> o32opljdbc3  </entry><entry> jdbc/o32opljdbc3  </entry></row>
<row><entry> opljdbc3  </entry><entry> m32opljdbc3  </entry><entry> jdbc/m32opljdbc3  </entry></row>
</tbody></tgroup></table>
<para> </para><bridgehead class="http://www.w3.org/1999/xhtml:h2"> Prepare the Web Application </bridgehead>
<para>Demonstrating how to build and deploy a Web application from the beginning is beyond the scope of this short tutorial so what follows is a quick method of altering the JDBC URLs and SQL statements in an existing Web application.</para><para>NOTE: Be careful when moving .war files about using Internet Explorer.
 Sometimes they will be renamed to .zip by Internet Explorer.</para><bridgehead class="http://www.w3.org/1999/xhtml:h3"> Rename the .war file to .zip </bridgehead>
<para>Rename - <computeroutput>opltest.war</computeroutput> -to- <computeroutput>opltest.zip</computeroutput></para><para>You will then be able to unzip the archive to get at the files inside it.
 (Some utilities can unzip the .war archive without renaming.) <computeroutput>unzip opltest.zip</computeroutput></para><bridgehead class="http://www.w3.org/1999/xhtml:h3"> Edit JDBC URLs </bridgehead>
<para>Edit the driver class and the JDBC connection URL in the file -- <computeroutput>/META-INF/context.xml</computeroutput></para><para>NOTE: Ensure that the edited file is placed back into the archive.
<computeroutput>zip -r ../opltest *</computeroutput></para><para> </para><bridgehead class="http://www.w3.org/1999/xhtml:h3"> Edit the SQL statement(s) </bridgehead>
<para>You will need to edit the SQL statement(s) in <emphasis>the following JSP files</emphasis> based on the chosen database determined by the JDBC URL in the file -- <computeroutput>/META-INF/context.xml</computeroutput></para><para>Edit the JSP files -- </para><programlisting>opljdbc.jsp
opljdbc2.jsp 
opljdbc3.jsp
</programlisting><para> There are two main areas of interest --</para><orderedlist spacing="compact"><listitem>The &lt;sql:query&gt; tag which select the datasource as defined in - <computeroutput>/META-INF/context.xml</computeroutput> which contains the SQL query itself --  <computeroutput>&lt;sql:query var=&quot;resultset&quot; dataSource=&quot;jdbc/opljdbc2&quot;&gt;		select SupplierID, CompanyName, ContactName, ContactTitle from Suppliers	&lt;/sql:query&gt;</computeroutput> 		 </listitem>
<listitem>The one or more ${row.column_name} constructs that output data as per the SQL query  <computeroutput>${row.SupplierID}${row.CompanyName} </computeroutput></listitem>
</orderedlist><para> NOTE: Ensure that the edited file is placed back into the archive.
<computeroutput>zip -r ../opltest *</computeroutput></para><bridgehead class="http://www.w3.org/1999/xhtml:h3"> Rename the .zip file back to .war </bridgehead>
<para>Rename the file <computeroutput>opltest.zip</computeroutput> back to <computeroutput>opltest.war</computeroutput></para><para> </para><bridgehead class="http://www.w3.org/1999/xhtml:h2"> Deploy opltest Web Application </bridgehead>
<para>Open the Admin Console -- <computeroutput>http://websphere_server:9060/ibm/console/</computeroutput></para><para>and enter any User ID then select <computeroutput>Log in</computeroutput></para><para>Select <computeroutput>Applications -&gt; Install New Application</computeroutput></para><bridgehead class="http://www.w3.org/1999/xhtml:h3"> Preparing for the application installation </bridgehead>
<para>Select the <computeroutput>Local file system</computeroutput> radio button.</para><para>Browse to the war file <computeroutput>optest.war</computeroutput></para><para>Set the <computeroutput>Context root</computeroutput> to -- <computeroutput>opltest</computeroutput></para><para>Select <computeroutput>Next</computeroutput> then <computeroutput>Next</computeroutput> again</para><bridgehead class="http://www.w3.org/1999/xhtml:h3"> Application Security Warnings </bridgehead>
<para>Select <computeroutput>Continue</computeroutput></para><bridgehead class="http://www.w3.org/1999/xhtml:h3"> Install New Application </bridgehead>
<orderedlist spacing="compact"><listitem> Select installation options  Change the <computeroutput>Application name</computeroutput> to <computeroutput>opltest</computeroutput> Select <computeroutput>Next</computeroutput> </listitem>
<listitem> Map modules to servers Select <computeroutput>Next</computeroutput> </listitem>
<listitem> Map resource references to resources Scroll down the page to see the table showing the resources defined by the file WEB-INF/web.xml Enter the <computeroutput>JNDI name</computeroutput> for its corresponding <computeroutput>Reference binding</computeroutput> as follows -- 
<table><title /><tgroup><thead /><tbody>
<row />
<row><entry> jdbc/o32opljdbc1  </entry><entry> jdbc/o32opljdbc3  </entry></row>
<row><entry> jdbc/m32opljdbc1  </entry><entry> jdbc/m32opljdbc3  </entry></row>
<row><entry> jdbc/o32opljdbc2  </entry><entry> jdbc/o32opljdbc2  </entry></row>
<row><entry> jdbc/m32opljdbc2  </entry><entry> jdbc/m32opljdbc2  </entry></row>
<row><entry> jdbc/o32opljdbc3  </entry><entry> jdbc/o32opljdbc3  </entry></row>
<row><entry> jdbc/m32opljdbc3  </entry><entry> jdbc/m32opljdbc3  </entry></row>
</tbody></tgroup></table>
 Select <computeroutput>Next</computeroutput> </listitem>
<listitem> Map virtual hosts for Web modules Select <computeroutput>Next</computeroutput> </listitem>
<listitem> Summary Select <computeroutput>Finish</computeroutput></listitem>
</orderedlist><para>The application will now be installed.</para><para>Select the <computeroutput>Save to Master Configuration</computeroutput> link at the bottom of the page.</para><para>Select <computeroutput>Save</computeroutput></para><para>Select <computeroutput>Applications -&gt; Enterprise Applications</computeroutput></para><para>You will see the new application <computeroutput>opltest</computeroutput> listed with a red cross for its status.</para><para>Select the check box to the left of <computeroutput>opltest</computeroutput></para><para>Select <computeroutput>Start</computeroutput></para><para>The page will refresh and the red cross will have changed to a green arrow.</para><para>The newly deployed application is now available at the following URL -- <computeroutput>http://websphere_server:9080/opltest/index.html</computeroutput></para></section></docbook>