IBM Informix Embedded SQLJ User™S Guide
Total Page:16
File Type:pdf, Size:1020Kb
DB2 ® IBM Informix Version 2.90 IBM Informix Embedded SQLJ User’s Guide G251-2278-00 DB2 ® IBM Informix Version 2.90 IBM Informix Embedded SQLJ User’s Guide G251-2278-00 .Note! Before using this information and the product it supports, read the information in “Notices” on page D-1. First Edition (November 2004) This document contains proprietary information of IBM. It is provided under a license agreement and is protected by copyright law. The information contained in this publication does not include any product warranties, and any statements provided in this manual should not be interpreted as such. When you send information to IBM, you grant IBM a nonexclusive right to use or distribute the information in any way it believes appropriate without incurring any obligation to you. © Copyright International Business Machines Corporation 1996, 2004. All rights reserved. US Government Users Restricted Rights – Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. Contents Introduction . .v About This Manual . .v Organization of This Manual . .v Types of Users . .vi Software Dependencies . vii Global Language Support . vii Documentation Conventions . vii Typographical Conventions . vii Feature, Product, and Platform . viii Syntax Diagrams . .ix Example Code Conventions . xiii Additional Documentation . xiv Installation Guides . xiv Online Notes . xiv Informix Error Messages . xvi Manuals . xvii Online Help . xvii Accessibility . xvii IBM Informix Dynamic Server Version 10.0 and CSDK Version 2.90 Documentation Set . xvii Compliance with Industry Standards . .xx IBM Welcomes Your Comments . xxi Chapter 1. Introducing IBM Informix Embedded SQLJ . 1-1 What Is Embedded SQLJ? . 1-1 How Does Embedded SQLJ Work? . 1-1 Embedded SQLJ Versus JDBC . 1-2 Chapter 2. Preparing to Use Embedded SQLJ . 2-1 What Components Do You Need? . 2-1 Setting Up Your Software . 2-1 Examples . 2-2 Chapter 3. Building an Embedded SQLJ Program . 3-1 Fundamentals of Embedded SQLJ . 3-1 SQLJ Statement Identifier . 3-1 Connecting to a Database . 3-1 Embedding SQL Statements . 3-2 Handling Result Sets . 3-3 A Simple Embedded SQLJ Program . 3-4 Chapter 4. The Embedded SQLJ Language . 4-1 Embedded SQLJ Versus Traditional Embedded SQL . 4-1 Embedded SQLJ Source Files . 4-2 Identifying Embedded SQLJ Statements . 4-2 SQL Statements . 4-2 © Copyright IBM Corp. 1996, 2004 iii Host Variables . 4-3 SELECT Statements That Return a Single Row . 4-3 Handling Result Sets . 4-4 Positional Iterators . 4-4 Named Iterators . 4-5 Using Column Aliases . 4-6 Iterator Methods . 4-6 Positioned Updates and Deletes . 4-7 Monitoring the Execution of an SQL Query . 4-7 Calling SPL Routines and Functions . 4-8 SQL and Java Type Mappings . 4-8 Language Character Sets . 4-10 Importing Java Packages . 4-11 SQLJ Reserved Names . 4-11 Parameter, Field, and Variable Names . 4-11 Class Names and Filenames . 4-11 Handling Errors . 4-12 Chapter 5. Processing Embedded SQLJ Source Code . 5-1 Translating, Compiling, and Running Embedded SQLJ Programs . 5-1 The ifxsqlj Command . 5-2 Command Options . 5-3 Basic Options . 5-3 Advanced Options . 5-5 Setting Options . 5-8 Setting Options on the Command Line . 5-9 Supplying Options in Property Files . 5-9 Online Checking . 5-11 Setting the -user and -password Options . 5-11 Setting the -url and -driver Options . 5-11 The ifxprofp Tool . 5-12 Appendix A. Connecting to Databases . A-1 Appendix B. Sample Programs . B-1 Appendix C. Accessibility . C-1 Notices . D-1 Index . X-1 iv IBM Informix Embedded SQLJ User’s Guide Introduction About This Manual . .v Organization of This Manual . .v Types of Users . .vi Software Dependencies . vii Global Language Support . vii Documentation Conventions . vii Typographical Conventions . vii Feature, Product, and Platform . viii Syntax Diagrams . .ix How to Read a Command-Line Syntax Diagram . .xi Keywords and Punctuation . xii Identifiers and Names . xii Example Code Conventions . xiii Additional Documentation . xiv Installation Guides . xiv Online Notes . xiv Locating Online Notes . .xv Online Notes Filenames . xvi Informix Error Messages . xvi Manuals . xvii Online Manuals . xvii Printed Manuals . xvii Online Help . xvii Accessibility . xvii IBM Informix Dynamic Server Version 10.0 and CSDK Version 2.90 Documentation Set . xvii Compliance with Industry Standards . .xx IBM Welcomes Your Comments . xxi In This Introduction This introduction provides an overview of the information in this manual and describes the conventions it uses. About This Manual This manual contains information about using IBM Informix Embedded SQLJ. This section discusses the organization of the manual, the intended audience, and the associated software products that you must have to use IBM Informix Embedded SQLJ. Organization of This Manual This manual includes the following chapters: © Copyright IBM Corp. 1996, 2004 v v Chapter 1, “Introducing IBM Informix Embedded SQLJ,” on page 1-1, introduces the IBM Informix Embedded SQLJ product. v Chapter 2, “Preparing to Use Embedded SQLJ,” on page 2-1, describes the software you need to develop and run Embedded SQLJ programs and how to set it up. v Chapter 3, “Building an Embedded SQLJ Program,” on page 3-1, provides an overview of the Embedded SQLJ language and demonstrates its use with a simple program. v Chapter 4, “The Embedded SQLJ Language,” on page 4-1, provides detailed information about the Embedded SQLJ language. v Chapter 5, “Processing Embedded SQLJ Source Code,” on page 5-1, explains how to use the SQLJ translator and how to compile and run your Embedded SQLJ programs. v Appendix A, “Connecting to Databases,” on page A-1, provides background information and further details about how an Embedded SQLJ program connects to a database. v Appendix B, “Sample Programs,” on page B-1, provides a table describing the sample programs included with Embedded SQLJ. v An Accessibility appendix describes how to read syntax diagrams in the HTML version of this manual using a screen reader. v A Notices appendix provides information about IBM Informix products. v An index follows at the end of the manual. Types of Users This guide is for programmers who want to write JavaTM programs that can: v Connect to Informix databases. v Issue SQL statements to manipulate data in the database. This manual is written with the assumption that you have the following background: v A working knowledge of your computer, your operating system, and the utilities that your operating system provides v Experience with the Java programming language v Experience working with relational databases or exposure to database concepts v Experience with the SQL query language If you have limited experience with relational databases, SQL, or your operating system, refer to the IBM Informix: Getting Started Guide for your database server for a list of supplementary titles. vi IBM Informix Embedded SQLJ User’s Guide Software Dependencies To run IBM Informix Embedded SQLJ programs, you must use one of the following database servers: v IBM Informix Dynamic Server, Version 9.x and later v IBM.