100% found this document useful (4 votes)
14 views

Foundation Db2 and Python: Access Db2 with Module-Based API Examples Using Python 1st Edition W. David Ashley 2024 Scribd Download

Access

Uploaded by

ossytrapos
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (4 votes)
14 views

Foundation Db2 and Python: Access Db2 with Module-Based API Examples Using Python 1st Edition W. David Ashley 2024 Scribd Download

Access

Uploaded by

ossytrapos
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 40

Get ebook downloads in full at ebookmeta.

com

Foundation Db2 and Python: Access Db2 with Module-


Based API Examples Using Python 1st Edition W.
David Ashley

https://ebookmeta.com/product/foundation-db2-and-python-
access-db2-with-module-based-api-examples-using-python-1st-
edition-w-david-ashley-2/

OR CLICK BUTTON

DOWNLOAD NOW

Explore and download more ebook at https://ebookmeta.com


Recommended digital products (PDF, EPUB, MOBI) that
you can download immediately if you are interested.

Foundation Db2 and Python: Access Db2 with Module-Based


API Examples Using Python 1st Edition W. David Ashley

https://ebookmeta.com/product/foundation-db2-and-python-access-
db2-with-module-based-api-examples-using-python-1st-edition-w-david-
ashley-2/
ebookmeta.com

Practical Explainable AI Using Python: Artificial


Intelligence Model Explanations Using Python-based
Libraries, Extensions, and Frameworks Pradeepta Mishra
https://ebookmeta.com/product/practical-explainable-ai-using-python-
artificial-intelligence-model-explanations-using-python-based-
libraries-extensions-and-frameworks-pradeepta-mishra/
ebookmeta.com

Learn OpenCV with Python by Examples 2nd Edition James


Chen

https://ebookmeta.com/product/learn-opencv-with-python-by-
examples-2nd-edition-james-chen/

ebookmeta.com

The Palgrave Schopenhauer Handbook Palgrave Handbooks in


German Idealism 1st Edition Sandra Shapshay

https://ebookmeta.com/product/the-palgrave-schopenhauer-handbook-
palgrave-handbooks-in-german-idealism-1st-edition-sandra-shapshay/

ebookmeta.com
Implantology Step by Step 1st Edition Christoph T
Sliwowski

https://ebookmeta.com/product/implantology-step-by-step-1st-edition-
christoph-t-sliwowski/

ebookmeta.com

Supply Network 5.0: How to Improve Human Automation in the


Supply Chain 1st Edition Bernardo Nicoletti

https://ebookmeta.com/product/supply-network-5-0-how-to-improve-human-
automation-in-the-supply-chain-1st-edition-bernardo-nicoletti/

ebookmeta.com

Historical Modernisms Time History and Modernist


Aesthetics 1st Edition Jean-Michel Rabaté

https://ebookmeta.com/product/historical-modernisms-time-history-and-
modernist-aesthetics-1st-edition-jean-michel-rabate/

ebookmeta.com

NFPA 409 : Standard on Aircraft Hangars , 2022 Edition


National Fire Protection Association

https://ebookmeta.com/product/nfpa-409-standard-on-aircraft-
hangars-2022-edition-national-fire-protection-association/

ebookmeta.com

Deployable Multimodal Machine Intelligence: Applications


in Biomedical Engineering 1st Edition Hongliang Ren

https://ebookmeta.com/product/deployable-multimodal-machine-
intelligence-applications-in-biomedical-engineering-1st-edition-
hongliang-ren/
ebookmeta.com
Essentials of Pharmacology for Nurses Barber

https://ebookmeta.com/product/essentials-of-pharmacology-for-nurses-
barber/

ebookmeta.com
W. David Ashley

Foundation Db2 and Python


Access Db2 with Module-Based API Examples Using
Python
1st ed.
W. David Ashley
Austin, TX, USA

ISBN 978-1-4842-6941-1 e-ISBN 978-1-4842-6942-8


https://doi.org/10.1007/978-1-4842-6942-8

© W. David Ashley 2021

Apress Standard

The use of general descriptive names, registered names, trademarks,


service marks, etc. in this publication does not imply, even in the
absence of a specific statement, that such names are exempt from the
relevant protective laws and regulations and therefore free for general
use.

The publisher, the authors and the editors are safe to assume that the
advice and information in this book are believed to be true and accurate
at the date of publication. Neither the publisher nor the authors or the
editors give a warranty, expressed or implied, with respect to the
material contained herein or for any errors or omissions that may have
been made. The publisher remains neutral with regard to jurisdictional
claims in published maps and institutional affiliations.

This Apress imprint is published by the registered company APress


Media, LLC part of Springer Nature.
The registered company address is: 1 New York Plaza, New York, NY
10004, U.S.A.
This book is dedicated to teachers everywhere, but especially all those
who had me as a student.
Table of Contents
Chapter 1:​Introduction to Db2
What Is a Relational Database?​
The Relational Model
Domains
Keys and Indexes
Relationships
Transactions
Stored Procedures
Constraints
Normalization
SQL
Data Definition Language (DDL)
Data Query Language (DQL)
Data Control Language (DCL)
Data Manipulation Language (DML)
The ibm_​db Project
Summary
Chapter 2:​Installing Db2
My Development Environment
Installation Prerequisites
Planning the Db2 Install
Installing Db2
Db2 Post-install Tasks
Installing the Db2 Sample Database
Summary
Chapter 3:​Db2 Management
Db2 Instances
db2ilist
Instance Environment Commands
Creating an Instance
Arranging a Communication Port and Host for an Instance
Updating an Instance
Upgrading an Instance
Dropping an Instance
Using Other Commands with an Instance
Databases
Db2 Catalog Views
Locking Event Monitor
Tablespace Information
Storage Group Control Files
Global Configuration File
History Files
Logging Files
Automated Storage Containers
Creating a Database
Listing Databases
Activating a Database
Deactivating a Database
Connecting to a Database
Dropping a Database
Tables
Table Types
Built-in Data Types
Creating a Table
Alter a Table
Other Table SQL Statements
Dropping a Table
Summary
Chapter 4:​Database Physical Design
Phase 1:​Data Gathering and Normalization
Data Gathering
Data Normalization
Business Rules
Phase 2:​Physical Design of the Database
Backups
Summary
Chapter 5:​Db2 Utilities
Backup Command
What Is a Backup?​
Backup Verification
Advanced Backup Options
Backup Syntax
Export Command
Command syntax
Usage Notes
Import Command
Command Syntax
Load Command
Command Syntax
Restore Command
Command Syntax
Summary
Chapter 6:​Business Rules and Constraints
NOT NULL Attribute
Primary Key
Indexes
Foreign Keys
CHECK and Unique Constraints
DEFAULT Constraint
Triggers
Summary
Chapter 7:​Writing Good SQL for Db2
Relational Theory
Reduce Passes Through Data
Using Indexes to Increase Performance
Sorting and Grouping
Programs Containing SQL
Use Db2 Utilities Where Possible
Db2 Functions
Multiple Ways to Code SQL
Summary
Chapter 8:​Python and ibm_​db
Your First Python ibm_​db Program
Using Parameter Markers
More on Parameter Markers
Producing Multiple Reports with Parameter Markers
Using Parameter Markers Without Binding Variables
Joining Tables
Inserts, Updates, and Deletes
Some Other ibm_​db APIs
Creating Database Objects
Obtaining Attributes of an Existing Table
Obtaining Attributes of a Result Set
ibm_​db_​dbi and Python
Where Is the ibm_​db Module Going?​
The ibm_​db_​dbi Module
The Django Database Interface
The SQLAlchemy Adapter
The Alembic Adapter
The Future
Summary
Appendix A:​Python ibm_​db API
ibm_​db APIs
ibm_​db.​active
ibm_​db.​autocommit
ibm_​db.​bind_​param
ibm_​db.​callproc
ibm_​db.​client_​info
ibm_​db.​close
ibm_​db.​column_​privileges
ibm_​db.​columns
ibm_​db.​commit
ibm_​db.​conn_​error
ibm_​db.​conn_​errormsg
ibm_​db.​connect
ibm_​db.​createdb
ibm_​db.​createdbNX
ibm_​db.​cursor_​type
ibm_​db.​dropdb
ibm_​db.​exec_​immediate
ibm_​db.​execute
ibm_​db.​execute_​many
ibm_​db.​fetch_​tuple
ibm_​db.​fetch_​assoc
ibm_​db.​fetch_​both
ibm_​db.​fetch_​row
ibm_​db.​field_​display_​size
ibm_​db.​field_​name
ibm_​db.​field_​num
ibm_​db.​field_​precision
ibm_​db.​field_​scale
ibm_​db.​field_​type
ibm_​db.​field_​width
ibm_​db.​foreign_​keys
ibm_​db.​free_​result
ibm_​db.​free_​stmt
ibm_​db.​get_​option
ibm_​db.​next_​result
ibm_​db.​num_​fields
ibm_​db.​num_​rows
ibm_​db.​pconnect
ibm_​db.​prepare
ibm_​db.​primary_​keys
ibm_​db.​procedure_​columns
ibm_​db.​procedures
ibm_​db.​recreatedb
ibm_​db.​result
ibm_​db.​rollback
bm_​db.​server_​info
ibm_​db.​set_​option
ibm_​db.​special_​columns
ibm_​db.​statistics
ibm_​db.​stmt_​error
ibm_​db.​stmt_​errormsg
ibm_​db.​table_​privileges
ibm_​db.​tables
Summary
Index
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.
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.
© The Author(s), under exclusive license to APress Media, LLC, part of Springer
Nature 2021
W. D. Ashley, Foundation Db2 and Python
https://doi.org/10.1007/978-1-4842-6942-8_1

1. Introduction to Db2
W. David Ashley1
(1) Austin, TX, USA

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.
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:
Db2 (formerly DB2 LUW)
Db2 for z/OS (formerly DB2 for z/OS)
Db2 Hosted (formerly DB2 on Cloud)
Db2 on Cloud (formerly dashDB for Transactions)
Db2 Event Store (a new in-memory database for event-driven
transaction processing)
Db2 Warehouse on Cloud (formerly dashDB)
Db2 Warehouse (formerly dashDB Local)
IBM Integrated Analytics System (a new system platform that
combines analytic performance and functionality of the IBM
PureData System with IBM Netezza)
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
Random documents with unrelated
content Scribd suggests to you:
CHAPTER VI
THE MARITIME PROVINCES

I have come into Canada through the Maritime Provinces, which


lie on the Atlantic Coast between our own state of Maine and the
mouth of the St. Lawrence. The Provinces are Nova Scotia, New
Brunswick, and Prince Edward Island. Their area is almost equal to
that of our six New England states, and in climate and scenery they
are much the same. Their population, however, is only about one
million, or little more than one fourth as many as the number of
people living in Massachusetts. These provinces were the first British
possessions in Canada, and like New England they have seen the
centre of population and progress move ever westward.
Nova Scotia is the easternmost province of the Dominion of
Canada. Its capital and chief city is Halifax, situated on the Atlantic
on one of the world’s best natural harbours. This is a deep water
inlet ten miles in length, which is open all the year round. Montreal
and Quebec are closed to navigation during the winter months on
account of the freezing of the St. Lawrence.
Halifax is six hundred miles closer to Europe than is New York,
and nearer Rio de Janeiro than is New Orleans. As the eastern
terminus of the Canadian National Railways, it has direct
connections with all Canada. With these advantages, the city hopes
to become one of the great shipping centres on the North Atlantic.
Halifax has long been noted as the most English city in Canada.
It was once the military, naval, and political centre of British North
America, and gay with the social life of British officers and their
ladies. Now, both the warships and the soldiers are gone, and the
city is devoting itself to commercial activities.
As we steamed past the lighthouses and the hidden guns on the
headlands guarding the entrance, I was reminded of all that this
harbour has meant to America. The city was founded by Lord
Cornwallis in 1749 at the suggestion of Boston merchants who
complained that the French were using these waters as a base for
their sea raiders. Less than thirty years later it provided a haven for
Lord Howe when he was driven out of Boston by our soldiers of the
Revolution, and became the headquarters for the British operations
against the struggling colonies. In the war of 1812, the American
warship Chesapeake was brought here after her defeat by the British
frigate Shannon. During our Civil War Halifax served as a base for
blockade runners, and the fortunes of some of its wealthy citizens of
to-day were founded on the profits of this dangerous trade. No one
dreamed then that within two generations England and America
would be fighting side by side in a World War, that thousands of
United States soldiers would sail from Halifax for the battlefields of
Europe, or that an American admiral, commanding a fleet of
destroyers, would establish his headquarters here. Yet that is what
happened in 1917–18. All that now remains of the former duels on
the sea is the annual sailing race between the fastest schooners of
the Gloucester and the Nova Scotia fishing fleets.
Halifax is built on a hillside that rises steeply from the water-front
to a height of two hundred and sixty feet above the harbour. The city
extends about halfway up the hill, and reaches around on both sides
of it. The top is a bare, grassy mound, surmounted by an ancient
citadel.
Stand with me on the edge of the old moat, and look down upon
Halifax and its harbour. Far to our left is the anchorage where
occurred one of the greatest explosions the world ever knew. Just as
the city was eating breakfast on the morning of December 6, 1917, a
French munitions ship, loaded with benzol and TNT, collided with
another vessel leaving the harbour, and her cargo of explosives blew
up in a mighty blast. Nearly two thousand people were killed, six
thousand were injured, and eleven thousand were made homeless.
Hardly a pane of glass was left in a window, and acres of houses
were levelled to the ground. A deck gun was found three miles from
the water, and the anchor of one of the vessels lies in the woods six
miles away, where it was thrown by the explosion. A street-car
conductor was blown through a second-story window, and a sailor
hurled from his ship far up the hillside. Since then much of the
devastated area has been rebuilt along approved town-planning
lines, but the scars of the disaster are still visible. For a long time
after the explosion, the local institution for the blind was filled to
capacity, and one saw on the streets many persons wearing patches
over one eye.
Standing on the hill across the harbour one sees the town of
Dartmouth, where much of the industrial activity of the Halifax district
is centred. There are the largest oil works, chocolate factories, and
sugar refineries of Canada. Vessels from Mexico, South America,
and the British West Indies land their cargoes of tropical products at
the doors of the works. Fringing the water-front are the masts of
sailing vessels and the smokestacks of steamers. Among the latter is
a cable repair ship, just in from mending a break in one of the many
submarine telegraph lines that land on this coast. Next to her is a
giant new liner, making her first stop here to add to her cargo some
twenty-five thousand barrels of apples from the Annapolis Valley.
This valley, on the western side of Nova Scotia, is known also as
“Evangeline Land.” It was made famous by Longfellow’s poem based
on the expulsion of the French Acadians by the English because
they insisted on being neutral in the French-British wars. It is one of
the finest apple-growing districts in the world, and sends annually to
Europe nearly two million barrels. Many descendants of the former
French inhabitants have now returned to the land of their ancestors.
Looking toward the mouth of the harbour, we see the new
terminal, a twenty-five million dollar project that has for some years
stood half completed. Here are miles and miles of railroad tracks,
and giant piers equipped with modern machinery, a part of the
investment the Dominion and its government-owned railway system
have made to establish Halifax as a first-class port. Beyond the port
works another inlet, Northwest Arm, makes its way in between the
hills. I have motored out to its wooded shores, which in summer time
are crowded with the young people of Halifax, bathing and boating. It
is the city’s chief playground and a beautiful spot.
But now take a look at the city itself, stretching along the water-
front below where we stand. The big red brick building just under our
feet is the municipal market. There, on Saturdays, one may see an
occasional Indian, survivor of the ancient Micmacs, and Negroes
who are descendants of slaves captured by the British in Maryland
when they sailed up the Potomac and burned our Capitol. Farther
down the hillside are the business buildings of the city, none of them
more than five stories high, and all somewhat weatherbeaten. I have
seen no new construction under way in downtown Halifax; the city
seems to have missed the building booms of recent years. Most of
the older houses are of stone or brick. Outside the business district
the people live in wooden frame houses, each with its bit of yard
around it. One would know Halifax for an English town by its
chimney pots. Some of the houses have batteries of six or eight of
these tiles set on end sticking out of their chimneys.
The streets are built on terraces cut in the hillside, or plunging
down toward the water. Some of them are so narrow that they have
room for only a single trolley track, on which are operated little one-
man cars. I stepped for a moment into St. Paul’s Church, the first
English house of worship in Canada. Its front pew, to the left of the
centre aisle, is reserved for the use of royal visitors. Passing one of
the local newspaper offices, I noticed a big crowd that filled the
street, watching an electric score board that registered, play by play,
a World Series baseball game going on in New York. The papers are
full of baseball talk, and the people of this Canadian province seem
to follow the game as enthusiastically as our fans at home.
My nose will long remember Halifax. In lower Hollis Street, just
back from the water-front, and not far from the low gray stone
buildings that once quartered British officers, I smelled a most
delicious aroma. It was from a group of importing houses, where
cinnamon, cloves, and all the products of the East Indies are ground
up and packed for the market. If I were His Worship, the Mayor of
Halifax, I should propose that Hollis street be renamed and called
the Street of the Spices. Just below this sweet-scented district, I
came to a tiny brick building, with a sign in faded letters reading “S.
Cunard & Co., Coal Merchants.” This firm is the corporate lineal
descendant of Samuel Cunard, who, with his partners, established
the first transatlantic steamship service nearly a century ago, and
whose name is now carried all over the world by some of the
greatest liners afloat.
Another odour of the water-front is not so sweet as the spices. It
is the smell of salt fish, which here are dried on frames built on the
roofs near the docks. Nova Scotia is second only to Newfoundland in
her exports of dried cod, and all her fisheries combined earn more
than twelve million dollars a year. They include cod, haddock,
mackerel, herring, halibut, pollock, and salmon. Lunenburg, down
the coast toward Boston, is one of the centres of the deep-sea
fishing industry, and its schooners compete on the Grand Banks with
those from Newfoundland, Gloucester, and Portugal.
I talked in Halifax with the manager of a million-dollar corporation
that deals in fresh fish. He was a Gloucester man who, as he put it,
“has had fish scales on his boots” ever since he could remember.
“We operate from Canso, the easternmost tip of Nova Scotia,” he
said. “Our steamers make weekly trips to the fishing grounds, where
they take the fish with nets. They are equipped with wireless, and we
direct their operations from shore in accordance with market
conditions. While the price of salt fish is fairly steady, fresh fish
fluctuates from day to day, depending on the quantities caught and
the public taste. Such fish as we cannot sell immediately, we cure in
our smoking and drying plants.
“All our crews share in the proceeds of their catch, and the
captains get no fixed wages at all. We could neither catch the fish
nor sell them at a profit without the fullest coöperation on the part of
our men, most of whom come from across the Atlantic, from
Denmark, Norway, and Sweden, and also from Iceland. Next to the
captain, the most important man on our ships is the cook. Few fish
are caught unless the fishermen are well fed. The ‘cook’s locker’ is
always full of pies, cakes, and cookies, to which the men help
themselves, and the coffee-pot must be kept hot for all hands to
‘mug up.’”
From Halifax I crossed Nova Scotia by rail into the adjoining
province of New Brunswick. Nova Scotia is a peninsula that seems
to have been tacked on to the east coast of Canada. It is three
hundred and seventy-four miles long, and so narrow that no point in
it is more than thirty miles from the sea. The coast does not run due
north and south, but more east and west, so that its southernmost tip
points toward Boston. The Bay of Fundy separates it from the coasts
of Maine and New Brunswick, and leaves only an isthmus, in places
not more than twenty miles wide, connecting Nova Scotia with the
mainland. The lower or westernmost half of the province is encircled
with railroads, which carry every year increasing thousands of
tourists and hunters from the United States. The summer
vacationists and the artists go chiefly to the picturesque shore towns,
while those who come up for hunting and fishing strike inland to the
lakes and woods. Deer and moose are still so plentiful in Nova
Scotia that their meat is served at Halifax hotels during the season.
The scenery is much like that of Maine. Rolling hills alternate
with ledges of gray rock, while at every few miles there are lakes and
ponds. Much of the country is covered with spruce, and many of the
farms have hedges and tall windbreaks of those trees. The
farmhouses are large and well built; they are usually situated on high
ground and surrounded by sloping fields and pastures considerably
larger than the farm lots of New England. In some places the broad
hills are shaped like the sand dunes of Cape Cod. At nearly every
station freshly cut lumber was piled up, awaiting shipment, while one
of the little rivers our train crossed was filled with birch logs floating
down to a spool factory.
Some two hours from Halifax we came to Truro at the head of
Cobequid Bay, the easternmost arm of the Bay of Fundy. Scientists
who have studied the forty-foot Fundy tides attribute them to its
pocket-like shape. The tides are highest in the numerous deep inlets
at the head of the Bay. In the Petitcodiac River, which forms the
northernmost arm, as the tide comes in a wall of water two or three
feet high rushes upstream. These tides are felt far back from the
coast. The rivers and streams have deep-cut banks on account of
the daily inrush and outflow of waters and are bordered with
marshes through which run irrigation ditches dug by the farmers.

With his poem of Evangeline, Longfellow made


famous the old well at Grand Pré, the scene of the
expulsion of the Acadians because they wanted to
remain neutral in the French-British wars.
When the tide goes out at Digby, vessels tied to
the docks are left high and dry. At some points on the
Bay of Fundy the rise and fall of the water exceeds
forty feet.
Truro is a turning-off point for the rail journey down the Bay side
of Nova Scotia through “Evangeline Land” and the Annapolis Valley,
and also for the trip north and east up to Cape Breton Island. This
island is part of the province of Nova Scotia. It is separated from the
mainland only by the mile-wide Strait of Canso, across which railroad
trains are carried on ferries. In the southern part of the Island is the
Bras d’Or Lake, an inland sea covering two hundred and forty square
miles.
Because of the deep snows in winter the Quebec
farmhouse usually has high porches and often a
bridge from the rear leading to the upper floor of the
barn. The older houses are built of stone.
Spinning wheels and hand looms are still in use
among the French Canadian farm women. Besides
supplying clothes for their families, they make also
homespuns and rugs for sale.
Though Cabot landed on the coast of Cape Breton Island after
his discovery of the Newfoundland shore, it later fell into the hands of
the French. They found its fisheries worth more than all the gold of
Peru or Mexico. To protect the sea route to their St. Lawrence
territories, they built at Louisburg a great fortress that cost a sum
equal to twenty-five million dollars in our money. To-day, hardly one
stone remains upon another, as the works were destroyed by the
British in 1758. Not far from Louisburg is Glace Bay, where Marconi
continued the wireless experiments begun in Newfoundland, and it
was on this coast, also, that the first transatlantic cable was landed.
Cape Breton Island was settled mostly by Scotch, and even to-
day sermons in the churches are often delivered in Gaelic. As a
result of intermarriage sometimes half the people of a village bear
the same family name. For generations these people lived mostly by
fishing, but the opening of coal mines in the Sydney district brought
many of them into that industry. The Sydney mines, which normally
employ about ten thousand men, are the only coal deposits on the
continent of North America lying directly on the Atlantic Coast. They
are an asset of immense value to Canada, yielding more than one
third of her total coal production. One of the mines at North Sydney
has the largest coal shaft in the world. Because of these enormous
deposits of bituminous coal, and the presence near by of dolomite,
or limestone, steel industries have been developed in the Sydney
district. Ownership of most of the coal and steel properties has been
merged in the British Empire Steel Corporation, one of the largest
single industrial enterprises in all Canada. It is this corporation, you
will remember, that owns the Wabana iron mines in Newfoundland.
In the Gulf of St. Lawrence, and north of the isthmus connecting
Nova Scotia with the mainland, is Prince Edward Island, the
smallest, but proportionately the richest province in the Dominion of
Canada. It is not quite twice the size of Rhode Island, and has less
than one hundred thousand people, but every acre of its land is
tillable and most of it is cultivated. The island is sometimes called the
“Garden of the Gulf.”
Prince Edward Island is a favourite resort of Americans on
vacation. It leaped into fame as the scene of the first successful
experiments in raising foxes for their furs, and now has more than
half of the fox farms in Canada. The business of selling fox skins and
breeding stock is worth nearly two million dollars a year to the Prince
Edward Islanders. The greatest profits are from the sales of fine
breeding animals.
Most of the west shore of the Bay of Fundy and many of its
northern reaches are in the third and westernmost of the three
Maritime Provinces. This is the province of New Brunswick. It is
Maine’s next-door neighbour, and almost as large, but it has less
than half as many people. The wealth of New Brunswick, like that of
Maine, comes chiefly from the farms, the fisheries, and the great
forests that are fast being converted into lumber and paper. Its game
and fresh-water fishing attract a great many sportsmen from both the
United States and Canada.
St. John, the chief city of New Brunswick at the mouth of the St.
John River, used to be a centre of anti-American sentiment in
Canada. This was because the city was founded by the Tories, who
left the United States after we won our independence. St. John to-
day is a busy commercial centre competing with Halifax for first
place as Canada’s all-year Atlantic port. It is the eastern terminal of
the Canadian Pacific Railroad, whose transatlantic liners use the port
during the winter. It enjoys the advantage over Halifax of being some
two hundred miles nearer Montreal, but, like Halifax, suffers on
account of the long railway haul and high freight rates to central
Canada. As a matter of fact, New England, and not Canada, is the
natural market for the Maritime Provinces, and every few years the
proposal that this part of Canada form a separate Dominion comes
up for discussion. Such talk is not taken seriously by the well
informed, but it provides a good safety valve for local irritation.
CHAPTER VII
IN FRENCH CANADA

Come with me for a ride about Quebec, the oldest city in


Canada, the ancient capital of France in America, and a stronghold
of the Catholic Church. We go from the water-front through the
Lower Town, up the heights, and out to where the modern city eats
into the countryside. The Lower Town is largely French. The main
part of the Upper Town used to be enclosed by walls and stone
gates, parts of which are still standing. The dull gray buildings are of
stone, with only shelf-like sidewalks between them and the street.
Most of the streets are narrow. The heights are ascended by stairs,
by a winding street, and in one place by an elevator. The old French
caleche, a two-wheeled vehicle between a jinrikisha and a dog-cart,
has been largely displaced by motor-cars, which can climb the steep
grades in a jiffy. Even the ancient buildings are giving way to modern
necessities, and every year some are torn down.
As a city, Quebec is unique on this continent. It fairly drips with
“atmosphere,” and is concentrated romance and history. You know
the story, of course, of how Champlain founded it in 1608, on a
narrow shelf of land under the rocky bluff that rises nearly three
hundred and fifty feet above the St. Lawrence. Here brave French
noblemen and priests started what they hoped would be a new
empire for France. Between explorations, fights with the Indians, and
frequent British attacks, they lived an exciting life. Finally, General
Wolfe in 1759 succeeded in capturing for the British this Gibraltar of
the New World. Landing his men by night, at dawn he was in position
on the Plains of Abraham behind the fort. In the fight that followed
Wolfe was killed, Montcalm, the French commander, was mortally
wounded, and the city passed into the hands of the English. If
General Montgomery and Benedict Arnold had succeeded in their
attack on Quebec on New Year’s Eve, sixteen years later, the history
of all Canada would have been different, and the United States flag
might be flying over the city to-day.
The British built in the rock on top of the bluff a great fort and
citadel covering about forty acres. It still bristles with cannon, but
most of them are harmless compared with modern big guns. The
works serve chiefly as a show place for visitors, and a summer
residence for dukes and lords sent out to be governors-general of
Canada. The fortification is like a mediæval castle, with subterranean
chambers and passages, and cannon balls heaped around the
battlements. Below the old gun embrasures is a broad terrace, a
quarter of a mile long. This furnishes the people of Quebec a
beautiful promenade that overlooks the harbour and commands a
fine view of Levis and the numerous villages on the other shore.
The Parliament building stands a little beyond the entrance to
the citadel. As we go on the architecture reflects the transition from
French to British domination. The houses begin to move back from
the sidewalk, and to take on front porches. I saw workmen putting in
double windows, in preparation for winter, and noticed that the sides
of many of the brick houses are clapboarded to keep the frost out of
the mortar. Still farther out apartments appear, while a little beyond
are all the marks of a suburban real estate boom. Most of the “for
sale” signs are in both French and English.
Now come with me and look at another Quebec, of which you
probably have never heard. The city is built, as you know, where the
St. Charles River flows into the St. Lawrence. The valley of the St.
Charles has become a great hive of industry, and contains the
homes of thousands of French workers. Looking down upon it from
the ancient Martello Tower on the heights of the Upper Town, we see
a wilderness of factory walls, church spires, and the roofs of homes.
Beyond them great fields slope upward, finally losing themselves in
the wooded foothills of the Laurentian Mountains. Cotton goods,
boots and shoes, tobacco, and clothing are manufactured here. It
was from this valley that workers for the textile and shoe industries of
New England were recruited by thousands. A few miles upstream is
the village of Indian Lorette, where descendants of a Huron tribe,
Christianized by the French centuries ago, make leather moccasins
for lumberjacks and slippers for American souvenir buyers. A big fur
company also has a fox farm near Indian Lorette.
Quebec was once the chief port of Canada, but when the river
was dredged up to Montreal it fell far behind. All but the largest
transatlantic liners can now sail for Europe from Montreal, though
they make Quebec a port of call. Quebec is five hundred miles
nearer Liverpool than is New York, and passengers using this route
have two days less in the open sea. The navigation season is about
eight months. The port has rail connections with all Canada and the
United States. Above the city is the world’s longest cantilever bridge,
on which trains cross the river. After two failures the great central
span, six hundred and forty feet long, was raised from floating
barges and put into place one hundred and fifty feet above the water.
In the English atmosphere of the Maritime Provinces I felt quite
at home, but here I seem to be in a foreign land, and time has been
pushed back a century or so. We think of Canada as British, and
assume that English is the national language. But in Quebec, its
largest province, containing about one fifth of the total area, nearly
nine tenths of the people are French and speak the French
language. They number almost one fourth of the population of the
Dominion.
Quebec is larger than Texas, New Mexico, Arizona, and
California combined; it is nearly as big as all our states east of the
Mississippi River put together. Covering an area of seven hundred
thousand square miles, it reaches from the northern borders of New
York and New England to the Arctic Ocean; from the Gulf of St.
Lawrence and Labrador westward to Hudson Bay and the Ottawa
River. Most Americans see that part of Quebec along the St.
Lawrence between the capital and Montreal, but only one fourteenth
of the total area of the province lies south of the river. The St.
Lawrence is more than nineteen hundred miles long, and Quebec
extends along its north bank for almost the entire distance.
Jacques Cartier sailed up the St. Lawrence in 1535 and claimed
possession of the new land in the name of “Christ and France.”
Later, French soldiers and priests pushed their way up the river,
explored the Great Lakes, and went down the Mississippi. It was
French fur traders, fishermen, and farmers who opened up and
populated eastern Canada. With no immigration from France since
British rule began, the population of the province of Quebec has had
a natural increase from about sixty thousand to more than two
millions. The average family numbers from six to eight persons,
while families of twelve and fourteen children are common. Quebec
maintains the highest birth rate of any province in Canada. It has
also the highest death rate, but there is a large net gain every year.
Quebec is one of the chief reservoirs of Canada’s natural wealth.
It leads all other provinces in its production of pulpwood, and
contributes more than one half the Dominion’s output of pulp and
paper. It is second only to British Columbia and Ontario in lumber
production, while its northern reaches contain the last storehouse of
natural furs left on our continent.
Canada is one of the world’s great sources of water-power.
Nearly half of that already developed is in the province of Quebec,
and her falling waters are now yielding more than a million horse-
power. Tens of thousands of additional units are being put to work
every year, while some five million horse-power are in reserve. It
would take eight million tons of coal a year to supply as much power
as Quebec now gets from water.
The ancient citadel on the heights of Quebec is
now dwarfed by a giant castle-like hotel that helps
make the American Gibraltar a tourist resort. Its
windows command a magnificent view of the St.
Lawrence.
The St. Louis gate commemorates the days when
Quebec was a walled city and always well garrisoned
with troops. Just beyond is the building of the
provincial parliament, where most of the speeches are
in French.
At Three Rivers, about halfway between Montreal and Quebec,
the St. Maurice River empties into the St. Lawrence. Twenty miles
upstream are the Shawinigan Falls, the chief source of power of the
Shawinigan Company, which, with its subsidiaries, is now producing
in this district more than five hundred thousand horse-power. This is
nearly half the total power development in the province. Around the
power plant there have grown up electro-chemical industries that
support a town of twelve thousand people, while at Three Rivers
more paper is made than anywhere else in the world. Shawinigan
power runs the lighting plants and factories of Montreal and Quebec,
and also serves most of the towns south of the St. Lawrence. The
current is carried over the river in a thick cable, nearly a mile long,
suspended on high towers.
In the Thetford district of southern Quebec, power from
Shawinigan operates the machinery of the asbestos mines. Fifty
years ago, when these deposits were discovered, there was almost
no market for asbestos at ten dollars a ton. Nowadays, with its use in
theatre curtains, automobile brake linings, and coatings for furnaces
and steam pipes, the best grades bring two thousand dollars a ton,
and two hundred thousand tons are produced in a year. Quebec now
furnishes eighty-eight per cent. of the world’s annual supply of this
mineral.
The Quebec government controls all power sites, and leases
them to private interests for ninety-nine year terms. The province has
spent large sums in conserving its water-power resources. At the
headquarters of the St. Maurice River, it built the Gouin reservoir,
which floods an area of more than three hundred square miles, and
stores more water than the great Aswan Dam on the Nile.
Quebec is the third province in value of agricultural production.
What I have seen of its farms convinces me that the French
Canadian on the land is a conspicuous success. For a half day I
rode along the south shore of the St. Lawrence River through a
country like one great farm. Nearly every foot of it is occupied by
French farmers. Most of the time we were on high ground,
overlooking the river, which, where we first saw it, was forty miles
wide. It grew constantly narrower, until, where we crossed it on a
ferry to Quebec, its width was less than a mile. All the way we had
splendid views of the Laurentian Mountains, looming up on the north
shore of the river. Geologists say the Laurentians are the oldest rock
formation on our continent. They are not high, the peaks averaging
about sixteen hundred feet elevation, but they are one of the great
fish and game preserves of the world and are sprinkled with hunting
and fishing clubs.
In accordance with French law the Quebec farms have been
divided and sub-divided among so many succeeding generations
that the land is cut into narrow ribbons. Contrary to the custom in
France, however, every field is fenced in with rails. I am sure that the
fences I saw, if joined together, would easily reach from Quebec to
Washington and back. They did not zig-zag across the fields like
ours, thereby wasting both rails and land, but extended in a straight
line, up hill and down, sometimes for as much as a mile or more.
The standard French farm along the St. Lawrence used to be
“three acres wide and thirty acres long,” with a wood lot at the farther
end, and the house in the middle. As the river was the chief highway
of the country, it was essential that every farmer have water
frontage. With each division one or more new houses would be built,
and always in the middle of the strip. The result is that every farmer
has a near neighbour on each side of him, and the farmhouses form
an almost continuous settlement along the highway, much like the
homes on a suburban street. Each wood lot usually includes several
hundred maple trees, and the annual production of maple sugar and
syrup in Quebec is worth several hundred thousand dollars. The
maple leaf is the national emblem of Canada.
The houses are large and well built. They have narrow porches,
high above the ground, reached by steps from below. This
construction enables the occupants to gain access to their living
rooms in winter without so much snow shovelling as would otherwise
be necessary. For the same reason, most of the barns are entered
by inclines leading up to the second floor and some are connected
with the houses by bridges. The older houses are of stone, coated
with whitewashed cement. With their dormer windows and big,
square chimneys they look comfortable.

You might also like