📄 package-summary.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd">
<HTML>
<HEAD>
<!-- title of examples package -->
<TITLE>
WebLogic Server 8.1 Examples: Package examples.jdbc.pool
</TITLE>
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">
</HEAD>
<BODY BGCOLOR="white">
<!-- ========== START OF NAVBAR ========== -->
<A NAME="navbar_top"><!-- --></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-summary.html"><FONT ID="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Package</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Class</FONT> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</td><td valign=bottom align=right><b>WebLogic Server 8.1 Code Examples</b>, BEA Systems, Inc.</td></TD>
</TR>
</TABLE>
<!-- =========== END OF NAVBAR =========== -->
<HR>
<H2>
<!-- name of the package -->
Package examples.jdbc.pool
</H2>
<!-- One sentence summary of the examples -->
This example shows how to use a WebLogic pool driver to make a
JDBC connection for use in an HTTP servlet.
<P>
<B>See: </B>
<A HREF="#package_description"><B>Description</B></A>
<P>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=2><FONT SIZE="+2">
<B>JDBC Pool Examples Summary</B></FONT></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD WIDTH="15%"><B>SimpleSelect</B></TD>
<TD>This example shows how to use a WebLogic pool driver to make a
JDBC connection for a servlet.</TD>
</TR>
</TABLE>
<P>
<A NAME="package_description"></A><H2>
Package jdbc.pool Description
</H2>
<P>
<!-- general description of examples -->
This example shows how to use the WebLogic pool driver to make a
JDBC connection for use in an HTTP servlet. This server-side
JDBC pool can use a few JDBC connections that are created when
the WebLogic Server starts up to serve many clients displaying database data
in an HTTP servlet. (The WebLogic Tour uses a Pointbase database with a
server-side connection pool.)
<p>
The method uses the pool driver for database access and a jsp to generate an HTML page for display.
<p>
This example uses the PointBase Demo database, which is launched automatically when you start the examples server. You can also use
a database with the "emp" table in it, like the DEMO
database that comes with an Oracle installation. If you want to create the table yourself,
you can create the DEMO database using the ddl at <font face="Courier New" size=-1>%SAMPLES_HOME%\server\examples\src\examples\utils\ddl\demo.ddl</font>
and the accompanying <font face="Courier New" size = -1>ant</font> build script.
See <a href="../../utils/package-summary.html">examples.utils</a>.
<P>
You use the Administration Console as well as the command line to compile, configure,
and run this example.
<p>
To get the most out of this example, first read through the following source code file
to see what is happening.
<p>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=2><FONT SIZE="+2">
<B>Resources for examples.jdbc.pool</B></FONT></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD WIDTH="15%"><B>SimpleSelect.jsp</B></TD>
<TD> Java Server Page that uses the WebLogic pool driver to connect to a database, queries the database using a Statement and a ResultSet,
and then builds a table with the results.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD WIDTH="15%"><B>build.xml</B></TD>
<TD>The Java Ant build script, which compiles SimpleSelect.jsp and copies it to
the <font face="Courier New" size = -1>%SAMPLES_HOME%\server\examples\build\examplesWebApp</font> directory. </TD>
</TR>
</TABLE>
<p><h3>Build the Example</h3>
<ol>
<li> Open a new command shell.
<p><li>Set up your development shell as described in
<a href=../../examples.html#environment>Setting up Your Environment for
Building and Running the Examples</a>.
<p>
<li>Change to the <font face="Courier New" size=-1>%SAMPLES_HOME%\server\examples\src\examples\jdbc\pool</font> directory.
<p>
<li>Compile the example by executing an <font face="Courier New" size = -1>ant</font>
build script or a command.
<p>
<ul>
<li>An <font face="Courier New" size = -1>ant</font> build script is available in the
<font face="Courier New" size = -1>%SAMPLES_HOME\server\examples\src\examples\jdbc\pool</font> directory. Enter the following command
to execute the build script:
<p>
<pre><font face="Courier New">prompt><b> ant</b></font></pre>
<p>
<li>Or enter the following command to copy the example jsp to the examplesWebApp:
<p>
<pre><font face="Courier New">prompt><b> copy SimpleSelect.jsp %SAMPLES_HOME%\server\examples\build\examplesWebApp</b></font></b></font></pre> </ul>
<p>
<li>Start the <a href=../../examples.html#startServer>examples server</a>.
</ol>
<p>
<h3>Configure the Example</h3>
<ol>
<p><li>Open the <a href=../../examples.html#console>Administration Console</a>.
<p><li>Verify that the <a href=../../examples.html#webApp>Examples Web Application</a> has been deployed on your server.
<p><li>Verify that the connection pool is enabled as follows:
<ul>
<p>
<li>Click to expand the Services->JDBC node in the left pane.
<li>Click to expand the Connection Pools node.
<li>Verify that demoPool appears under Connection Pools.
<li>Verify that demoPool is deployed on the examplesServer (on the Target and Deploy tab).
<li>Verify that the demoPool is running on the examplesServer (on the Monitoring tab).
</ul>
</ol>
<p>
<h3>Run the Example</h3>
<p>
Use a Web browser to load the following:
<p><pre>
<font face="Courier New">http://<i>WebLogicHost:port</i>/examplesWebApp/SimpleSelect.jsp</font></pre>
<p>Where <i>WebLogicHost:port</i> is the hostname and port number of
your WebLogic Server. Typically, <font face="Courier New" size = -1>localhost:7001</font>.
<p>You should see the following result in the Web page:
<p>
<table border=1 cellpadding=5>
<th>EMPNO</th>
<th>ENAME</th>
<th>JOB</th>
<th>MGR</th>
<th>HIREDATE</th>
<th>SAL</th>
<th>COMM</th>
<th>DEPTNO</th>
<tr>
<td>7369</td>
<td>SMITH</td>
<td>CLERK</td>
<td>7902</td>
<td>1980-12-17</td>
<td>800</td>
<td> </td>
<td>20</td>
</tr>
<tr>
<td>7499</td>
<td>ALLEN</td>
<td>SALESMAN</td>
<td>7698</td>
<td>1981-02-20</td>
<td>1600</td>
<td>300</td>
<td>30</td>
</tr>
<tr>
<td>7521</td>
<td>WARD</td>
<td>SALESMAN</td>
<td>7698</td>
<td>1981-02-22</td>
<td>1250</td>
<td>500</td>
<td>30</td>
</tr>
<tr>
<td>7654</td>
<td>MARTIN</td>
<td>SALESMAN</td>
<td>7698</td>
<td>1981-09-28</td>
<td>1250</td>
<td>1400</td>
<td>30</td>
</tr>
<tr>
<td>7844</td>
<td>TURNER</td>
<td>SALESMAN</td>
<td>7698</td>
<td>1981-09-08</td>
<td>1500</td>
<td>0</td>
<td>30</td>
</tr>
<tr>
<td>7876</td>
<td>ADAMS</td>
<td>CLERK</td>
<td>7788</td>
<td>1981-06-09</td>
<td>1100</td>
<td> </td>
<td>20</td>
</tr>
<tr>
<td>7900</td>
<td>JAMES</td>
<td>CLERK</td>
<td>7698</td>
<td>1981-12-03</td>
<td>950</td>
<td> </td>
<td>30</td>
</tr>
<tr>
<td>7934</td>
<td>MILLER</td>
<td>CLERK</td>
<td>7782</td>
<td>1982-01-23</td>
<td>1300</td>
<td> </td>
<td>10</td>
</tr>
</table>
<h2>There's more</h2>
For more information, see:
<p>
<ul>
<li><a href="http://e-docs.bea.com/wls/docs81/servlet/index.html">Programming WebLogic HTTP Servlets</a>.</li>
<p>
<li><a href="http://e-docs.bea.com/wls/docs81/jdbc/intro.html#conn_pools">Overview of Connection Pools</a> in Programming WebLogic JDBC.
<p>
<li><a href="http://e-docs.bea.com/wls/docs81/ConsoleHelp/jdbc.html">JDBC</a> in BEA WebLogicServer Administration Console Online Help.
</ul>
<HR>
<!-- ========== START OF NAVBAR ========== -->
<A NAME="navbar_bottom"><!-- --></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-summary.html"><FONT ID="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Package</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Class</FONT> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</td><td valign=bottom align=right>Documentation is available at<br> <a href=http://e-docs.bea.com/wls/docs81/>
http://e-docs.bea.com/wls/docs81/</a></td></TD>
</TR>
</TABLE>
<!-- =========== END OF NAVBAR =========== -->
<HR>
<a href="http://e-docs.bea.com/wls/docs81/copyright.html">Copyright</a> © 2002-2004 BEA Systems, Inc. All rights reserved.
</BODY>
</HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -