Apache Derby -- Off to the Races: Includes Details of IBM Cloudscape
暫譯: Apache Derby -- 開始競賽:包含 IBM Cloudscape 的詳細資訊

Paul C. Zikopoulos, George Baklarz, Dan Scott

  • 出版商: IBM Press
  • 出版日期: 2005-10-27
  • 售價: $1,930
  • 貴賓價: 9.5$1,834
  • 語言: 英文
  • 頁數: 600
  • 裝訂: Hardcover
  • ISBN: 0131855255
  • ISBN-13: 9780131855250
  • 已絕版

買這商品的人也買了...

商品描述

Description

  • Learn installation, configuration, management, and security

  • Delve deeper with coverage on SQL, troubleshooting, application development, and more

Master Apache Derby: the only open source, pure Java™, fully transactional, small-footprint RDBMS

Apache Derby is the world's only enterprise class open source, pure Java, fully transactional relational database. It's small enough to be embedded directly into your Java applications, providing a local data store that requires no DBA support. Powerful enough to support a wide range of traditional applications, this database ships as the default database for WebSphere Application Server and more than fifty other IBM software products. Apache Derby is built on the mature IBM Cloudscape code base IBM recently contributed to the open source community. The IBM Cloudscape code was nominated and won Developer.com's Product of the Year 2005 award.

Now, IBM's own database experts have written a comprehensive guide to making the most of Apache Derby—and its commercial counterpart, IBM Cloudscape— in any development or production environment. This book systematically introduces the Apache Derby/IBM Cloudscape technology: where it fits and how to install and configure it—and how to build robust business applications and Web services with it, one step at a time.

Coverage includes

  • Comparing Apache Derby with the commercial IBM Cloudscape offering

  • Deploying Apache Derby/IBM Cloudscape to support development and production environments, client/server environments, multi-threaded applications, and Web servers

  • Integrating Apache Derby/IBM Cloudscape into a completely open source development environment

  • Specific instruction on installing Apache Derby/IBM Cloudscape on Windows® and Linux® workstations—with tips on how to install the code on any platform that has a supported JVM

  • Understanding how programming languages interact with Apache Derby/IBM Cloudscape

  • Building complete sample applications step-by-step in JDBC, Windows (ODBC and .NET), PHP, Perl, and Python

  • Managing and securing Apache Derby/IBM Cloudscape databases

  • Writing SQL code for creating, retrieving, and updating data

  • Troubleshooting installations, databases, and applications

This book has a companion Web site that contains links to the IBM version of Apache Derby and other downloadable code, documentation, articles, and other resources to give the reader a deeper understanding of some of the features available in Apache Derby.

Table of Contents

Preface.

Acknowledgments.

About the Authors.

I.

1. On Your Marks ... Get Set ... Go!!! An Introduction to the Apache Derby and IBM Cloudscape Community.

    Introduction

      If You're Not the Kind of Person Who Reads Introduction Chapters ...

    Let Me Get This Straight, Apache Derby Is IBM Cloudscape?

    Development of the Apache Derby Database-Who Can Contribute and How?

    How Can IBM Sell a Product for Profit and Contribute the Same Product to the Open Source Community?

    How an Open Source Database Like Apache Derby Can Help

      Open Source Software from a Business Perspective

      Open Source Software from a Technical Perspective

    Why the Need for a Local Data Store?

    Why Use a Relational Database?

    How the Apache Derby Platform Can Help Your Business

    A High-Level View of the Apache Derby Database

      Details on SQL Support in Apache Derby and IBM Cloudscape

    The Apache Derby Components

      The Apache Derby Database Engine

      Apache Derby Network Server

      ij-The Apache Derby JDBC Scripting Tool

    Developing Apache Derby Applications

II.

2. Deployment Options for Apache Derby Databases.

    Using the Embedded Framework for Apache Derby Applications

      Examples of the Embedded Framework for Apache Derby Applications

      Some Final Comments About the Embedded Framework for Apache Derby Applications

    Using the Server Framework for Apache Derby Applications

      Examples of the Server Framework for Apache Derby Applications

3. Apache Derby Databases.

    Introduction

    Database Structure

      Creating an Apache Derby Database

      Deleting an Apache Derby Database

      Database Contents

      Additional Database Connection Options

        Security

        Maintenance

        Environment

    Database Objects

      Tables

      Data Types

      Schemas

      Views

      Indexes

      Triggers

      Procedures

    Summary

4. Installing Apache Derby and IBM Cloudscape on Windows.

    Migration from Previous Versions of Cloudscape

    Before You Begin

      The Java Runtime Environment

      J Who? How Do I Set It Up? How Do I Know I've Got One?

        Checking the Version of the JRE on Your System

      Setting the PATH Environment Variable

    Using the Windows Installer to Install IBM Cloudscape on Windows-Attention Developers!

      IBM Cloudscape for Windows Installer Prerequisites

      Performing the Windows Installation

      Post-Installation Tasks for Graphical Installation Programs

    Installing Apache Derby or IBM Cloudscape on Windows Manually

      Creating and Setting the CLOUDSCAPE_INSTALL Environment Variable

      Setting the CLASSPATH Environment Variable

    Verifying the Installation

      Verifying a Database Installation

      Verifying a Network Server Installation

    Troubleshooting an Installation

    Odds and Ends About Your Installation

      Files on Disk

5. Installing Apache Derby and IBM Cloudscape on Linux.

    Migration from Previous Versions of Cloudscape

    Before You Begin

      The Java Runtime Environment

      J Who? How Do I Set It Up? How Do I Know I've Got One?

        Checking the Version of the JRE on Your System

      Setting the PATH Environment Variable

    Using the Linux Installer to Install IBM Cloudscape on Linux-Attention Developers!

      IBM Cloudscape for Linux Installer Prerequisites

      Performing the Linux Installation

      Post-Installation Tasks for Graphical Installation Programs

    Installing Apache Derby or IBM Cloudscape on Linux Manually

      Creating and Setting the CLOUDSCAPE_INSTALL Environment Variable

      Setting the CLASSPATH Environment Variable

    Verifying the Installation

      Verifying a Database Installation

      Verifying a Network Server Installation

    Troubleshooting an Installation

    Odds and Ends About Your Installation

      Files on Disk

6. Managing an Apache Derby Database.

    Disaster Prevention and Recovery

      Backing Up a Database

        Online Backup with Read Access (Built-in Copy)

        Online Backup with Read Access (Native Copy)

        Offline Backup

      Restoring a Database from a Backup Image

    Data Movement

      Importing Data

        Importing Data into a Table

        Importing Data into a Subset of Columns in a Table

      Exporting Data

        Exporting Data from a Single Table

        Exporting Data from the Results of a SELECT Statement

    Database Maintenance and Tuning

      Checking Database Consistency

      Investigating Performance Issues with Database Statistics

        Gathering Runtime Statistics

        Adding Timing to Runtime Statistics

      Reorganizing Data

    Summary

7. Security.

    Introduction

    Database File Security

    Database File Encryption

      Algorithm

      Feedback Mode

    User Authentication

      Enabling Authentication

      LDAP Directory Service Authentication

      User-Defined Authentication

      Built-In Authentication

        System-Level Users

        Database-Level Users

        Security Hierarchy

    Database Authorization

      Permissions

      Errors

    Summary

8. SQL.

    Introduction

    Your Momma Loves Drama Database

    Data Definition Language (DDL)

      The CREATE Statement

      The ALTER Statement

      The DECLARE Statement

      The DROP Statement

      Apache Derby Data Types

      Numeric Data Types

        Small Integer (SMALLINT)

        Integer (INTEGER)

        Big Integer (BIGINT)

        Decimal (DECIMAL/NUMERIC)

        Single-Precision Floating-Point (REAL/FLOAT)

        Double-Precision Floating-Point (DOUBLE/FLOAT)

      String Data Types

        Fixed-Length Character String (CHAR)

        Varying-Length Character String (VARCHAR)

        Varying-Length Long Character String (LONG VARCHAR)

        Character String Considerations

      Binary String Data Types

      Large Objects

        Character Large Object (CLOB)

        Binary Large Object (BLOB)

      Date and Time Data Types

        Date String (DATE)

        Time String (TIME)

        Timestamp String (TIMESTAMP)

      Creating User Tables

        Sample Table Create Statements

      Additional Data Type Modifiers

        Null Considerations

        Not Null with Default

        Identity Column

        IDENTITY_VAL_LOCAL Function

      Declared Tables

      Modifying a Table

        Adding a Column to a Table

        Adding a Constraint to a Table

        Dropping an Existing Constraint on a Table

        Altering the Size of a VARCHAR Column

        Overriding Row-Level Locking

      Removing a Table

      Constraints

      Unique Constraint

      Referential Integrity

        INSERT Rule

        DELETE Rules

        UPDATE Rules

      Check Constraints

        Adding Check Constraints

        Modifying Check Constraints

      System Catalog Tables

      Views

        Nested View Definitions

        Modifying a View

        Removing a View

      Indexes

        Unique Index and Non-Unique Index

        Referential Integrity and Indexes

        Null Values and Indexes

        General Indexing Guidelines

        Creating an Index

        Modifying an Index

        Removing an Index

    Data Retrieval

      Retrieving an Entire Table

      Projecting Columns from a Table

      Changing the Order of the Columns

      Restricting the Rows That Are Returned from a Table

      Restricting Rows Using Multiple Conditions

      Searching for String Patterns

      Searching for Data in Ranges

      Searching for a Set of Values

      Searching for Null Values

      Searching for Negative Conditions

      Selecting Columns from Multiple Tables

        Cartesian Product

        Joins

        Outer Join

        Left Outer Join

        Right Outer Join

      Using Correlation Names

      Sorting Output

      Derived Columns

      Apache Derby Functions

        Scalar Functions

        Column Functions

        Grouping Values

        Restricting Results with Column Functions

      Eliminating Duplicates

      Subqueries

      Quantified Predicates

      Case Expressions

      Nested Table Expressions

      Scalar Fullselect

      Union

      The EXISTS Predicate

    Data Modification

      Inserting Rows

      Inserting Data into Specific Columns

      Inserting Multiple Rows

      Inserting a Set of Values

      Updating Rows

      Removing Data

    Development SQL

      Schemas

      User-Defined Functions

      Triggers

        Trigger Activation

        Trigger Body

        Trigger Example-Updating Other Tables

        Trigger Example-Changing Inserted Values

        Trigger Example-Sets

      Stored Procedures

      Commit and Rollback

    Summary

III.

9. Developing Apache Derby Applications with JDBC.

    Introduction

    JBDC Program Structure

    JDBC Imports

    Using Embedded JDBC Drivers

    IBM DB2 JDBC Universal Driver for Derby

    Establishing a Database Connection

    Connecting with DB2 JDBC Drivers

      Server Name

      Port Number

      Database Name

      Apache Derby Attributes

      Universal Driver Attributes

    Allocating Statements

      resultSetType and resultSetCurrency

      Closing Statements

      Additional Statement Options

    Executing Dynamic SQL

    Trapping SQLExceptions

      getMessage()

      getSQLState()

      getErrorCode()

      Multiple SQLExceptions

    SQLWarnings Versus SQLExceptions

    Retrieving Query Results

    Retrieving Column Values

      getX() Usage

      Mismatched Data Types

      Null Values

      getByte() Usage

      getBlob() and getClob() Usage

    Dynamically Determining Result Sets

    Prepared Statements

    AUTOCOMMIT, COMMITs, and ROLLBACKs

    Batching Requests

    Using Result Sets to Modify Data

    Setting a Column to Null

    Inserting and Updating Large Objects

    Stored Procedures

      Creating a Stored Procedure

      Defining a Stored Procedure

      Calling a Stored Procedure

      Handling Result Sets

      Trapping Errors in Stored Procedures and Functions

      Multiple Result Sets

    User-Defined Functions

      Internal .JAR Files

      Create Function Details

      Using SQL Within a User-Defined Function

    Apache Derby Applets

    Locking Considerations

      Uncommitted Read

      Cursor Stability

      Read Stability

      Repeatable Read

      Choosing an Isolation Level

      Changing an Application's Isolation Level

      Lock Table

      Statement-Level Locking

    Summary

10. Developing Apache Derby Applications with Perl, PHP, Python, and ODBC.

    Communicating with an Apache Derby Network Server

      Distributed Relational Database Architecture (DRDA)

      Call Level Interface (CLI)

      Open Database Connectivity (ODBC)

      Perl, PHP, and Python

    Installing the DB2 Runtime Client

      Linux Operating Systems

      Windows Operating Systems

    Cataloging Apache Derby Network Servers

    Cataloging Apache Derby Databases

    Testing Your Connection

    Uncataloged Connections

    Summary

IV.

11. "Your Momma Loves Drama" in JDBC.

    Introduction

    Your Momma Loves Drama Database

      PRODUCTIONS Table

      PERFORMANCES Table

      SEATS Table

      PRICEPLAN Table

      SEATMAP Table

      TRANSACTIONS Table

    The Your Momma Loves Drama Application

    YMLD Overview

    Installing the YMLD Application

    YMLD Initialization

    Connecting to the YMLD System

    Current Performances at the Theater

      getSQLError() Method

    Seat Pricing

    Theater Seat Map

    Purchase Tickets by Performance

      Selecting a Production

      Selecting a Date

        setCalendar()

        getProdDates()

      Selecting a Seat

      Confirming the Order

      Finalizing the Transaction

    View Transaction Log

    Exit Routine

    Summary

12. "Your Momma Loves Drama" in Windows.

    Introduction

    The Your Momma Loves Drama Application

    YMLD Overview

    Installing the YMLD Application

    YMLD Initialization

    Connecting to the YMLD System

      Bad User ID or Password

      Changing the Schema

      Error Handling

    Current Performances at the Theater

    Try/Catch Block

    Seat Pricing

    Theater Seat Map

    Purchase Tickets by Performance

      Selecting a Production

      Selecting a Date

        setCalendar()

        getProdDates()

      Selecting a Seat

      Confirming the Order

      Finalizing the Transaction

    View Transaction Log

    Exit Routine

    Summary

13. "Your Momma Loves Drama" in PHP.

    PHP Overview

      What Makes PHP Unique?

      Most Appropriate Uses for This Language

        Purchaser Interface

      Performance Characteristics

      Popular Editing Environments

    Learning the PHP Language

      Delimiting PHP Code

      Variables

        Variable Names

        Declaring Variables

      Data Types

        Boolean

        Numeric Types

        Arrays

        Strings

      Control Structures

        while and do/while Loops

        if ... elseif ... else

        switch

        for Iterators

        foreach Iterators

        break and continue

      Defining Functions

      Creating Classes

      Including Libraries of PHP Code

    Installing and Configuring PHP

      Installing PHP on Linux

        Configuring PHP on Linux

      Installing PHP on Windows

        Downloading PHP

        Installing PHP

        Configuring PHP

    Creating Apache Derby Applications with PHP

      Running PHP Scripts from the Command Line

      Connecting to an Apache Derby Database

        Single Connections

        Disconnecting from a Database

        Pooling Connections

      Issuing SQL Statements

        Executing a Single Statement

        Issuing SQL Statements with Placeholders

        Reissuing the Same SQL Statement with Different Parameters

        Retrieving Data

        Calling Stored Procedures

      Managing Transactions

        Explicitly Committing and Rolling Back Transactions

        Setting Autocommit

      Special Data Types

        Large Objects: BLOBs and CLOBs

      Creating Web Interfaces

        Setting the XHTML Header

        Handling POST and GET Variables

        Checking User Input for Tainted Values

        Input-Filtering Functions

        Web Application Summary

        Customizing Web Sites with Session

    Summary

14. "Your Momma Loves Drama" in Perl.

    Perl Overview

      What Makes Perl Unique?

      Most Appropriate Uses for This Language

        Administrator Interface

        Purchaser Interface

      Performance Characteristics

      Popular Editing Environments

    Installing and Configuring Perl

      Installing Perl on Linux

        Configuring Perl on Linux

      Installing Perl on Windows

        Downloading Perl

        Installing ActivePerl

        Configuring Perl

    Creating Apache Derby Applications with Perl

      Using Perl Modules

      Running Perl Scripts from the Command Line

      Connecting to an Apache Derby Database

        Single Connections

        Disconnecting from a Database

        Pooling Connections

      Issuing SQL Statements

        Executing a Single Statement Immediately

        Preparing Statements for Reuse

        Retrieving Data

        Calling Stored Procedures

      Managing Transactions

        Explicitly Committing and Rolling Back Transactions

        Setting Autocommit

      Special Data Types

        Large Objects: BLOBs and CLOBs

      Creating Web Interfaces

        Using Common Web Modules

        Handling POST and GET Variables

        Checking User Input for Tainted V

商品描述(中文翻譯)

描述

學習安裝、配置、管理和安全性
深入探討 SQL、故障排除、應用程式開發等主題

掌握 Apache Derby:唯一的開源、純 Java™、完全事務性的、佔用空間小的關聯式資料庫管理系統(RDBMS)

Apache Derby 是全球唯一的企業級開源、純 Java、完全事務性的關聯式資料庫。它足夠小,可以直接嵌入到您的 Java 應用程式中,提供一個不需要 DBA 支援的本地資料存儲。這個資料庫功能強大,能夠支援各種傳統應用程式,並作為 WebSphere 應用伺服器及其他超過五十種 IBM 軟體產品的預設資料庫。Apache Derby 建立在 IBM 最近貢獻給開源社群的成熟 IBM Cloudscape 代碼基礎上。IBM Cloudscape 代碼曾獲得 Developer.com 2005 年度產品獎。

現在,IBM 自家的資料庫專家撰寫了一本全面的指南,幫助您在任何開發或生產環境中充分利用 Apache Derby 及其商業對應產品 IBM Cloudscape。本書系統地介紹了 Apache Derby/IBM Cloudscape 技術:它的適用範圍、如何安裝和配置,以及如何一步一步地構建穩健的商業應用程式和網路服務。

涵蓋內容包括

比較 Apache Derby 與商業版 IBM Cloudscape
部署 Apache Derby/IBM Cloudscape 以支援開發和生產環境、客戶/伺服器環境、多執行緒應用程式和網路伺服器
將 Apache Derby/IBM Cloudscape 整合到完全開源的開發環境中
在 Windows® 和 Linux® 工作站上安裝 Apache Derby/IBM Cloudscape 的具體指導—並提供如何在任何支援 JVM 的平台上安裝代碼的提示
了解程式語言如何與 Apache Derby/IBM Cloudscape 互動
逐步構建完整的範例應用程式,使用 JDBC、Windows(ODBC 和 .NET)、PHP、Perl 和 Python
管理和保護 Apache Derby/IBM Cloudscape 資料庫
撰寫 SQL 代碼以創建、檢索和更新資料
故障排除安裝、資料庫和應用程式

本書附有一個伴隨網站,包含指向 IBM 版本的 Apache Derby 及其他可下載代碼、文檔、文章和其他資源的鏈接,以幫助讀者更深入了解 Apache Derby 中的一些功能。

目錄

前言
致謝
關於作者
I.
1. 準備 ... 開始 ... 出發!!!Apache Derby 和 IBM Cloudscape 社群介紹。
    介紹
      如果您不是那種會閱讀介紹章節的人 ...
    讓我澄清一下,Apache Derby 是 IBM Cloudscape 嗎?
    Apache Derby 資料庫的開發—誰可以貢獻以及如何貢獻?
    IBM 如何以盈利的方式銷售產品並將相同產品貢獻給開源社群?
    開源資料庫如 Apache Derby 如何提供幫助
      從商業角度看開源軟體
      從技術角度看開源軟體
    為什麼需要本地資料存儲?
    為什麼使用關聯式資料庫?
    Apache Derby 平台如何幫助您的業務
    Apache Derby 資料庫的高層次概述
      Apache Derby 和 IBM Cloudscape 中 SQL 支援的詳細資訊
    Apache Derby 組件
      Apache Derby 資料庫引擎
      Apache Derby 網路伺服器
      ij—Apache Derby JDBC 腳本工具
    開發 Apache Derby 應用程式
II.
2. Apache Derby 資料庫的部署選項。
    使用嵌入式框架開發 Apache Derby 應用程式
      Apache Derby 應用程式的嵌入式框架範例
      關於 Apache Derby 應用程式的嵌入式框架的一些最終評論
    使用伺服器框架開發 Apache Derby 應用程式
      Apache Derby 應用程式的伺服器框架範例
3. Apache Derby 資料庫。
    介紹
    資料庫結構
      創建 Apache Derby 資料庫
      刪除 Apache Derby 資料庫
      資料庫內容
      額外的資料庫連接選項
        安全性
        維護
        環境
    資料庫物件
      表格
      資料類型
      架構
      檢視
      索引
      觸發器
      程序
    總結
4. 在 Windows 上安裝 Apache Derby 和 IBM Cloudscape。
    從先前版本的 Cloudscape 遷移
    開始之前
      Java 執行環境
      J 是誰?我該如何設置?我怎麼知道我有一個?
        檢查系統上 JRE 的版本
      設置 PATH 環境變數
    使用 Windows 安裝程式在 Windows 上安裝 IBM Cloudscape—開發者注意!
      IBM Cloudscape for Windows 安裝程式的先決條件
      執行 Windows 安裝
      圖形安裝程式的安裝後任務
    手動在 Windows 上安裝 Apache Derby 或 IBM Cloudscape
      創建並設置 CLOUDSCAPE_INSTALL 環境變數

最後瀏覽商品 (20)