16.10.2015 Views

Getting Started with WebSphere Application Server

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

100 <strong>Getting</strong> <strong>Started</strong> <strong>with</strong> <strong>WebSphere</strong> <strong>Application</strong> <strong>Server</strong> Community Edition<br />

Figure 5.3 – Create database Studntdb DB2 Express-C 9.7<br />

Then, connect to the database, and create the table Student using the SQL statements<br />

in Listing 5.11.<br />

CONNECT TO STUDNTDB;<br />

CREATE TABLE Student(<br />

ID INT NOT NULL, SCORE1 INT NOT NULL, SCORE2 INT NOT NULL,<br />

SCORE3 INT NOT NULL, CREDIT INT ,<br />

CONSTRAINT STUDENT_SOLE_NUM PRIMARY KEY (ID));<br />

Listing 5.11 – SQL statement to create table Student<br />

2. Create a database pool<br />

Follow the steps in section 4.2.2 to create a database pool for database Studntdb<br />

and deploy it into Community Edition. The database pool name is jdbc/Student as<br />

shown in Figure 5.3.<br />

Figure 5.4 – Deployed database pool in Community Edition<br />

3. Create a JPA project in Eclipse<br />

Choose File->New->JPA project, to create a JPA project named ejb-studentjpa. If<br />

you can’t see JPA project as a choice, just click Other… then choose JPA project from<br />

the popped up dialog as shown in Figure 5.5.

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

Saved successfully!

Ooh no, something went wrong!