29.01.2013 Views

WebSphere Application Server - IBM Redbooks

WebSphere Application Server - IBM Redbooks

WebSphere Application Server - IBM Redbooks

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

6.2.2 Creating the database<br />

Although Studio Site Developer can interact with databases, it cannot create a<br />

database for you. To begin, you must use the database product facilities to create<br />

the database.<br />

To illustrate the database access features of Studio Site Developer we will take<br />

you through the process we used to create and work with the SALESAPP<br />

database for our sample application. We recreated the sample using <strong>IBM</strong> DB2,<br />

Oracle, and Microsoft SQL <strong>Server</strong>.<br />

DB2<br />

In DB2 you can use the DB2 Control Center to create a database by selecting<br />

Databases -> Create -> Database. Or you can open a DB2 command window<br />

and enter:<br />

db2 create db SALESAPP<br />

The user that creates the database will be granted full access. You should<br />

consider creating a user ID (on the database server) and giving that user ID the<br />

proper access for the application. You can use the DB2 Control Center to do this.<br />

Oracle<br />

In Oracle a database name is specified during installation and tablespaces are<br />

created afterward to hold data. In this example, we have installed an Oracle<br />

instance and are now creating a tablespace named SALESAPP. This can be<br />

done either interactively in the Enterprise Manager console, or by doing the<br />

following with SQLPLUS:<br />

1. Create a tablespace called SALESAPP. For example:<br />

create tablespace salesapp datafile ‘saleslog’ size 4M reuse autoextend on<br />

next 2M maxsize unlimited<br />

2. Create a user and grant the dba option. For example, to add the db2admin<br />

user execute the following:<br />

create user db2admin profile default identified by db2admin default<br />

tablespace salesapp ;<br />

grant dba to db2admin with admin option;<br />

Microsoft SQL <strong>Server</strong><br />

In our sample application database we use a mechanism to generate<br />

incremental numbers in columns. In DB2 and Oracle this is achieved by creating<br />

a database object of type sequence. In SQL <strong>Server</strong> this can be achieved by<br />

creating a one-column/one-row table that stores order numbers and is manually<br />

incremented every time it is used. Unfortunately, since SQL handles this<br />

158 <strong>IBM</strong> <strong>WebSphere</strong> <strong>Application</strong> <strong>Server</strong> - Express V5.0.2 Developer Handbook

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

Saved successfully!

Ooh no, something went wrong!