ITTIA DB SQL
Getting Started Guide

For Windows

Voice:001-425 462 0046
Fax:001-425 462 0048
Email:
Website:http://www.ittia.com

Technical support options

To obtain technical support for ITTIA DB SQL™, visit the Support section on our website.

ITTIA and the ITTIA logo are trademarks or registered trademarks of ITTIA in the U.S. and other countries. All other product or service names are the property of their respective owners.


Table of Contents

1. What is ITTIA DB SQL™?
Package Contents
Programs
Libraries
Examples
Documentation
2. Installing and Using ITTIA DB SQL
Unpacking and installing the software
Uninstalling the software
Starting ITTIA DB and creating your first database
Connecting to ITTIA DB for the first time
Running the examples with Microsoft Visual Studio

List of Figures

1.1. The ITTIA SQL Utility
1.2. The phonebook example solution
1.3. The ITTIA DB C++ API Reference Manual
1.4. The ITTIA DB C API Reference Manual
2.1. Components of ITTIA DB for Windows
2.2. ITTIA DB SQL™ Uninstall
2.3. Example session with the ITTIA SQL Utility
2.4. Running the ITTIA DB phonebook example for the first time

List of Tables

1.1. SDK Folder Structure
1.2. ITTIA DB SQL™ Libraries
1.3. Phonebook example variations

Chapter 1. What is ITTIA DB SQL™?

ITTIA DB SQL™ is a next-generation transactional engine for development of dedicated embedded systems and mobile handheld devices. ITTIA DB SQL™ brings robust data management facilities to bear on the tough data management problems now faced by embedded developers, in a package that is lightweight, cross-platform, fast, and easy to use. With ITTIA DB SQL™, intelligent devices and embedded systems have access to full data management capabilities even when disconnected.

Package Contents

Table 1.1. SDK Folder Structure

Folder

Description

win32

ITTIA DB for the win32 platform

win32/include/

Header files for ITTIA DB

win32/lib/

ITTIA DB libraries

win32/bin/

Contains interactive SQL utility and lightweight data server

win32/docs/

User's guide and API reference manual

win32/examples/

Example telephone book application

win32/dbcppapi/

ITTIA DB C++ API sources

csharp/

ITTIA DB C# API for .NET applications

csharp/lib/

ITTIA DB C# assembly and companion native win32 library

csharp/examples/

C# examples for ITTIA DB

java/

ITTIA DB Java API and companion native win32 library

java/doc/

Java API documentation

java/lib/

ITTIA DB jar file

java/src/com/ittia/example

Java examples for ITTIA DB


Programs

ITTIA DB SQL™ includes an interactive SQL utility named ittiasql that can be accessed from the Start Menu icon ITTIA SQL Utility. See the User's Guide for usage information. When run from the Start Menu, databases are created in your Documents folder by default.

ITTIA DB SQL Plus™ includes a light-weight data server for shared access to database files. When an application is linked with the ittiaipc library, it will connect to the data server to open and create database files. You must run ITTIA DB Server from the Start Menu to start the data server. See the User's Guide for usage information. When run from the Start Menu, databases are created in your Documents folder by default.

Figure 1.1. The ITTIA SQL Utility

The ITTIA SQL Utility

Libraries

The ITTIA DB kernel is a software library that can be directly embedded in an application, or accessed through a separate server processes. The database kernel provides a transactional C API that the application can use directly, or through ITTIA DB's C++ API bindings.

To minimize an application's code footprint and optimize performance, ITTIA DB SQL™ includes several alternative configurations of the ITTIA DB kernel that can be substituted for the default kernel library. These configurations omit specific features without changing the API interface. Available libraries are listed in Table 1.2, “ITTIA DB SQL™ Libraries”.

Table 1.2. ITTIA DB SQL™ Libraries

Configuration

Windows Library

Run-time DLL

Default

ittiasql.lib

ittiasql.dll

IPC client only

ittiasql_client.lib

ittiasql_client.dll

Local storage only, with SQL

ittiasql_local.lib

ittiasql_local.dll

Local storage only, without SQL

ittiadb_local.lib

ittiadb_local.dll

Single-user local storage, with SQL

ittiasql_su.lib

ittiasql_su.dll

Single-user local storage, without SQL

ittiadb_su.lib

ittiadb_su.dll

Compact kernel

ittiadb_compact_su.lib

ittiadb_compact_su.dll


Examples

The phonebook example is a console-based application that demonstrates how to store contact information in an ITTIA DB database.

Figure 1.2. The phonebook example solution

The phonebook example solution

ITTIA DB can be used in several different ways, and so to show this variety, there are four different implementations of the phonebook example. Developers may choose between the C API and the C++ API, which both offer access to the database through SQL queries, table cursors, or a combination of both.

Table 1.3. Phonebook example variations

Project

API

Database Access

phonebook_cpp_sql

ITTIA DB C++ API

SQL queries

phonebook_cpp

ITTIA DB C++ API

Table cursors

phonebook_c_sql

ITTIA DB C API

SQL queries

phonebook_c

ITTIA DB C API

Table cursors


The C++ API examples depend on the project dbcppapi, which contains the source code for the ITTIA DB C++ API. Applications that use the ITTIA DB C++ API must include the C++ API source code in their build process.

When the phonebook example is run for the first time, a database file is automatically created and populated with a few sample entries. The same database file is shared between all implementations of the phonebook example.

Documentation

ITTIA DB documentation consists of:

User's Guide

The essential guide to ITTIA DB usage and software development.

C API Reference

Reference manual for the ITTIA DB C API.

C++ API Reference

Reference manual for the ITTIA DB C++ API.

All documentation for ITTIA DB is available on-line at: http://www.ittia.com/products/documentation.

Figure 1.3. The ITTIA DB C++ API Reference Manual

The ITTIA DB C++ API Reference Manual

Figure 1.4. The ITTIA DB C API Reference Manual

The ITTIA DB C API Reference Manual

Chapter 2. Installing and Using ITTIA DB SQL

Unpacking and installing the software

To install the ITTIA DB SQL™ development kit on your computer, run ittiasql-*.exe and follow the instructions presented by the installer. Some components are optional and can be omitted from the installation.

Figure 2.1. Components of ITTIA DB for Windows

Components of ITTIA DB for Windows

Uninstalling the software

To remove ITTIA DB SQL™ from your system, open StartControl PanelAdd or Remove Programs. Select ITTIA DB SQL from the list, click the Remove button, and answer Yes when prompted.

If you have compiled any of the examples, the compiler output will remain in the examples folder and must be deleted manually. You may also need to remove any database and log files that have been created in your Documents folder.

Figure 2.2. ITTIA DB SQL™ Uninstall

ITTIA DB SQL Uninstall

Starting ITTIA DB and creating your first database

  1. Run the ITTIA SQL Utility from the Start Menu.

  2. Create a new database file with the .create command. The database file is created in your Documents folder by default.

  3. Create a table, insert a few rows, and select all rows in the table. For example:

    create table hello_world (x integer, y nvarchar(20));
    insert into hello_world
      values (1, 'Hello World');
    insert into hello_world
      select n, 'Hello ' || cast(n as nvarchar) from $nat(3);
    select * from hello_world;
  4. Save all changes to the database with the commit; SQL statement. If you do not commit your changes, they will be lost when you close the database.

  5. Use the .exit command to close the database when you are finished.

Figure 2.3. Example session with the ITTIA SQL Utility

Example session with the ITTIA SQL Utility

Connecting to ITTIA DB for the first time

Close all ITTIA SQL Utility windows. Start the ITTIA DB Server from the Start Menu. Database files will be located in the server's working directory, which defaults to your Documents folder.

To connect to the server, run the ITTIA SQL Utility from the Start Menu. Open the example database that you created in the previous section using the .open command and the x-dbtp:// protocol:

.open x-dbtp://localhost/example.db

In this way, you can open the same database file from multiple copies of the ITTIA SQL Utility and other ITTIA DB client applications. However, you cannot open the database file through the server if any program has the database file open directly.

Running the examples with Microsoft Visual Studio

To open the phonebook example in Visual Studio, select one of:

  • StartITTIAITTIA DB SQL for WindowsExample project (VC++ 6)

  • StartITTIAITTIA DB SQL for WindowsExample project (VS2005)

In Visual Studio, run the example with DebugStart Debugging.

Figure 2.4. Running the ITTIA DB phonebook example for the first time

Running the ITTIA DB phonebook example for the first time

By default, the examples are configured to create a local database file directly. Each example project has an IPC variation, identified by the _ipc suffix on the end of the project name. To share a database between multiple instances of the phone book example, run the ITTIA DB Server and one or more IPC example projects.