(Ebook) Foundation Db2 and Python: Access Db2 with Module-Based API Examples Using Python by W. David Ashley ISBN 9781484269411, 1484269411 - The ebook in PDF and DOCX formats is ready for download
(Ebook) Foundation Db2 and Python: Access Db2 with Module-Based API Examples Using Python by W. David Ashley ISBN 9781484269411, 1484269411 - The ebook in PDF and DOCX formats is ready for download
com
https://ebooknice.com/product/foundation-db2-and-python-
access-db2-with-module-based-api-examples-using-
python-33794994
OR CLICK BUTTON
DOWLOAD EBOOK
(Ebook) Foundation Db2 and Python: Access Db2 with Module-Based API Examples Using
Python by W. David Ashley ISBN 9781484269428, 148426942X
https://ebooknice.com/product/foundation-db2-and-python-access-db2-with-module-
based-api-examples-using-python-33967966
ebooknice.com
(Ebook) Foundation Dynamic Web Pages with Python: Create Dynamic Web Pages with
Django and Flask by David Ashley ISBN 9781484263389, 9781484263396, 1484263383,
1484263391
https://ebooknice.com/product/foundation-dynamic-web-pages-with-python-create-
dynamic-web-pages-with-django-and-flask-22417576
ebooknice.com
https://ebooknice.com/product/foundations-of-pygtk-development-gui-creation-
with-python-7319602
ebooknice.com
(Ebook) Up and Running with DB2 on Linux by IBM ISBN 9780738485317, 0738485314
https://ebooknice.com/product/up-and-running-with-db2-on-linux-42975650
ebooknice.com
(Ebook) Understanding DB2(R): Learning Visually with Examples (2nd Edition) by Raul
F. Chong, Xiaomei Wang, Michael Dang, Dwaine R. Snow ISBN 9780131580183, 0131580183
https://ebooknice.com/product/understanding-db2-r-learning-visually-with-
examples-2nd-edition-1480140
ebooknice.com
(Ebook) Advanced Data Analytics Using Python: With Machine Learning, Deep Learning
and NLP Examples by Mukhopadhyay, Sayan ISBN 9781484234495, 1484234499
https://ebooknice.com/product/advanced-data-analytics-using-python-with-machine-
learning-deep-learning-and-nlp-examples-55670484
ebooknice.com
https://ebooknice.com/product/practical-explainable-ai-using-python-artificial-
intelligence-model-explanations-using-python-based-libraries-extensions-and-
frameworks-36684612
ebooknice.com
(Ebook) Up and Running With DB2 for Linux by IBM Redbooks, Whei-Jen Chen ISBN
9780738427676, 0738427675
https://ebooknice.com/product/up-and-running-with-db2-for-linux-1383072
ebooknice.com
(Ebook) Supervised Learning with Python: Concepts and Practical Implementation Using
Python by Vaibhav Verdhan ISBN 9781484261569, 1484261569
https://ebooknice.com/product/supervised-learning-with-python-concepts-and-
practical-implementation-using-python-24688908
ebooknice.com
Foundation
Db2 and Python
Access Db2 with Module-Based API
Examples Using Python
—
W. David Ashley
Foundation Db2
and Python
Access Db2 with Module-Based API
Examples Using Python
W. David Ashley
Foundation Db2 and Python
W. David Ashley
Austin, TX, USA
v
Table of Contents
vi
Table of Contents
Creating a Table��������������������������������������������������������������������������������������������������������������������� 41
Alter a Table��������������������������������������������������������������������������������������������������������������������������� 43
Other Table SQL Statements�������������������������������������������������������������������������������������������������� 43
Dropping a Table�������������������������������������������������������������������������������������������������������������������� 44
Summary������������������������������������������������������������������������������������������������������������������������������������ 44
vii
Table of Contents
viii
Table of Contents
ix
Table of Contents
ibm_db.execute_many�������������������������������������������������������������������������������������������������������� 163
ibm_db.fetch_tuple������������������������������������������������������������������������������������������������������������� 165
ibm_db.fetch_assoc������������������������������������������������������������������������������������������������������������ 166
ibm_db.fetch_both�������������������������������������������������������������������������������������������������������������� 167
ibm_db.fetch_row��������������������������������������������������������������������������������������������������������������� 168
ibm_db.field_display_size��������������������������������������������������������������������������������������������������� 169
ibm_db.field_name������������������������������������������������������������������������������������������������������������� 169
ibm_db.field_num��������������������������������������������������������������������������������������������������������������� 170
ibm_db.field_precision�������������������������������������������������������������������������������������������������������� 172
ibm_db.field_scale�������������������������������������������������������������������������������������������������������������� 173
ibm_db.field_type���������������������������������������������������������������������������������������������������������������� 174
ibm_db.field_width������������������������������������������������������������������������������������������������������������� 174
ibm_db.foreign_keys����������������������������������������������������������������������������������������������������������� 175
ibm_db.free_result�������������������������������������������������������������������������������������������������������������� 178
ibm_db.free_stmt���������������������������������������������������������������������������������������������������������������� 179
ibm_db.get_option�������������������������������������������������������������������������������������������������������������� 179
ibm_db.next_result������������������������������������������������������������������������������������������������������������� 181
ibm_db.num_fields�������������������������������������������������������������������������������������������������������������� 183
ibm_db.num_rows�������������������������������������������������������������������������������������������������������������� 184
ibm_db.pconnect����������������������������������������������������������������������������������������������������������������� 185
ibm_db.prepare������������������������������������������������������������������������������������������������������������������� 187
ibm_db.primary_keys���������������������������������������������������������������������������������������������������������� 188
ibm_db.procedure_columns������������������������������������������������������������������������������������������������ 190
ibm_db.procedures������������������������������������������������������������������������������������������������������������� 192
ibm_db.recreatedb�������������������������������������������������������������������������������������������������������������� 194
ibm_db.result���������������������������������������������������������������������������������������������������������������������� 194
ibm_db.rollback������������������������������������������������������������������������������������������������������������������� 195
bm_db.server_info�������������������������������������������������������������������������������������������������������������� 196
ibm_db.set_option��������������������������������������������������������������������������������������������������������������� 199
ibm_db.special_columns���������������������������������������������������������������������������������������������������� 201
x
Table of Contents
ibm_db.statistics����������������������������������������������������������������������������������������������������������������� 203
ibm_db.stmt_error�������������������������������������������������������������������������������������������������������������� 206
ibm_db.stmt_errormsg������������������������������������������������������������������������������������������������������� 206
ibm_db.table_privileges������������������������������������������������������������������������������������������������������ 207
ibm_db.tables���������������������������������������������������������������������������������������������������������������������� 209
Summary���������������������������������������������������������������������������������������������������������������������������������� 210
Index��������������������������������������������������������������������������������������������������������������������� 211
xi
About the Author
W. David Ashley is a technical writer for Skillsoft where he
specializes in open source, particularly Linux. As a member
of the Linux Fedora documentation team, he recently led
the Libvirt project documentation and wrote the Python
programs included with it. He has developed in 20 different
programming languages during his 30 years as a software
developer and IT consultant, including more than 18 years at
IBM and 12 years with American Airlines.
xiii
About the Technical Reviewer
Sourav Bhattacharjee is a senior technical member for
Oracle Cloud Infrastructure. As part of IBM Watson Health
Lab, he has developed many scalable systems, published a
few research papers, and applied some patents to USPTO. He
has an ample amount of hands-on experience in Python,
Java, machine learning, and many database systems. He
earned his master’s degree from the Indian Institute of
Technology, Kharagpur, India.
xv
CHAPTER 1
Introduction to Db2
Welcome to this introduction to Db2. Since you are here, you are likely looking for a
place to get started with Db2. Our hope is that this book will be that first step you are
looking for. This book is meant to be an introduction to the Db2 environment and to
the Python interface. The first half of the book will cover Db2 at a level that should be of
interest to both administrators and programmers. It will cover many aspects of Db2 that
you will make use of in either of the two roles. The last half of the book will concentrate
on using the Python programming language to interface to Db2. While mainly oriented
to programmers, administrators will find it useful as well for some of their everyday
tasks.
Db2 has a long history and is the first relational database implementation. It was
first proposed by Edgar Frank “Ted” Codd in a paper titled “A Relational Model of Data
for Large Shared Data Banks” in 1969 while working at the IBM’s San Jose Research
Laboratory in California. In the next four years, IBM researchers worked to create a
system based on the principles described in Codd’s paper (called System R). During
this time, it became obvious that a new language was needed to interact with the new
system. Codd wrote a new paper “A Data Base Sublanguage Founded on Relational
Calculus,” which became the basis for the new language called DSL/Alpha. This quickly
went through some name changes but eventually ended up being called SQL, short for
Structured Query Language.
Eventually there was an effort in the 1970s to port DSL/Alpha to the 370 mainframe
environment. It was renamed to Database 2 in 1982. The next year it was made available
to the public with another name change, DB2. This was a limited release but was highly
regarded by the customers that evaluated it. The customers actually pushed IBM to
deliver DB2 to a wider set of customers. IBM was somewhat reluctant because they were
trying to hold on to their IMS/DB market share. But eventually the customers won out,
and DB2 began to spread to other platforms including OS/2, AIX/RS6000, and Windows.
1
© W. David Ashley 2021
W. D. Ashley, Foundation Db2 and Python, https://doi.org/10.1007/978-1-4842-6942-8_1
Chapter 1 Introduction to Db2
Over the next two decades, the product went through a number of name changes
and several platform code bases. Recently with the release of version 11.1, IBM
rebranded the entire product line and brought the code bases into a small number of
code bases. The following set of products are now the standard offerings:
The code bases for today’s Db2 offerings share a common code base that makes
porting the code to another hardware/software platform a relatively easy process. The
SQL code base has been standardized so that it is the same across all platforms, making
moving to another platform an easy task from a programming perspective.
There is also a current movement in programming applications with embedded
SQL. These types of applications are very hard to port from one platform to another
without major code modifications. Instead, IBM is moving (where possible) to an API
that can be called to process SQL statements and make use of programming language
variables for values to be added to the SQL statement. This is the methodology used for
Python that we will explore later in this book.
In the past, Db2 was considered to be too large for most applications. But as personal
computers have become a lot more powerful and then databases used by even a small
number of people have become extremely large, Db2 has become more attractive in the
management of this data. Also, the pricing model of Db2 on these platforms has become
more competitive. So if you need the performance and the ability to manage large
amounts of data, Db2 can be a very attractive product.
2
Chapter 1 Introduction to Db2
This table is a good example because it shows the kind of relationships that can
be expressed in a relational database. The CUSTNO column holds a unique customer
number for each customer (or row). The column is the primary key for this table. The
FNAME and LNAME identify the first and last names of the customer. The STREET is
the address to be used for billing the customer. The STATE column is the U.S. state the
address is located. The ZIP column identifies the mailing zip code.
3
Chapter 1 Introduction to Db2
D
omains
Domains (or attributes) limit the data in a column to a particular type. For instance, the
data might be an integer of a particular type, a monetary value, a character string of fixed
or variable length, a date or time value, or some other domain that has been defined.
K
eys and Indexes
The STATE column in Table 1-1 is a foreign key – that is, a primary key in another table.
A rule can be set up so that when you add a new row to the customer table, the system
checks that the value in your proposed STATE field is a valid entry in the state table. If it is
not, the record will not be inserted, and an error will be generated. Keys are also known
as indexes. When you create a primary key in a table, a special index table is created to
hold valid keys. This table is like any other table in the system; it can be queried, added
to, and deleted from. Thus, all the valid keys can be inserted into and maintained in the
table, and it can be maintained just like any other table. Only the special rules make the
index table special.
R
elationships
All of this shows just some of the kinds of relationships that can be created (or derived)
to properly maintain a set of tables. There are probably other kinds of customer tables
that could be created like a table to maintain customer credit ratings, a customer
shipping address table, a customer contacts table, etc. All of these are specialized entities
that have relationships with the other customer tables. This is what a relational database
is all about. The idea is to express a relationship with data organized so the data is only
stored where needed and hopefully only one time.
Relationships allow the user to create customized reports that can express custom
views of the data from the database. At first glance these reports may look like they have
no relation to the data contained in the database, but they can give insights to the data
not easily possible by other means.
4
Chapter 1 Introduction to Db2
Transactions
Another aspect of relational databases is support for transactions. This means providing
a locking mechanism that can allow data to be modified while others are reading the
data or modifying other data at the same time. This is known as the ACID test, which is
an acronym for the following tests:
Stored Procedures
A relational database typically implements stored procedures. These are programs
stored in the database to implement special processing under several circumstances.
These procedures usually involve business logic that needs to be implemented the
same across all the database users. In many cases, only the stored procedure has the
proper permissions to modify, insert, delete, or access the data being manipulated. This
prevents users from making modifications to the data if they do not have the correct
permissions.
5
Chapter 1 Introduction to Db2
Constraints
Another property of relational databases are constraints. These make it possible to
further restrict an attribute. For instance, a column might be defined as an integer. But
the range of numbers might actually need to be constrained to a particular range. This is
what a constraint provides.
Constraints can come in many forms and are used for a number of purposes. They
are stored within the database and used when adding or modifying data.
Normalization
Normalization is another attribute of a relational database. This design process reduces
the number of nonatomic values and the duplication of data throughout the database,
thus preventing anomalies and loss of integrity. The process is known as normalization.
The process of normalization is performed by the administrator, usually during the
creation of the database. Users are not usually involved in this activity.
SQL
Within the first few years of creating the first relational database, it became very obvious
that something was needed to actually manipulate the data in a relational database. The
language was invented at IBM by Donald D. Chamberlin and Raymond F. Boyce in the
early 1970s. It was originally known as SEQUEL, but that name was trademarked and it
was changed to Structured Query Language (SQL). SQL was later standardized by ANSI,
but each relational database product extended it as needed to conform to their product
or hardware platform.
SQL is divided into four categories of statements:
Most SQL books spend most of their resources on the DML part of SQL, but the other
parts are just as important, especially to the database administrator.
6
Chapter 1 Introduction to Db2
7
Chapter 1 Introduction to Db2
The INSERT statement adds new rows into a table. This new data may also
automatically alter the content of a view of the table data.
The UPDATE statement alters one or more rows in an existing table (and any view
dependent on the table). The statement does not add new rows to a table, it only alters
existing data.
The DELETE statement removes rows from a table (and any view dependent on the
table).
S
ummary
This chapter has presented some of the basic concepts that make up a relational
database and the SQL that supports it. This information is common to almost all
relational databases.
8
CHAPTER 2
Installing Db2
This chapter covers installing Db2 on Linux and Windows. Both environments use
the same installer to perform installation and creation of userids and permissions.
The installation process is pretty easy and straightforward, but there are a number of
questions you might have before you start the installation that are not answered by the
install program. We will try to cover those questions as we come to them.
9
© W. David Ashley 2021
W. D. Ashley, Foundation Db2 and Python, https://doi.org/10.1007/978-1-4842-6942-8_2
Chapter 2 Installing Db2
The fourth system is a Lenovo ThinkCentre M920 with 256 GB of SSD and a 1 TB
drive with 16 GB of memory. It has an i7 CPU. This is my development workstation
where I test all my Linux development and remote access to servers. The operating
system is Fedora 32.
The fifth system is a Lenovo ThinkPad T580 with 256 GB of SSD, 16 GB of memory,
and an i7 CPU. It runs Fedora 32 and usually serves as my travel machine but also as an
auxiliary test device.
I nstallation Prerequisites
Before you even start the Db2 install program, there are a number of prerequisites that
need to be met before you can successfully install everything. Our install environment
for this book is CentOS 8.2. The prerequisites for this OS should be the same for RHEL
8.2, but may be different for other Linux environments. Windows environments have
their own prerequisites, but they are similar to the Linux prerequisites.
The first thing we need is the Db2 install program and support files. To get the free
version of Db2, just go to
www.ibm.com/account/reg/us-en/signup?formid=urx-33669
This gets you to the account registration page. You can either log in with an existing
userid or create a new one. After you are logged in, the website will present you a
preferences page. Select your preferences and select the Continue button. On the
next web page, select the download you need. Unless you need them, just ignore the
pureScale support downloads. Once the download is complete, move the downloaded
file to a safe location and then unzip or untar it. This will create a new subdirectory in the
current directory with the install files exploded inside.
Caution! Do not move the downloaded file to the directory you intend to place
databases. You will have a mess of files on your hands when you create your first
database.
At the time this book was written, the version of Db2 that was available was version
11.5.4. Older free versions of Db2 are not made available when IBM introduces a new
version.
10
Chapter 2 Installing Db2
Now that you have your evaluation version of Db2, you are probably wondering what
its limitations are. The evaluation version does not ever expire. It has no limitation on
the number of databases. The one and only limitation is the total size of all databases,
currently limited to 100 GB. This is more than enough space to perform your own
evaluation of the software unless you are trying to test a very large system. If that is your
plan, IBM will be more than glad to help with a production version of Db2 and even
some engineers.
At this point, we are now ready to find out what our prerequisites are. To do this,
simply run the install program. This program is located in the untarred subdirectory
we previously created. The expanded directory is named server_dec. To run the install
program, just run the following commands:
$ cd server_dec
$ ./db2setup
If prerequisites are needed by Db2, the install program will list them and then exit.
Be sure to read everything output by the install program. On our CentOS 8.2 system, it
listed two prerequisites:
• libpam.so* (32-bit)
• libstdc++.so.6 (32-bit)
“Wait. Why does Db2 need 32-bit libraries?” you ask. Db2 is a collection of a bunch
of products, some of which have not changed in a decade or more. Rather than possibly
introducing new bugs into the system, IBM has chosen to keep the older version of
some of these products. Thus, these prerequisite libraries are needed to support those
products.
Use your system’s software installer to install the prerequisite packages. For Linux,
this will be either the dnf or yum programs for RPM-based packages. Once you have the
prerequisites installed, you are ready to proceed to really installing Db2. But before we
do that, we need to do a little planning.
11
Chapter 2 Installing Db2
The first result of the install is that you will have two new userids created on the
target machine. The default names of these IDs are db2inst1 and db2fenc1. The
db2inst1 ID will have some files stored in its home directory, and you need to make
sure there is enough space to accommodate them. There are a limited number of files,
but you should make sure you are prepared for them. The db2fenc1 ID only has a very
limited number of files stored in its home directory.
The second result is not really a result of the install. It is more a default that is set
as a result of the install. This item is the location where databases will be installed. The
default location for databases is in the db2inst1 home directory! THIS IS NOT WHERE
YOU WANT TO STORE DATABASES! You are probably going to store them on a different
drive/location. We will discuss this point again after we cover the install process and
before we create the sample database.
There are also a few minor points that are a result of the install, but we will cover
those as we get to them.
I nstalling Db2
We are now ready to install Db2. This process must be done by the root (on Linux)
or admin (on Windows) user, so start by becoming the root/admin user. On Windows
you will need to log out and log back in as the admin user. On Linux just perform the
following command:
$ su - root
After this you need to change to the directory where you placed the expanded files of
the Db2 download package. Then run the db2setup install package:
$ cd server_dec
$ ./db2setup
If you have installed all the prerequisites, this should show you the Welcome page
(Figure 2-1).
12
Chapter 2 Installing Db2
This page has a number of products that you can select. The first product is Db2
Server, and this is the product we will install. The second product is Db2 with pureScale,
which we did not download. The third product is Db2 Connect Server, which is used
for distributed databases. The fourth product is Db2 Connect Client, which is used for
building compiled code that includes SQL statements. The last product is Db2 Runtime
Client, which is used for running compiled code from the Db2 Connect Client version.
At this point you should select the top item in the list, Db2 Server Editions. The
version number may be different if you downloaded a newer version of Db2. The other
selections are not important at this point in time. After clicking the Next button, the next
page will appear.
14
Chapter 2 Installing Db2
The Configuration page allows you to select either a Typical or a Custom install. At
this point, select a Typical install. You must also check the box to agree to the IBM terms
before you proceed. When finished, click the Next button and the next page shown in
Figure 2-4 will appear.
You can check out the Custom install option for some items you may want to change.
Most users just perform a Typical install.
The Instance Owner page allows you to create the account that will own the first
instance of Db2 and the group name of the new user. Just leave the db2inst1 information
as it appears and then enter the password and confirmation for the new account. This
is the account that will have new files installed in its home directory. When you have
entered in the new password and confirmed it for the account, click Next and the page
shown in Figure 2-5 will be displayed.
15
Chapter 2 Installing Db2
The db2fenc1 user will run user-defined functions and stored procedures outside the
address space of the Db2 database. Enter the db2fenc1 password and confirm it. When
finished, click Next which will dosplay the page in Figure 2-6.
16
Chapter 2 Installing Db2
The next page is the Response File and Summary page. The response file is a part of
the installation set of files, so it does not have to be created. Click the Finish button to
start the install of Db2 as shown in Figure 2-7.
17
Chapter 2 Installing Db2
When the installation is complete, this is the page that will be shown. You can choose
to review the post-install steps, review the log file, or just click the Finish button to exit
the install.
At this point, the Db2 installation steps are complete, and we are ready to look at the
post-install tasks that will need to be considered.
Note With Ubuntu Linux, the Db2 instance owner and fenced user that are
created by the Db2 install are assigned the Dash shell by default. This can cause
scripts that begin with the line #!/bin/bash to stop working. If you want to use Bash
as the default shell when you log into either of these users, execute the command
csh -s /bin/bash username (where username is the name of the Db2 instance
owner or fenced user) before doing anything else.
1. Try to log into the db2fenc1 userid using the password you set
from the db2setup command. Correct any problems you may find.
2. Try to log into the db2inst1 userid using the password you set
from the db2setup command. Correct any problems you may
find. You should note the location of the sqllib directory and its
contents as you may need to become familiar with them. This may
or may not be a link to another location.
This will update the path in the Db2 configuration so that all databases belonging to
db2inst1 will be stored in the new location.
At this point, we are now finished with our post-install tasks, and we are ready to
proceed to installing the sample database.
19
Chapter 2 Installing Db2
$ su - db2inst1
The Db2 database instance needs to be started, so that is our next step:
$ db2start
Now we can actually install the sample database. This command will take a few
minutes, so be patient:
The -force option ensures that if the database is already installed, it will be overlaid
with the default content. The -sql option tells Db2 not to install the XML data into the
database.
Now we can connect to the database and test it:
If successful, you should see some output that looks something like this:
20
Chapter 2 Installing Db2
Important Be sure to include quotes around the text that follows db2. If the
quotes are omitted, the operating system will try to process the command
incorrectly, and an error will result.
Summary
This chapter has presented the steps to installing and verifying the installation of Db2.
Be sure to read the Caution, Note, and Important sections presented in the chapter as
they have valuable information for some operating systems.
21
CHAPTER 3
Db2 Management
The management of Db2 is not an easy affair. It is not like any open source relational
database. It is a little like Oracle, but there are differences. This is because Db2 for Linux,
Unix, and Windows is a lot like maintaining a mainframe database, just on a smaller and
easier scale. While there are many tools to help manage the Db2 environment contained
in the product itself, the key to proper management is understanding the architecture
of the product and how it manages hardware resources. Without this knowledge, it
is easy to get into trouble and overextend the hardware of the machine. With proper
management, a single piece of hardware can manage either a few large databases or
many smaller ones without stretching the resources on the machine too far.
This chapter will give you enough knowledge so that you can set up the Db2
environment properly without overburdening you with facts that have few, if any,
consequences.
D
b2 Instances
Instances are the top-level architectural structure in Db2. When you installed Db2, you
created the first Db2 Instance, which had the default name of db2inst1. This is also the
Instance that holds the sample database we installed in the previous chapter.
Any number of databases can be installed in an Instance. But it is possible to
overload an Instance and cause performance problems. This is because Db2 sets aside
a fixed number of processes and threads for each Instance, and it does not dynamically
add or remove resources during the active lifetime of an Instance. You must stop the
instance, adjust the number of resources, and then restart the Instance. Of course, the
databases owned by the Instance will have to be stopped and restarted as well. That
is the key: stopping and starting an Instance can have impacts on availability and the
contained databases. If you are continually stopping and restarting Instances, your
users will not be very happy with your management skills.
23
© W. David Ashley 2021
W. D. Ashley, Foundation Db2 and Python, https://doi.org/10.1007/978-1-4842-6942-8_3
Chapter 3 Db2 Management
Instances are easy to describe, but harder to justify. You have to know some history
to be able to properly understand where they came from as well as why they even exist.
Instances were first introduced just after the year 2000. Their justification came as the
databases on multi-drive machines started to become very large. They were so large
and had so many users that the network interface became a bottleneck in processing
database requests. It seems that the machines now far outpaced the network in being
able to handle database requests. Db2 had plenty of idle time while it waited on the
network interface to process the next request. This was in the days when the fastest
common networks were only 10 MB capacity. What was needed was a way to divide the
databases among multiple network ports. Thus, instances were born.
Instances were not only given their own network port, they were also given their
own processes, threads, and semaphores. Thus, if a database crashed for any reason, it
would only disrupt the databases within the containing Instance. The other Instances
and databases would continue to run normally while the database administrator dealt
with the downed Instance.
Instances can be used in many ways by the database administrator, but the most
common use is to prevent network port congestion. The second most common use is to
separate sets of databases from each other for security purposes. Since each Instance
has its own set of administrators and users, this helps to enforce security between
Instances.
One other attribute of an instance is that it has no physical presence on your disk
system, or at least not much of one. It is very hard to point to a place in the disk system
and say, “This is where an instance resides.” There are a few files created with the
instance, but these do not describe where the instance is. You should just think of it as
a logical entity and not a physical one.
There is a set of commands that administrators can use to manage instances. The
following are some example Db2 commands that manage Instances.
Note All the commands used in this chapter can be run in one of two ways. They
can be run by logging into the db2inst1 user, or they can be run by using the
sudo db2inst1 prefix to the command.
24
Chapter 3 Db2 Management
db2ilist
This command lists all the Instances that are available on a system:
db2ilist
Output:
db2inst1
db2inst2
db2inst3
Output:
To start or stop the database manager of an instance on Db2 UDB, the following
command is executed for the current instance:
set db2instance=db2inst1
Using this command, you can start an Instance. Before this, you need to run “set
instance”:
db2start
Output:
db2stop
Output:
25
Chapter 3 Db2 Management
Creating an Instance
Let us see how to create a new Instance.
If you want to create a new Instance, you need to log in with root. An Instance ID is
not a root ID or a root name.
Here are the steps to create a new Instance:
Step 1: Create an operating system user for an Instance.
Example:
Step 2: Go to the Db2 Instance directory as a root user to create a new Instance.
Location:
cd /opt/ibm/db2/v10.1/instance
Example:
Output:
26
Chapter 3 Db2 Management
Example:
Syntax 1: Update configuration with the service name. In the following syntax,
“svcename” indicates the Instance service name, and “inst_name” indicates the
Instance name.
Example 1: Updating DBM configuration with variable svcename with value “db2c_
db2inst2” for Instance “db2inst2”
Output,:
Syntax 2: Set the “tcpip” communication protocol for the current Instance.
db2set DB2COMM=tcpip
Syntax 3: Stop and start the current Instance to get updated values from database
manager configuration.
db2stop
db2start
Updating an Instance
You can update an instance using the following command,:
db2iupdt
This command is used to update the Instance within the same version release.
Before executing this command, you need to stop the Instance database manager using
the “db2stop” command. The following syntax “inst_name” indicates the previously
released or installed Db2 server Instance name, which you want to update to a newly
released or installed Db2 server version.
27
Chapter 3 Db2 Management
db2iupdt <inst_name>
Example:
./db2iupdt db2inst2
db2iupdt -D <inst_name>
Example:
db2iupdt -D db2inst2
Upgrading an Instance
You can upgrade an instance from a previous version of a Db2 copy to a newly installed
version of a Db2 copy:
db2iupgrade
Example:
Command parameters:
If you are using the super user (su) on Linux for the db2iupgrade command, you
must issue the “su” command with the “-” option.
28
Chapter 3 Db2 Management
Dropping an Instance
You can drop or delete an instance, which was created by the “db2icrt” command:
db2idrop
On Linux and UNIX operating systems, this command is located in the DB2_
installation_folder/instance directory.
Syntax:
Example:
Output:
Syntax 2:
Example:
Output:
Syntax 3:
29
Chapter 3 Db2 Management
Example:
Output:
INST_NAME --------------------------------------
db2inst1
1 record(s) selected.
Syntax 4:
db2set db2instdef=<inst_name> -g
Example:
db2set db2instdef=db2inst2 -g
Databases
Databases are the next level of manageable objects in Db2. Every database is contained
inside of a single Instance, but there can be multiple databases contained inside an
Instance.
The database has no communications interface to the outside world. Instead,
the Instance controls communications between each contained database and the
outside world. This reduces the redundancy of the communication code when multiple
databases are owned by the Instance.
A database contains a large group of objects that together make up both the
administration and the storage locations for the database. A partial list of these objects is
as follows:
• Tablespace information
• Temporary tablespaces
30
Chapter 3 Db2 Management
• History files
• Logging files
Each one of these objects will be discussed at length in the following sections and in
Chapter 4 later in this book.
www.ibm.com/support/knowledgecenter/SSEPGG_11.1.0/com.ibm.db2.luw.sql.ref.
doc/doc/r0008443.html
This documentation details the complete layout of each view with additional
information about all possible values for many columns.
Deadlock information can be written to two different database tables, but it is always
in binary format. Choosing between these two tables can be tricky, so careful thought
should be given to your choice. By using SQL to query the table, the system will interpret
the binary data and translate to a supported language such as English.
Enabling the locking event monitor is automatic when you execute the CREATE
statement for it. The following statement will enable the locking event monitor:
When a deadlock is detected, the following information is collected in the event log:
• The application holding the lock that resulted in the lock event
• The applications that were waiting for or requesting the lock that
resulted in the lock event
T ablespace Information
Tablespaces are used to contain database tables. When a database is created, three
tablespaces are created automatically. The first tablespace, SYSCATSPACE, contains the
database catalog and views. The second tablespace, USERSPACE1, is the default space
used to hold the database tables. The third, TEMPSPACE1, is used to hold temporary
tables for query results. All these tablespaces are created by default in the location
specified when the Db2 system was installed.
There is a lot of information on tablespaces, and this book has an entire chapter
devoted to that topic. See Chapter 4 for more information.
The basic command for obtaining tablespace information is as follows:
If the tblsp_name is NULL or an empty string, then all tablespaces will be returned.
The member specifies the member number of the tablespace. If it is –1, the current
member information is returned. If it is –2, then all member information is returned. If
NULL is specified, it is the same as specifying –1.
32
Chapter 3 Db2 Management
H
istory Files
History files are instance specific and are stored in the same place as the instance
information. They contain some global information on the instance like the last start and
stop times and other sometimes useful data. The number of these files can change from
release to release, so refer to your release-specific documentation for more information.
L ogging Files
The logging files are specific to a database and store information logged by the Db2
system. The number and types of the files will be specific to your database configuration.
33
Another Random Scribd Document
with Unrelated Content
"He said it was all over the village that you were going to marry
him."
"I—I didn't think it had got round so soon," said the widow,
nervously.
"So soon! Why, you don't mean to say there's anything in it,
mother?" said Frank, impetuously.
"I hope it won't displease you very much, Frank," said Mrs. Hunter,
in embarrassment.
"Is it true? Are you really going to marry that man?"
"He didn't ask me till this afternoon, and, of course, it took me by
surprise, and I said so, but he urged me so much that I finally
consented."
"You don't love him, mother? I am sure you can't love such a man as
that."
"I never shall love any one again in that way, Frank—never any one
like your poor father."
"Then why do you marry him?"
"He doesn't ask me to love him. But he can relieve me of a great
many cares and look after you."
"I don't want anybody to look after me, mother—that is, anybody
but you. I hate Mr. Craven!"
"Now that is wrong, Frank. He speaks very kindly of you—very kindly
indeed. He says he takes a great interest in you."
"I am sorry I cannot return the interest he professes. I dislike him,
and I always have. I hope you won't be angry, mother, if I tell you
just what I think of him. I think he's after your property, and that is
what made him offer himself. He is poor as poverty, though I don't
care half so much for that as I do for other things."
"No, Frank; you are mistaken there," said credulous Mrs. Hunter,
eagerly. "He is not poor."
"How do you know?"
"He told me that he had twenty thousand dollars' worth of mining
stock out West somewhere, besides owning a house in New York."
Frank looked astonished.
"If he has as much property as that," he said, "I don't see what
makes him come here. I don't believe his business brings him in
three hundred dollars a year."
"That's the very reason, Frank. He has money enough, and doesn't
mind if business is dull. He generously offered to pay—or was it help
pay?—the expenses of your education; but I told him that you didn't
need it."
"If I did, I wouldn't take it from him. But what you tell me surprises
me, mother. He doesn't look as if he was worth five hundred dollars
in the world. What made him tell you all this?"
"He said that some people would accuse him of being a fortune-
hunter, and he wanted to convince me that he was not one."
"It may be a true story, and it may not," said Frank.
"You are really very unjust, Frank," said his mother. "I don't pretend
to love Mr. Craven, and he doesn't expect it, but I am sure he has
been very kind, and he takes a great deal of interest in you, and you
will learn to know him better."
"When you are married to him?"
"Yes."
"Mother," exclaimed Frank, impetuously, "don't marry this man! Let
us live alone, as we have done. We don't want any third person to
come in, no matter who he is. I'll take care of you."
"You are only a boy, Frank."
"But I am already fifteen. I shall soon be a man at any rate, and I
am sure we can get along as well as we have done."
Mrs. Hunter was not a strong or a resolute woman, but even women
of her type can be obstinate at times. She had convinced herself,
chiefly through Mr. Craven's suggestion, that the step she was about
to take was for Frank's interest, and the thought pleased her that
she was sacrificing herself for him. The fact that she didn't fancy Mr.
Craven, of course heightened the sacrifice, and so Frank found her
far more difficult of persuasion than he anticipated. She considered
that he was but a boy and did not understand his own interests, but
would realize in future the wisdom of her conduct.
"I have given my promise, Frank," she said.
"But you can recall it."
"It would not be right. My dear Frank, why can you not see this
matter as I do? I marry for your sake."
"Then, mother, I have the right to ask you not to do it. It will make
me unhappy."
"Frank, you do not know what is best. You are too young."
"Then you are quite determined, mother?" asked Frank, sadly.
"I cannot draw back now, Frank. I—I hope you won't make me
unhappy by opposing it."
"I won't say another word, mother, since you have made up your
mind," said Frank, slowly. "When is it going to be?"
"I do not know yet. Mr. Craven wants it to be soon."
"You will let me know when it is decided, mother?"
"Certainly, Frank."
He left the room sad at heart. He felt that for him home would soon
lose its charms, and that he would never get over the repugnance
which he felt against his future step-father.
CHAPTER IV.
MR. CRAVEN'S FOUR-LEGGED ENEMY.
Mr. Craven called the next day, as usual. Frank apologized again for
Pompey's rude treatment of the evening previous, and, as far as he
could, established friendly relations between the parties. Pompey,
who had nothing vicious about him, and was only anxious to do his
duty, looked meek and contrite, and Mr. Craven, to all appearance,
had quite forgiven him.
"Good dog!" he exclaimed, patting Pompey's head. "Say no more
about it, Frank," he said, in his usual soft voice; "it was only an
accident. I foresee that Pompey and I will be excellent friends in
future."
"I hope your coat isn't much torn, sir."
"It can easily be repaired. It isn't worth mentioning. Is your mother
at home."
"Yes, sir. Walk in."
"He behaves very well about it," thought Frank. "He may be a better
man than I thought. I wish I could like him, as he is to be my step-
father; but I think there are some persons it is impossible to like."
So the time passed, and the wedding-day drew near. Frank did not
consider it honorable to make any further objection to the marriage,
though he often sighed as he thought of the stranger who was
about to be introduced into their small circle.
"Mother will seem different to me when she is that man's wife," he
said to himself. "I shall love her as much, but she won't seem to
belong to me as much as she did."
In due time the wedding was celebrated. Mrs. Hunter wished it to be
quiet, and Mr. Craven interposed no objection. Quiet or not, he felt
that the substantial advantages of the union would be his all the
same. Mrs. Hunter looked a little nervous during the ceremony, but
Mr. Craven was smiling and suave as ever. When he kissed his wife,
saluting her as Mrs. Craven, she shuddered a little, and with
difficulty restrained her tears, for it reminded her of her first
marriage, so different from this, in which she wedded a man to
whom she was devoted in heart and soul.
The ceremony took place at eleven o'clock, and the newly-wedded
pair started on a tour as previously arranged. So for two weeks
Frank and Katy O'Grady were left alone in the house. Katy was a
privileged character, having been in the family ever since Frank was
a baby, and she had no hesitation in declaring her opinion of Mr.
Craven.
"What possessed the mistress to marry such a mane specimen of a
man, I can't tell," she said.
"I don't like him myself," said Frank; "but we must remember that
he's my mother's husband now, and make the best of him."
"And a mighty poor best it will be," said Katy.
"There you go again, Katy!"
"I can't help it, shure. It vexes me intirely that my dear mistress
should throw herself away on such a man."
"What can't be cured must be endured, you know. You mustn't talk
that way after Mr. Craven comes back."
"And what for will I not. Do you think I'm afraid of him?" asked Katy,
defiantly. "If he is a man, I could bate him in a square fight."
"I don't know but you could, Katy," said Frank, glancing at the
muscular arms and powerful frame of the handmaiden; "but I really
hope you won't get into a fight," he added, smiling. "It wouldn't look
well, you know."
"Then he'd better not interfare wid me," said Katy, shaking her head.
"You must remember that he will be master of the house, Katy."
"But he sha'n't be master of Katy O'Grady," said that lady, in a very
decided tone.
"I don't suppose you'll have much to do with him," said Frank.
He sympathized with Katy more than he was willing to acknowledge,
and wondered how far Mr. Craven would see fit to exercise the
authority of a step-father. He meant to treat him with the respect
due to his mother's husband, but to regard him as a father was very
repugnant to him. But he must be guided by circumstances, and he
earnestly hoped that he would be able to live peacefully and
harmoniously with Mr. Craven.
Days passed, and at length Frank received a dispatch, announcing
the return home.
"They will be home to-night, Katy," he said.
"I'll be glad to see your mother, shure," said Katy, "but I wish that
man wasn't comin' wid her."
"But we know he is, and we must treat him with respect."
"I don't feel no respect for him."
"You must not show your feelings, then, for my mother's sake."
At five o'clock the stage deposited Mr. and Mrs. Craven at the gate.
Frank ran to his mother, and was folded in her embrace. Then he
turned to Mr. Craven, who was standing by, with his usual smile,
showing his white teeth.
"I hope you have had a pleasant journey, sir," he said.
"Thank you, Frank, it has been very pleasant, but we are glad to get
home, are we not, my dear?"
"I am very glad," said Mrs. Craven, thankfully, and she spoke the
truth; for though Mr. Craven had been all attention (he had not yet
thought it prudent to show himself in his true colors), there being no
tie of affection between them, she had grown inexpressibly weary of
the soft voice and artificial smile of her new husband, and had
yearned for the companionship of Frank, and even her faithful
handmaiden, Katy O'Grady, who was standing on the lawn to
welcome her, and only waiting till Frank had finished his welcome.
"How do you do, Katy," said her mistress.
"I'm well, mum, thankin' you for askin', and I'm mighty glad to see
you back."
"I hope you are glad to see me also, Katy," said Mr. Craven, but his
soft voice and insinuating smile didn't melt the hostility of Miss
O'Grady.
"I'm glad you've brought the mistress home safe," she said, with a
low bow; "we've missed her from morning till night, sure; haven't
we, Master Frank?"
"I see she isn't my friend," thought Mr. Craven. "She'd better change
her tune, or she won't stay long in my house."
He had already begun to think of himself as the sole proprietor of
the establishment, and his wife as an unimportant appendage.
"I hope you have some supper for us, Katy," said he, not choosing at
present to betray his feelings, "for I am quite sure Mrs. Craven and
myself have a good appetite."
"Mrs. Craven!" repeated Katy, in pretended ignorance. "Oh, you
mean the mistress, sure."
"Of course I do," said Mr. Craven, with a frown, for once betraying
himself.
"Supper is all ready, ma'am," said Katy, turning to Mrs. Craven. "It'll
be ready as soon as you've took off your things."
When they sat down to the table, Frank made a little mistake. He
had always been accustomed to sit at the head of the table,
opposite his mother, and on the frequent occasions of Mr. Craven's
taking a meal there during the engagement, the latter had taken the
visitor's place at the side.
So to-night, without thinking of the latter's new relations to him,
Frank took his old place. Mr. Craven noticed it, and soft and
compliant as he was, he determined to assert his position at once. "I
believe that is my place," he said, with an unpleasant smile.
"Oh, I beg pardon," said Frank, his face flushing.
"You forgot, I suppose," said Mr. Craven, still smiling.
"Yes, sir."
"You'll soon get used to the change," said his step-father, as he
seated himself in the chair Frank had relinquished.
Mrs. Craven looked a little uncomfortable. She began to realize that
she had introduced a stranger into the family, and that this would
interfere to a considerable extent with their old pleasant way of
living.
No one seemed inclined to talk except Mr. Craven. He seemed
disposed to be sociable, and passed from one subject to another,
regardless of the brief answers he received.
"Well, Frank, and how have you got along since we were away?" he
asked.
"Very well, sir."
"And you haven't missed us then?"
"I have missed my mother, and should have missed you," he added
politely, "if you had been accustomed to live here."
"And how is Pompey?" asked Mr. Craven, again showing his teeth.
"The same as usual. I wonder he was not out on the lawn to receive
you and my mother."
"I hope he wouldn't receive me in the same way as he did once,"
said Mr. Craven, again displaying his teeth.
"No danger, sir. He didn't know you then."
"That's true, but I will take care that he knows me now," said Mr.
Craven, softly.
"I think he will remember you, sir; he is a good dog, and very
peaceable unless he thinks there are improper persons about."
"I hope he didn't think me an improper person," said Mr. Craven.
"No fear, sir."
Frank wondered why Mr. Craven should devote so much time to
Pompey, but he was destined to be enlightened very soon.
CHAPTER VI.
THE DIFFICULTY OF KILLING A DOG.
Crouching behind the stone wall, Katy enjoyed the effect of what she
had done. She particularly enjoyed the bewildered look, of Mr.
Craven, who, bare-headed, looked on this side and on that, unable
to conjecture who had thrown the missile.
Pompey, unconscious of the danger he had escaped, walked up to
the tumbler and smelt of it. This attracted the attention of Mr.
Craven, who stooped and picked it up. His bewilderment increased.
If it had been a stone, he would have understood better, but how a
tumbler should have found its way here as a missile was
incomprehensible.
It slowly dawned upon him that the person who threw it must be
somewhere near. Then again, on examining it further, he began to
suspect that it was one of his wife's tumblers, and he jumped to the
conclusion that it was Frank who threw it.
"If it is he, I'll wring his neck!" he murmured, revengefully. "I mean
to find out."
"Pompey," he said, calling the dog, "do you see this tumbler?"
Pompey wagged his tail.
"Who threw it?"
Pompey looked up, as if for instructions.
"Go find him!" said Mr. Craven, in a tone of command.
The dog seemed to understand, for he put his nose to the ground
and began to run along, as if in search.
"Oh, murther! What if he finds me?" thought Katy, crouching a little
lower. "Won't he be mad, jist?"
Katy might have crawled away unobserved, very possibly, if she had
started as soon as the missile was thrown. Now, that dog and man
were both on the lookout, escape was cut off.
"Will he find me?" Katy asked herself, with some anxiety.
The question was soon answered.
Pompey jumped over the wall, and a joyous bark announced his
discovery. He knew Katy, and seemed to fancy that she had
concealed herself in joke. He jumped upon her, and wagged his tail
intelligently, as if to say:
"You see, I've found you out, after all."
Mr. Craven hurried to the wall, eagerly expecting to detect Frank in
the person concealed. He started back in astonishment as Katy
O'Grady rose and faced him. Then he became wrathful, as he
realized that his own hired servant had had the audacity to fling a
tumbler at his hat.
"What brings you out here, Katy?" he demanded, with a frown.
"Shure, sir," said Katy, nonchalantly, "I was tired wid stayin' in the
hot kitchen, and I thought I'd come out and take the air jist."
"And so you neglected the work."
"The worruk will be done; niver you mind about that."
"Did you fling this tumbler at my head?" demanded Mr. Craven,
sternly.
"Let me look at it, sir."
Katy looked at it scrutinizingly, and made answer:
"Very likely, sir."
"Don't you know?"
"I wouldn't swear it was the same one, sir, but it looks like it."
"Then you admit throwing a tumbler at my head, do you?"
"No, sir."
"Didn't you say you did just now?"
"I threw it at your hat."
"It is the same thing. How came you to have the cursed impudence
to do such a thing?" asked her master, wrathfully.
"Because you was goin' to shoot the dog," said Katy, coolly.
"Suppose I was, is it any business of yours?"
"The dog doesn't belong to you, Mr. Craven. It belongs to Master
Frank."
"I don't think it expedient for him to keep such an ill-natured brute
around."
"He calls you a brute, Pomp," said Katy, caressing Pompey—"you
that's such a good dog. It's a shame!"
"Catherine," said Mr. Craven, with outraged dignity, "your conduct is
very improper. You have insulted me."
"By the powers, how did I do it?" asked Katy, with an affectation of
innocent wonder.
"It was an insult to throw that tumbler at my head. I might order the
constable to arrest you."
"I'd like to see him thry it!" said Katy, putting her arms akimbo in
such a resolute fashion that Mr. Craven involuntarily stepped back
slightly.
"Are you aware that I am your master?" continued Mr. Craven,
severely.
"No, I'm not," answered Katy, promptly.
"You are a servant in my house."
"No, I'm not. The house don't belong to you at all, sir. It belongs to
my mistress and Master Frank."
"That's the same thing. According to the law, I am in control of their
property," said Mr. Craven, resolved upon a master-stroke which, he
felt confident, would overwhelm his adversary. "After the great
impropriety of which you have been guilty this afternoon, I discharge
you from my employment."
"You discharge me!" exclaimed Katy, with incredulous scorn.
"I discharge you, and I desire you to leave the house to-morrow."
"You discharge me!" repeated Katy, with a ringing laugh. "That's a
good one."
Mr. Craven's cadaverous face colored with anger.
"If you don't go quietly, I'll help you out," he added, incautiously.
"Come on, then," said Katy, assuming a warlike attitude. "Come on,
then, and we'll see whether you can put out Katy O'Grady."
"Your impudence will not avail you. I am determined to get rid of
you."
"And do ye think I'm goin' to lave the house, and my ould misthress,
and Master Frank, at the orders of such an interloper as you, Mr.
Craven?" she cried, angrily.
"I don't propose to multiply words about it," said Mr. Craven, with an
assumption of dignity. "If you had behaved well, you might have
stayed. Now you must go."
"Must I?" sniffed Katy, indignantly. "Must I, indade?"
"Yes, you must, and the less fuss you make about it the better."
Mr. Craven supposed that he had the decided advantage, and that
Katy, angry as she was, would eventually succumb to his authority.
But he did not know the independent spirit of Catherine O'Grady,
whose will was quite as resolute as his own.
"And ye think I'm goin' at your word—I that's been in the family
since Master Frank was a baby?"
"I am sorry for you, Katy," said Mr. Craven, in triumphant
magnanimity. "But I cannot permit a servant to remain in my house
who is guilty of the gross impropriety of insulting me."
"I know why you want to get rid of me," said Katy, nodding her head
vigorously.
"Why?" asked Craven, with some curiosity.
"You want to p'ison the dog."
Mr. Craven started. How had his secret leaked out?
"What do you mean?"
"Mane! I mane that I saw you lavin' the p'isoned mate for the dog
three days agone, and if it hadn't been for me he'd have eaten it,
and the poor creetur would be stiff in death."
"He did eat it. I saw him," said Mr. Craven, hastily.
"No, he didn't. It wasn't the same mate!" said Katy, triumphantly.
"What was it, then?"
"It was a piece I cut off and carried out to him," said Katy. "The
other I wrapped up in a piece of paper, and buried it in the field."
Mr. Craven's eyes were opened. Pompey's cast-iron constitution was
explained. After all, he was not that natural phenomenon which Mr.
Craven had supposed him to be. But he was angry at Katy's
interference no less.
"Say no more," he said. "You must go. You have no right to interfere
with my plans."
"Say no more? Won't I be tellin' the misthress and Master Frank how
you tried to kill the poor dog, first with p'ison, and nixt wid a pistol?"
There was something in this speech that made Mr. Craven hesitate
and reflect.
He knew that Katy's revelation would provoke Frank, and make him
an enemy, and he feared the boy's influence on his mother,
particularly as he was concocting plans for inducing his wife to place
some of her money in his hand under pretext of a new investment.
He must be careful not to court hostile influences, and after all, he
resolved to bear with Katy, much as he disliked her.
"On the whole, Katy," he said, after a pause, "I will accept your
apology, and you may stay."
"My apology!" said Katy, in astonishment.
"Yes, your explanation. I see your motives were good, and I will
think no more about it. You had better not mention this matter to
Mrs. Craven or Frank, as it might disturb them."
"And won't you try to kill Pomp agin?" asked Katy.
"No; I dislike dogs, especially as they are apt to run mad, but as
Frank is attached to Pompey, I won't interfere. You had better take
this tumbler and wash it, as it is uninjured."
"All right, sir," said Katy, who felt that she had gained a victory,
although Mr. Craven assumed that it was his.
"I am very glad you are so devoted to your mistress," said Mr.
Craven, who had assumed his old suavity. "I shall propose to her to
increase your wages."
"He's a mighty quare man!" thought the bewildered Katy, as she
hurried back to her work, followed by Pompey.
CHAPTER VIII.
FRANK IS OBSTINATE.
Mr. Craven had as yet gained nothing from his marriage. He was
itching to get possession of his wife's property. Then his next step
would be Frank's more considerable property. He was beginning to
be low in pocket, and in the course of a month or so Mr. Green's
note for six hundred dollars would fall due. He knew enough of that
estimable gentleman to decide that it must be met, and, of course,
out of his wife's money.
"My dear," he said one day, after breakfast, Frank being on his way
to school, "I believe I told you before our marriage that I had twenty
thousand dollars invested in Lake Superior mines."
"Yes, Mr. Craven, I remember it."
"It is a very profitable investment," continued her husband. "What
per cent. do you think it pays me?"
"Ten per cent.," guessed Mrs. Craven.
"More than that. During the last year it has paid me twenty per
cent."
"That is a great deal," said his wife, in surprise.
"To be sure it is, but not at all uncommon. You, I suppose, have not
got more than seven or eight per cent. for your money?"
"Only six per cent."
Mr. Craven laughed softly, as if to say, "What a simpleton you must
be!"
"I didn't know about these investments," said his wife. "I don't know
much about business."
"No, no. I suppose not. Few women do. Well, my dear, the best
thing you can do is to empower me to invest your money for you in
future."
"If you think it best," said Mrs. Craven.
"Certainly; it is my business to invest money. And, by the way, the
income of Frank's property is paid to you, I believe."
"Yes."
"He does not come into possession till twenty-one."
"That was his father's direction."
"And a very proper one. He intended that you should have the
benefit of the income, which is, of course, a good deal more than
Frank needs till he comes of age."
"I thought perhaps I ought to save up the surplus for Frank," said
Mrs. Craven, hesitating.
"That is not necessary. Frank is amply provided for. He might be
spoiled by too much money."
"I don't think so. Frank is an excellent boy," said his mother, warmly.
"So he is," said Mr. Craven. "He has a noble, generous disposition,
and for that very reason is more liable to be led astray."
"I hope he won't be led astray. I should feel wretched if I thought
anything would befall him," said his mother, shuddering.
"We will look after him; we will see that he goes straight," said Mr.
Craven, cheerfully. "But I wanted to suggest, my dear, that it would
be proper that I should be appointed joint guardian with you."
"I am not sure whether Frank will like it," said his mother, who was
aware that Frank, though scrupulously polite to his step-father, had
no cordial liking or respect for him.
"As to that, my dear, I count upon you exerting your influence in the
matter. If you recommend it he will yield."
"Don't you think it just as well as it is?" said Mrs. Craven,
hesitatingly. "Of course, we shall go to you for counsel and advice in
anything important."
"You don't seem to have confidence in me," said Mr. Craven, with an
injured air.
"I hope you won't think that, Mr. Craven," said his wife, hastily.
"How can I help it? You know my interest in Frank, yet you are
unwilling to have me associated in the guardianship."
"I didn't say I objected. I said Frank might."
"You are not willing to urge him to favor the measure."
"You misunderstand me. Yes, I will," said yielding Mrs. Craven.
"Thank you, my dear," said Mr. Craven, with one of his most
unctuous smiles. "I was quite sure you would do me justice in the
end. By the way, what disposition is made of Frank's property if he
does not live to come of age?"
"You—you don't think he is likely to be taken away?" said Mrs.
Craven, in distress.
"You are a goose," said her husband, laughing softly. "Of course not.
But then we are all mortal. Frank is strong, and will, I hope, live to
smooth our dying pillows. But, of course, however improbable, the
contingency is to be thought of."
"I believe the property comes to me in that case, but I am sure I
should not live to enjoy it."
"My dear, don't make yourself miserable about nothing. Our boy is
strong, and has every prospect of reaching old age. But it is best to
understand clearly how matters stand. By the way, you need not say
anything about the guardianship to him till I tell you."
Mrs. Craven not only complied with this request, but she
surrendered to Mr. Craven the entire control of her money within an
hour. She raised one or two timid objections, but these were
overruled by her husband, and in the end she yielded. Mr. Craven
was now in funds to pay the note held by Job Green, and this
afforded him no little relief.
A few evenings later, Frank was about to take his cap and go out,
when Mr. Craven stopped him.
"Frank," he said, "if you have no important engagement, your
mother and I desire to speak to you on a matter of some
consequence."
"I was only going to call on one of my friends," said Frank. "I will
defer that and hear what you have to say."
"Thank you," said Mr. Craven, smiling sweetly. "I wished to speak to
you on the subject of your property."
"Very well, sir."
"Your mother is your guardian, she tells me."
"Yes, sir."
"The responsibilities of a guardian are very great," proceeded Mr.
Craven, leaning back upon his chair. "Naturally there are some of
them to which a woman cannot attend as well as a man."
Frank began to understand what was coming, and, as it was not to
his taste, he determined to declare himself at once.
"I couldn't have a better guardian than my mother," he said.
"Of course not. (I am afraid I shall find trouble with him, thought Mr.
Craven.) Of course not. You couldn't possibly find any one as much
interested in your welfare as your mother."
"Certainly not, sir."
"As your step-father, I naturally feel a strong interest in you, but I do
not pretend to have the same interest as your mother."
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade
Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.
ebooknice.com