Getting Started with WebSphere Application Server
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
66 <strong>Getting</strong> <strong>Started</strong> <strong>with</strong> <strong>WebSphere</strong> <strong>Application</strong> <strong>Server</strong> Community Edition<br />
On the right side in (1), a Database Administrator (DBA) creates a database and loads it<br />
<strong>with</strong> data. Next, in (2) the DBA configures and registers this data source in the Community<br />
Edition Java Naming and Directory Interface (JNDI) namespace. A developer develops the<br />
JSPs/Servlets that will be accessing the database through JDBC. On the left side, when<br />
the Web client requests some page that requires a database access, the corresponding<br />
JSP/servlet in (3) will first perform a JNDI look up to find the registered data source, and<br />
will then create a connection object to get database access as depicted in (4). The<br />
connection objects are pooled by the Community Edition server for application reuse, and<br />
the data can be accessed through JDBC in (5).<br />
4.2 Steps to work <strong>with</strong> a database in Community Edition<br />
To develop a Web application <strong>with</strong> database access in Community Edition, the typical<br />
steps are:<br />
1. Create a database.<br />
2. Configure and deploy a database pool via Community Edition administrative<br />
console.<br />
3. Execute SQL statements to load some data through the database pool.<br />
Though step 3 could be done directly <strong>with</strong> the tools provided by the database, we chose to<br />
perform it through the database pool configured in Community Edition.<br />
4.2.1 Creating a database<br />
In this book, we use DB2 Express-C 9.7. To download the latest version of DB2 Express-C,<br />
visit ibm.com/db2/express and choose the appropriate file to download for the operating<br />
system you are using. If you are not familiar <strong>with</strong> DB2, refer to Appendix B or review the<br />
eBook <strong>Getting</strong> started <strong>with</strong> DB2 Express-C which is part of this book series.<br />
After downloading DB2 Express-C, you need to install it. If you don't have a server<br />
available, you can always work <strong>with</strong> DB2 and Community Edition on the Cloud. As<br />
mentioned in Chapter 2, there is an all-in-one template that contains DB2 and Community<br />
Edition available on RightScale for deployment on the Amazon EC2 cloud at<br />
https://my.RightScale.com.<br />
If you do have a server where you have installed Community Edition and DB2, create a<br />
database in two ways:<br />
• Using a graphical tool like IBM Data Studio<br />
• Using a command line interface like the DB2 Command Line Processor (CLP)<br />
included <strong>with</strong> DB2.<br />
We will use the CLP to create a database called TESTDB as follows: