16.10.2015 Views

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.

Chapter 4 – Working <strong>with</strong> databases 67<br />

1. On Windows, open a command prompt and type db2cmd. This will open the CLP.<br />

On Linux, log on to the DB2 server as the DB2 instance owner (normally<br />

db2inst1), and open a terminal window.<br />

2. Input this statement to create the DB2 database TESTDB as shown in Figure 4.2.<br />

Creating the database takes a few minutes to complete.<br />

db2 create db testdb using codeset utf-8 territory US<br />

Note:<br />

Figure 4.2 - Creating the DB2 database TESTDB from the CLP<br />

You now have a DB2 database ready for use.<br />

DB2 provides a sample database called SAMPLE. This database is normally created by<br />

default after DB2 installation; therefore, you could use this database for the exercises in<br />

this book too.<br />

4.2.2 Configuring and deploying a database pool<br />

Community Edition provides a user interface to configure a database pool step by step. A<br />

typical database pool configuration includes these steps:<br />

1. Install the database vendor JDBC driver<br />

2. Configure and deploy the database pool<br />

4.2.2.1 Installing the database vendor JDBC driver<br />

JDBC is a set of APIs for Java that define how a client accesses relational databases. Most<br />

database vendors provide JDBC drivers for their databases. There are different drivers<br />

supported in DB2 as shown in Table 4.1 below.<br />

Driver<br />

Type<br />

Driver Name<br />

Packaged<br />

as<br />

JDBC<br />

specification<br />

supported<br />

Minimum level of<br />

SDK for Java<br />

required<br />

Type 2<br />

DB2 JDBC Type 2 Driver<br />

for Linux, UNIX and<br />

Windows (Deprecated*)<br />

db2java.zip<br />

JDBC 1.2 and<br />

JDBC 2.0<br />

1.4.2

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

Saved successfully!

Ooh no, something went wrong!