0% found this document useful (0 votes)
10 views69 pages

Matlab Database Toolbox Documentation Download

The document provides information on the MATLAB Database Toolbox, including user guides and links to additional resources. It outlines features, database connections, and driver support, as well as instructions for working with various database systems. The document also includes contact information for MathWorks and details about licensing and trademarks.

Uploaded by

dorsogeeck2b
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
0% found this document useful (0 votes)
10 views69 pages

Matlab Database Toolbox Documentation Download

The document provides information on the MATLAB Database Toolbox, including user guides and links to additional resources. It outlines features, database connections, and driver support, as well as instructions for working with various database systems. The document also includes contact information for MathWorks and details about licensing and trademarks.

Uploaded by

dorsogeeck2b
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/ 69

Matlab Database Toolbox Documentation download

https://ebookbell.com/product/matlab-database-toolbox-
documentation-6741418

Explore and download more ebooks at ebookbell.com


Here are some recommended products that we believe you will be
interested in. You can click the link to download.

Matlab Database Toolbox Users Guide The Mathworks Inc

https://ebookbell.com/product/matlab-database-toolbox-users-guide-the-
mathworks-inc-46110210

Matlab Database Toolbox Users Guide The Mathworks Inc

https://ebookbell.com/product/matlab-database-toolbox-users-guide-the-
mathworks-inc-46171490

Matlab A Practical Introduction To Programming And Problem Solving 6th


Edition Stormy Attaway

https://ebookbell.com/product/matlab-a-practical-introduction-to-
programming-and-problem-solving-6th-edition-stormy-attaway-46075418

Matlab For Engineering Applications 5e Ise 5thise William J Palm Iii

https://ebookbell.com/product/matlab-for-engineering-
applications-5e-ise-5thise-william-j-palm-iii-46562738
Matlab And Simulink Crash Course For Engineers 1st Ed 2022 Eklas
Hossain

https://ebookbell.com/product/matlab-and-simulink-crash-course-for-
engineers-1st-ed-2022-eklas-hossain-46608958

Matlab Medical Imaging Toolbox Users Guide The Mathworks

https://ebookbell.com/product/matlab-medical-imaging-toolbox-users-
guide-the-mathworks-46611260

Matlab For Engineering Applications 5th Edition William Palm

https://ebookbell.com/product/matlab-for-engineering-applications-5th-
edition-william-palm-46651690

Matlab For Engineering Berardino Dacunto

https://ebookbell.com/product/matlab-for-engineering-berardino-
dacunto-48710470

Matlab For Medical Physics Reallife Clinical Scenarios And Projects


Jidi Sun

https://ebookbell.com/product/matlab-for-medical-physics-reallife-
clinical-scenarios-and-projects-jidi-sun-49034592
Database Toolbox™
User's Guide

R2016a
How to Contact MathWorks

Latest news: www.mathworks.com

Sales and services: www.mathworks.com/sales_and_services

User community: www.mathworks.com/matlabcentral

Technical support: www.mathworks.com/support/contact_us

Phone: 508-647-7000

The MathWorks, Inc.


3 Apple Hill Drive
Natick, MA 01760-2098
Database Toolbox™ User's Guide
© COPYRIGHT 1998–2016 by The MathWorks, Inc.
The software described in this document is furnished under a license agreement. The software may be used
or copied only under the terms of the license agreement. No part of this manual may be photocopied or
reproduced in any form without prior written consent from The MathWorks, Inc.
FEDERAL ACQUISITION: This provision applies to all acquisitions of the Program and Documentation
by, for, or through the federal government of the United States. By accepting delivery of the Program
or Documentation, the government hereby agrees that this software or documentation qualifies as
commercial computer software or commercial computer software documentation as such terms are used
or defined in FAR 12.212, DFARS Part 227.72, and DFARS 252.227-7014. Accordingly, the terms and
conditions of this Agreement and only those rights specified in this Agreement, shall pertain to and
govern the use, modification, reproduction, release, performance, display, and disclosure of the Program
and Documentation by the federal government (or other entity acquiring for or through the federal
government) and shall supersede any conflicting contractual terms or conditions. If this License fails
to meet the government's needs or is inconsistent in any respect with federal procurement law, the
government agrees to return the Program and Documentation, unused, to The MathWorks, Inc.
Trademarks
MATLAB and Simulink are registered trademarks of The MathWorks, Inc. See
www.mathworks.com/trademarks for a list of additional trademarks. Other product or brand
names may be trademarks or registered trademarks of their respective holders.
Patents
MathWorks products are protected by one or more U.S. patents. Please see
www.mathworks.com/patents for more information.
Revision History
May 1998 Online Only New for Version 1 for MATLAB® 5.2
July 1998 First Printing For Version 1
Online only June 1999 Revised for Version 2 (Release 11)
December 1999 Second printing For Version 2 (Release 11)
Online only September 2000 Revised for Version 2.1 (Release 12)
June 2001 Third printing Revised for Version 2.2 (Release 12.1)
July 2002 Online only Revised for Version 2.2.1 (Release 13)
November 2002 Fourth printing Version 2.2.1
June 2004 Fifth printing Revised for Version 3.0 (Release 14)
October 2004 Online only Revised for Version 3.1 (Release 14SP1)
March 2005 Online only Revised for Version 3.0.2 (Release 14SP2)
September 2005 Online only Revised for Version 3.1 (Release 14SP3)
March 2006 Online only Revised for Version 3.1.1 (Release 2006a)
September 2006 Online only Revised for Version 3.2 (Release 2006b)
October 2006 Sixth printing Revised for Version 3.2 (Release 2006b)
March 2007 Online only Revised for Version 3.3 (Release 2007a)
September 2007 Seventh printing Revised for Version 3.4 (Release 2007b)
March 2008 Online only Revised for Version 3.4.1 (Release 2008a)
October 2008 Online only Revised for Version 3.5 (Release 2008b)
March 2009 Online only Revised for Version 3.5.1 (Release 2009a)
September 2009 Online only Revised for Version 3.6 (Release 2009b)
March 2010 Online only Revised for Version 3.7 (Release 2010a)
September 2010 Online only Revised for Version 3.8 (Release 2010b)
reApril 2011 Online only Revised for Version 3.9 (Release 2011a)
September 2011 Online only Revised for Version 3.10 (Release 2011b)
March 2012 Online only Revised for Version 3.11 (Release 2012a)
September 2012 Online only Revised for Version 4.0 (Release 2012b)
March 2013 Online only Revised for Version 4.1 (Release 2013a)
September 2013 Online only Revised for Version 5.0 (Release 2013b)
March 2014 Online only Revised for Version 5.1 (Release 2014a)
October 2014 Online only Revised for Version 5.2 (Release 2014b)
March 2015 Online only Revised for Version 5.2.1 (Release 2015a)
September 2015 Online only Revised for Version 6.0 (Release 2015b)
March 2016 Online only Revised for Version 6.1 (Release 2016a)
Contents

Before You Begin


1
Database Toolbox Product Description . . . . . . . . . . . . . . . . . 1-2
Key Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-2

Working with Databases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-3


Connecting to Databases . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-3
Platform Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-3
Database Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-3
Driver Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-4
Structured Query Language (SQL) . . . . . . . . . . . . . . . . . . . . 1-5

Data Type Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-6

Data Retrieval Restrictions . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-8


Spaces in Table Names or Column Names . . . . . . . . . . . . . . 1-8
Quotation Marks in Table Names or Column Names . . . . . . . 1-8
Reserved Words in Column Names . . . . . . . . . . . . . . . . . . . . 1-8

Creating and Running SQL Queries . . . . . . . . . . . . . . . . . . . . 1-9

Getting Started with Database Toolbox


2
Working with a Database and MATLAB . . . . . . . . . . . . . . . . . 2-3

Working with the MATLAB Interface to SQLite . . . . . . . . . . 2-6


MATLAB Interface to SQLite Advantages . . . . . . . . . . . . . . . 2-6
SQLite JDBC Connection Differences . . . . . . . . . . . . . . . . . . 2-6
MATLAB Interface to SQLite Workflow . . . . . . . . . . . . . . . . 2-7
MATLAB Interface to SQLite Limitations . . . . . . . . . . . . . . . 2-7

v
Connection Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-9
Creating or Connecting to a Data Source . . . . . . . . . . . . . . . 2-9
Defining Operating System Authentication . . . . . . . . . . . . . . 2-9
Connection Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-10
Working with Multiple Databases . . . . . . . . . . . . . . . . . . . . 2-11

Initial Setup Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . 2-12

Choosing Between ODBC and JDBC Drivers . . . . . . . . . . . . 2-13


Defining Database Drivers . . . . . . . . . . . . . . . . . . . . . . . . . 2-13
Deciding Between ODBC and JDBC Drivers . . . . . . . . . . . . 2-13

Configuring a Driver and Data Source . . . . . . . . . . . . . . . . . 2-16

Microsoft Access ODBC for Windows . . . . . . . . . . . . . . . . . . 2-19


Step 1. Verify the driver installation. . . . . . . . . . . . . . . . . . 2-19
Step 2. Set up the data source using Database Explorer. . . . 2-19
Step 3. Connect using Database Explorer or the command
line. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-22

Microsoft SQL Server ODBC for Windows . . . . . . . . . . . . . . 2-26


Step 1. Verify the driver installation. . . . . . . . . . . . . . . . . . 2-26
Step 2. Set up the data source using Database Explorer. . . . 2-26
Step 3. Connect using Database Explorer or the command
line. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-31

Microsoft SQL Server JDBC for Windows . . . . . . . . . . . . . . 2-35


Step 1. Verify the driver installation. . . . . . . . . . . . . . . . . . 2-35
Step 2. Verify the port number. . . . . . . . . . . . . . . . . . . . . . . 2-35
Step 3. Set up the operating system authentication. . . . . . . 2-38
Step 4. Add the JDBC driver to the MATLAB static Java class
path. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-39
Step 5. Set up the data source using Database Explorer. . . . 2-39
Step 6. Connect using Database Explorer or the command
line. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-42

Oracle ODBC for Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-46


Step 1. Verify the driver installation. . . . . . . . . . . . . . . . . . 2-46
Step 2. Set up the data source using the ODBC Data Source
Administrator. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-46
Step 3. Connect using the native ODBC connection command
line. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-49

vi Contents
Oracle JDBC for Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-50
Step 1. Verify the driver installation. . . . . . . . . . . . . . . . . . 2-50
Step 2. Set up the operating system authentication. . . . . . . 2-50
Step 3. Add the JDBC driver to the MATLAB static Java class
path. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-51
Step 4. Set up the data source using Database Explorer. . . . 2-51
Step 5. Connect using Database Explorer or the command
line. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-54

MySQL ODBC for Windows . . . . . . . . . . . . . . . . . . . . . . . . . . 2-59


Step 1. Verify the driver installation. . . . . . . . . . . . . . . . . . 2-59
Step 2. Set up the data source using Database Explorer. . . . 2-59
Step 3. Connect using Database Explorer or the command
line. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-62

MySQL JDBC for Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-65


Step 1. Verify the driver installation. . . . . . . . . . . . . . . . . . 2-65
Step 2. Add the JDBC driver to the MATLAB static Java class
path. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-65
Step 3. Set up the data source using Database Explorer. . . . 2-66
Step 4. Connect using Database Explorer or the command
line. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-68

PostgreSQL ODBC for Windows . . . . . . . . . . . . . . . . . . . . . . 2-71


Step 1. Verify the driver installation. . . . . . . . . . . . . . . . . . 2-71
Step 2. Set up the data source using Database Explorer. . . . 2-71
Step 3. Connect using Database Explorer or the command
line. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-74

PostgreSQL JDBC for Windows . . . . . . . . . . . . . . . . . . . . . . . 2-77


Step 1. Verify the driver installation. . . . . . . . . . . . . . . . . . 2-77
Step 2. Add the JDBC driver to the MATLAB static Java class
path. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-77
Step 3. Set up the data source using Database Explorer. . . . 2-78
Step 4. Connect using Database Explorer or the command
line. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-80

SQLite JDBC for Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-83


Step 1. Verify the driver installation. . . . . . . . . . . . . . . . . . 2-83
Step 2. Add the JDBC driver to the MATLAB static Java class
path. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-83
Step 3. Set up the data source using Database Explorer. . . . 2-84

vii
Step 4. Connect using Database Explorer or the command
line. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-86

Sybase ODBC for Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-90


Step 1. Verify the driver installation. . . . . . . . . . . . . . . . . . 2-90
Step 2. Set up the data source using Database Explorer. . . . 2-90
Step 3. Connect using Database Explorer or the command
line. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-94

Sybase JDBC for Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-97


Step 1. Verify the driver installation. . . . . . . . . . . . . . . . . . 2-97
Step 2. Add the JDBC driver to the MATLAB static Java class
path. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-97
Step 3. Set up the data source using Database Explorer. . . . 2-98
Step 4. Connect using Database Explorer or the command
line. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-100

Microsoft SQL Server JDBC for Mac OS X . . . . . . . . . . . . . 2-104


Step 1. Verify the driver installation. . . . . . . . . . . . . . . . . 2-104
Step 2. Add the JDBC driver to the MATLAB static Java class
path. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-104
Step 3. Set up the data source using Database Explorer. . . 2-105
Step 4. Connect using Database Explorer or the command
line. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-107

Microsoft SQL Server JDBC for Linux . . . . . . . . . . . . . . . . 2-111


Step 1. Verify the driver installation. . . . . . . . . . . . . . . . . 2-111
Step 2. Add the JDBC driver to the MATLAB static Java class
path. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-111
Step 3. Set up the data source using Database Explorer. . . 2-112
Step 4. Connect using Database Explorer or the command
line. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-114

Oracle JDBC for Mac OS X . . . . . . . . . . . . . . . . . . . . . . . . . . 2-118


Step 1. Verify the driver installation. . . . . . . . . . . . . . . . . 2-118
Step 2. Add the JDBC driver to the MATLAB static Java class
path. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-118
Step 3. Set up the data source using Database Explorer. . . 2-119
Step 4. Connect using Database Explorer or the command
line. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-121

Oracle JDBC for Linux . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-125


Step 1. Verify the driver installation. . . . . . . . . . . . . . . . . 2-125

viii Contents
Step 2. Add the JDBC driver to the MATLAB static Java class
path. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-125
Step 3. Set up the data source using Database Explorer. . . 2-126
Step 4. Connect using Database Explorer or the command
line. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-128

MySQL JDBC for Mac OS X . . . . . . . . . . . . . . . . . . . . . . . . . 2-132


Step 1. Verify the driver installation. . . . . . . . . . . . . . . . . 2-132
Step 2. Add the JDBC driver to the MATLAB static Java class
path. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-132
Step 3. Set up the data source using Database Explorer. . . 2-133
Step 4. Connect using Database Explorer or the command
line. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-135

MySQL JDBC for Linux . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-139


Step 1. Verify the driver installation. . . . . . . . . . . . . . . . . 2-139
Step 2. Add the JDBC driver to the MATLAB static Java class
path. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-139
Step 3. Set up the data source using Database Explorer. . . 2-140
Step 4. Connect using Database Explorer or the command
line. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-142

PostgreSQL JDBC for Mac OS X . . . . . . . . . . . . . . . . . . . . . 2-146


Step 1. Verify the driver installation. . . . . . . . . . . . . . . . . 2-146
Step 2. Add the JDBC driver to the MATLAB static Java class
path. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-146
Step 3. Set up the data source using Database Explorer. . . 2-147
Step 4. Connect using Database Explorer or the command
line. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-149

PostgreSQL JDBC for Linux . . . . . . . . . . . . . . . . . . . . . . . . 2-153


Step 1. Verify the driver installation. . . . . . . . . . . . . . . . . 2-153
Step 2. Add the JDBC driver to the MATLAB static Java class
path. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-153
Step 3. Set up the data source using Database Explorer. . . 2-154
Step 4. Connect using Database Explorer or the command
line. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-156

SQLite JDBC for Mac OS X . . . . . . . . . . . . . . . . . . . . . . . . . 2-160


Step 1. Verify the driver installation. . . . . . . . . . . . . . . . . 2-160
Step 2. Add the JDBC driver to the MATLAB static Java class
path. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-160
Step 3. Set up the data source using Database Explorer. . . 2-161

ix
Step 4. Connect using Database Explorer or the command
line. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-163

SQLite JDBC for Linux . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-167


Step 1. Verify the driver installation. . . . . . . . . . . . . . . . . 2-167
Step 2. Add the JDBC driver to the MATLAB static Java class
path. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-167
Step 3. Set up the data source using Database Explorer. . . 2-168
Step 4. Connect using Database Explorer or the command
line. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-170

Sybase JDBC for Mac OS X . . . . . . . . . . . . . . . . . . . . . . . . . 2-174


Step 1. Verify the driver installation. . . . . . . . . . . . . . . . . 2-174
Step 2. Add the JDBC driver to the MATLAB static Java class
path. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-174
Step 3. Set up the data source using Database Explorer. . . 2-175
Step 4. Connect using Database Explorer or the command
line. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-177

Sybase JDBC for Linux . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-181


Step 1. Verify the driver installation. . . . . . . . . . . . . . . . . 2-181
Step 2. Add the JDBC driver to the MATLAB static Java class
path. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-181
Step 3. Set up the data source using Database Explorer. . . 2-182
Step 4. Connect using Database Explorer or the command
line. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-184

Other ODBC- or JDBC-Compliant Databases . . . . . . . . . . . 2-188


ODBC-Compliant Databases . . . . . . . . . . . . . . . . . . . . . . . 2-188
JDBC-Compliant Databases . . . . . . . . . . . . . . . . . . . . . . . 2-188

Connecting to a Database . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-191


Connection Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-191
Microsoft Access . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-191
Microsoft SQL Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-191
Oracle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-192
MySQL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-192
PostgreSQL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-193
SQLite . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-193
Sybase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-193
Other ODBC- or JDBC-Compliant Databases . . . . . . . . . . 2-193

x Contents
Selecting Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-195
Use Database Explorer to Select Data . . . . . . . . . . . . . . . . 2-195
Use the Command Line to Select Data . . . . . . . . . . . . . . . 2-195
Working with Custom Data Types . . . . . . . . . . . . . . . . . . . 2-195
Running SQL Queries Saved in Scripts or Files . . . . . . . . . 2-196

Inserting Data Using the Command Line . . . . . . . . . . . . . . 2-197

Working with Large Data Sets . . . . . . . . . . . . . . . . . . . . . . . 2-199


Connect to a Database with Maximum Performance . . . . . 2-199
Import Large Data Sets into MATLAB . . . . . . . . . . . . . . . 2-199
Export Large Data Sets from MATLAB . . . . . . . . . . . . . . . 2-200
Access Large Data Using a DatabaseDatastore . . . . . . . . . 2-200

Deploying a Database Application with MATLAB Compiler 2-201


Create and Deploy a Database Application . . . . . . . . . . . . 2-201
About Driver Configurations . . . . . . . . . . . . . . . . . . . . . . . 2-201

Working with Data Sources


3
Setting Up ODBC Data Sources . . . . . . . . . . . . . . . . . . . . . . . . 3-2

Setting Up JDBC Data Sources . . . . . . . . . . . . . . . . . . . . . . . . 3-3

Accessing Existing JDBC Data Sources . . . . . . . . . . . . . . . . . 3-4

Modifying Existing JDBC Data Sources . . . . . . . . . . . . . . . . . 3-5

Removing JDBC Data Sources . . . . . . . . . . . . . . . . . . . . . . . . . 3-6

Fetching Data Common Errors . . . . . . . . . . . . . . . . . . . . . . . . 3-7

Database Connection Error Messages . . . . . . . . . . . . . . . . . . 3-10

Database Explorer Error Messages . . . . . . . . . . . . . . . . . . . . 3-15

Connecting to a Database Using the Native ODBC


Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-18
About the Native ODBC Interface . . . . . . . . . . . . . . . . . . . . 3-18

xi
Native ODBC Interface Workflow . . . . . . . . . . . . . . . . . . . . 3-18
Database Connection Type Comparison . . . . . . . . . . . . . . . . 3-20
Compatibility and Limitations . . . . . . . . . . . . . . . . . . . . . . 3-22

Using Database Explorer


4
Working with Database Explorer . . . . . . . . . . . . . . . . . . . . . . 4-2
Getting Started with Database Explorer . . . . . . . . . . . . . . . . 4-2
Migrate from VQB to Database Explorer . . . . . . . . . . . . . . . 4-2
Set Database Explorer Preferences . . . . . . . . . . . . . . . . . . . . 4-3

Configure Data Sources and Connect to Databases . . . . . . . 4-6


Configure Your Environment . . . . . . . . . . . . . . . . . . . . . . . . 4-6
Work with Multiple Databases . . . . . . . . . . . . . . . . . . . . . . 4-17

Modify and Delete Database Connections . . . . . . . . . . . . . . 4-19


ODBC Drivers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-19
JDBC Drivers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-19

Refine Results Using Query Criteria and Rules . . . . . . . . . 4-21


Define Query Criteria to Refine Results . . . . . . . . . . . . . . . 4-21
Query Rules Using the SQL Criteria Panel . . . . . . . . . . . . . 4-22

Generate SQL and MATLAB Code . . . . . . . . . . . . . . . . . . . . . 4-25


Save Queries as SQL Code . . . . . . . . . . . . . . . . . . . . . . . . . 4-25
Generate MATLAB Code . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-26

Using Visual Query Builder


5
Getting Started with Visual Query Builder . . . . . . . . . . . . . . 5-2
What Is Visual Query Builder? . . . . . . . . . . . . . . . . . . . . . . . 5-2
Using Queries to Import Data . . . . . . . . . . . . . . . . . . . . . . . . 5-2
Using Queries to Export Data . . . . . . . . . . . . . . . . . . . . . . . . 5-9
Clearing Variables from the VQB Data Area . . . . . . . . . . . . 5-14

xii Contents
Working with Preferences . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-15

Preference Settings for Large Data Import . . . . . . . . . . . . . 5-19


Will All Data (Size n) Fit in a MATLAB Variable? . . . . . . . . 5-20
Will All of This Data Fit in the JVM Heap? . . . . . . . . . . . . 5-20
How Do I Perform Batching? . . . . . . . . . . . . . . . . . . . . . . . . 5-21

Displaying Query Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-24


How to Display Query Results . . . . . . . . . . . . . . . . . . . . . . 5-24
Displaying Data Relationally . . . . . . . . . . . . . . . . . . . . . . . . 5-24
Charting Query Results . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-28
Displaying Query Results in an HTML Report . . . . . . . . . . 5-30
Displaying Query Results with MATLAB Report Generator . 5-30

Fine-Tuning Queries Using Advanced Query Options . . . . 5-35


Retrieving All Occurrences vs. Unique Occurrences of Data . 5-35
Retrieving Data That Meets Specified Criteria . . . . . . . . . . 5-36
Grouping Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-39
Displaying Results in a Specified Order . . . . . . . . . . . . . . . 5-43
Using Having Clauses to Refine Group by Results . . . . . . . 5-46
Creating Subqueries for Values from Multiple Tables . . . . . 5-49
Creating Queries That Include Results from Multiple Tables 5-53
Additional Advanced Query Options . . . . . . . . . . . . . . . . . . 5-55

Retrieving BINARY and OTHER Data Types . . . . . . . . . . . . 5-56

Importing and Exporting Boolean Data . . . . . . . . . . . . . . . . 5-58


Import Boolean Data from Databases . . . . . . . . . . . . . . . . . 5-58
Exporting Boolean Data to Databases . . . . . . . . . . . . . . . . . 5-61

Saving Queries in Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-62


About Generated Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-62
VQB Query Elements in Generated Files . . . . . . . . . . . . . . 5-63
Saving Queries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-63
Running Saved Queries . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-63
Editing Queries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-64

xiii
Using Database Toolbox Functions
6
Getting Started with Database Toolbox Functions . . . . . . . . 6-3

Import Data from Databases into MATLAB . . . . . . . . . . . . . . 6-4

Create Queries with Characters and Variables . . . . . . . . . . . 6-8


Create a Query Using a Date . . . . . . . . . . . . . . . . . . . . . . . . 6-8
Create Query Using Text . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-9
Create a Query Using a MATLAB Variable . . . . . . . . . . . . . 6-10
Create a Query Using Special Characters . . . . . . . . . . . . . . 6-11

Roll Back and Commit Data in a Database . . . . . . . . . . . . . 6-13

Change the Database Connection Catalog . . . . . . . . . . . . . . 6-14

Create a Table and Add a Column . . . . . . . . . . . . . . . . . . . . 6-15

Delete Data from Databases . . . . . . . . . . . . . . . . . . . . . . . . . . 6-16

Roll Back Data After Updating a Record . . . . . . . . . . . . . . . 6-19

Export Data to New Record in Database . . . . . . . . . . . . . . . 6-22

Replace Existing Data in a Database . . . . . . . . . . . . . . . . . . 6-25

Export Multiple Records from the MATLAB Workspace . . . 6-27

Export Data Using Bulk Insert . . . . . . . . . . . . . . . . . . . . . . . 6-31


About Bulk Insert Functionality . . . . . . . . . . . . . . . . . . . . . 6-31
Bulk Insert into Oracle . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-31
Bulk Insert into Microsoft SQL Server 2005 . . . . . . . . . . . . 6-33
Bulk Insert into MySQL . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-34

Retrieve Image Data Types . . . . . . . . . . . . . . . . . . . . . . . . . . 6-37

Display Database Metadata . . . . . . . . . . . . . . . . . . . . . . . . . . 6-39

Using Driver Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-42

About Database Toolbox Objects and Methods . . . . . . . . . . 6-44

xiv Contents
Selecting Data Using the exec Function . . . . . . . . . . . . . . . . 6-45
About the exec Function . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-45
Using Cursor Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-45
Working with Microsoft Excel . . . . . . . . . . . . . . . . . . . . . . . 6-45
Database Considerations . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-46

Call a Stored Procedure That Returns Data . . . . . . . . . . . . 6-47

Run a Custom Database Function . . . . . . . . . . . . . . . . . . . . . 6-51

Managing Memory to Import Data . . . . . . . . . . . . . . . . . . . . 6-53


Importing Data Is a Two-Step Process . . . . . . . . . . . . . . . . 6-53
Managing Memory by Limiting the Number of Rows . . . . . . 6-53
Managing MATLAB Memory by Importing Data in Batches 6-54

Importing Data Using the fetch Function . . . . . . . . . . . . . . 6-56


About the fetch Function . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-56
fetch Workflow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-56
Using fetch with a Cursor Object . . . . . . . . . . . . . . . . . . . . 6-57
Using fetch with Cursor and Database Connection Objects . 6-58
Database Consideration . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-58

Import Data Incrementally Using the Cursor Object . . . . . 6-60

Display Information About Imported Data . . . . . . . . . . . . . 6-63

Importing Data Using a Scrollable Cursor . . . . . . . . . . . . . . 6-66


About Scrollable Cursors . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-66
Differences Between Native ODBC and JDBC Scrollable
Cursors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-67

Import Data Using a Scrollable Cursor with a Relative


Position Offset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-73

Import Large Data Using Paging . . . . . . . . . . . . . . . . . . . . . . 6-76

Inserting Data Using the fastinsert Function . . . . . . . . . . . 6-78


About the fastinsert Function . . . . . . . . . . . . . . . . . . . . . . . 6-78
Database Considerations . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-78

Retrieving Object Properties Using the get Function . . . . . 6-80


Database Connection Objects . . . . . . . . . . . . . . . . . . . . . . . 6-80
Cursor Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-81

xv
Driver Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-82
Database Metadata Objects . . . . . . . . . . . . . . . . . . . . . . . . . 6-82
Drivermanager Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-83
Resultset Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-83
Resultset Metadata Objects . . . . . . . . . . . . . . . . . . . . . . . . . 6-83

Setting Database Preferences Using the setdbprefs


Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-85
About the setdbprefs Function . . . . . . . . . . . . . . . . . . . . . . 6-85
Allowable Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-85

Working with a DatabaseDatastore . . . . . . . . . . . . . . . . . . . . 6-89


About DatabaseDatastore Objects . . . . . . . . . . . . . . . . . . . . 6-89
Advantages of DatabaseDatastore Objects Over Basic
Fetching . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-89

Import Data Using a DatabaseDatastore . . . . . . . . . . . . . . . 6-91

Analyze Large Data Sets in a Database with MapReduce . . 6-95

Work with Data Using the MATLAB Interface to SQLite . . 6-99

Functions — Alphabetical List


7

xvi Contents
1

Before You Begin

• “Database Toolbox Product Description” on page 1-2


• “Working with Databases” on page 1-3
• “Data Type Support” on page 1-6
• “Data Retrieval Restrictions” on page 1-8
• “Creating and Running SQL Queries” on page 1-9
1 Before You Begin

Database Toolbox Product Description


Exchange data with relational databases

Database Toolbox™ provides an app and functions for exchanging data between
relational databases and MATLAB®. You can use SQL commands to read and write data
or use the Database Explorer app to interact with a database without using SQL.

The toolbox supports ODBC-compliant and JDBC-compliant databases, including


Oracle®, SAS®, MySQL®, Sybase®, Microsoft® SQL Server®, Microsoft Access™, and
PostgreSQL. You can apply simple and advanced conditions to database queries from
MATLAB. The toolbox lets you access multiple databases simultaneously within a single
MATLAB session and enables segmented import of large data sets.

Key Features
• Database Explorer app for working with databases interactively
• JDBC- and ODBC-compliant database connections, with fast read/write via a native
ODBC interface
• Functions for executing queries using SQL files and SQL statements
• Data import and export with multiple databases in a single session
• Large data set import via a single transaction, via multiple transactions, or as a
DatabaseDatastore object
• Direct data import into numeric, cell, structure, tables, and dataset arrays
• Support for noSQL database Mongo DB

1-2
Working with Databases

Working with Databases


In this section...
“Connecting to Databases” on page 1-3
“Platform Support” on page 1-3
“Database Support” on page 1-3
“Driver Support” on page 1-4
“Structured Query Language (SQL)” on page 1-5

Connecting to Databases
Before you can use this toolbox to connect to a database, you must set up the data
sources. For details, see “Configuring a Driver and Data Source” on page 2-16.

Platform Support
This toolbox runs on all platforms that the MATLAB software supports.

For details, see Database Toolbox system requirements at http://www.mathworks.com/


products/database/requirements.html.

Note: This toolbox does not support running MATLAB software sessions with the -
nojvm startup option enabled on UNIX® platforms. (UNIX is a registered trademark of
The Open Group in the United States and other countries.)

Database Support
This toolbox supports importing and exporting data from any ODBC- and/or JDBC-
compliant database management system, including:

• IBM DB2®
• IBM® Informix®
• Ingres®

1-3
1 Before You Begin

• Microsoft Access
• Microsoft Excel®
• Microsoft SQL Server
• MySQL
• Oracle
• PostgreSQL (Postgres)
• Sybase SQL Anywhere®
• Sybase SQL Server®

If you are upgrading an earlier version of a database, you need not do anything special
for this toolbox. Simply configure the data sources for the new version of the database
application as you did for the original version.

Driver Support
This toolbox requires a database driver. Typically, you install a driver when you install a
database. For instructions about how to install a database driver, consult your database
administrator.

On Microsoft Windows® platforms, the toolbox supports Open Database Connectivity


(ODBC) drivers and Oracle Java® Database Connectivity (JDBC) drivers.

Note: If you receive this message:

Invalid string or buffer length.

you might be using the wrong driver.

The JDBC/ODBC bridge is known to have issues with 64-bit database systems. Use a
JDBC driver or the native ODBC interface to connect to these databases.

On UNIX platforms, the toolbox supports Java Database Connectivity (JDBC) drivers.
If your database does not ship with JDBC drivers, download drivers from the Oracle
JDBC Web site at http://www.oracle.com/technetwork/database/enterprise-
edition/jdbc-112010-090769.html.

1-4
Working with Databases

Structured Query Language (SQL)


This toolbox supports American National Standards Institute (ANSI®) standard SQL
commands.

1-5
1 Before You Begin

Data Type Support


You can import the following data types into the MATLAB Workspace and export them
back to your database:

• BOOLEAN
• CHAR
• DATE
• DECIMAL
• DOUBLE
• FLOAT
• INTEGER
• LONGCHAR
• NUMERIC
• REAL
• SMALLINT
• TIME
• TIMESTAMP

Note: When importing TIMESTAMP data into MATLAB, you might get an incorrect
value near the daylight savings time change. Possible workarounds are to convert
TIMESTAMP data to strings in your SQL query, and then convert them back to your
desired type in MATLAB, or try using a different driver for your database.
• TINYINT

Note: Database Toolbox interprets the TINYINT data type as BOOLEAN and imports
it into the MATLAB workspace as logical true (1) or false (0). For details about
how Database Toolbox handles BOOLEAN data, see “Importing and Exporting Boolean
Data” on page 5-58.
• VARCHAR
• NTEXT

You can import data of types not included in this list into the MATLAB Workspace.
However, you might need to manipulate such data before you can process it in MATLAB.

1-6
Data Type Support

Note: Data types LONGCHAR and NTEXT are not supported for the native ODBC interface.

1-7
1 Before You Begin

Data Retrieval Restrictions


In this section...
“Spaces in Table Names or Column Names” on page 1-8
“Quotation Marks in Table Names or Column Names” on page 1-8
“Reserved Words in Column Names” on page 1-8

Spaces in Table Names or Column Names


Microsoft Access supports the use of spaces in table and column names, but most other
databases do not. Queries that retrieve data from tables and fields whose names contain
spaces require delimiters around table names and field names. In Access, enclose
the table names or field names in quotation marks, for example, "order id". Other
databases use different delimiters, such as brackets, [ ]. In Visual Query Builder, table
names and field names that include spaces appear in quotation marks.

Quotation Marks in Table Names or Column Names


Do not include quotation marks in table names or column names. The Database Toolbox
software does not support data retrieval from table and column names that contain
quotation marks.

Reserved Words in Column Names


You cannot use the Database Toolbox software to import or export data in columns whose
names contain database reserved words, such as DATE or TABLE.

More About
• “Creating and Running SQL Queries” on page 1-9

1-8
Creating and Running SQL Queries

Creating and Running SQL Queries


You can select data from your database and import it into MATLAB by doing any of the
following:

• Use Database Explorer or the command line.


• Write queries using SQL.
• Use MATLAB to generate the SQL.

Then, if you want to repeat your tasks, then automate them by generating a MATLAB
script.

Writing a query requires knowledge of SQL and experience using the command line. Use
the exec function to write SQL if you have short or simple SQL queries that are easy
to write as a character vector. Also, use the exec function to add MATLAB variables to
your SQL query. If you have a long SQL query or multiple SQL queries that you want to
run sequentially, create an SQL script file containing your SQL queries. To execute the
SQL script file, use runsqlscript.

If you are unfamiliar with writing SQL code, then you can use Database Explorer to
create SQL queries. For details, see “Define Query Criteria to Refine Results” on page
4-21. After creating the query using Database Explorer, you can generate the SQL for
this query. For details, see “Save Queries as SQL Code” on page 4-25. You can embed
the generated SQL into the SQL query that you specify in exec. Or, you can create an
SQL script file to use with the runsqlscript function.

If you want to automate the current task after the SQL is created, then generate a
MATLAB script. For details, see “Generate MATLAB Code” on page 4-26.

More About
• “Managing Memory to Import Data” on page 6-53
• “Data Retrieval Restrictions” on page 1-8
• “Data Type Support” on page 1-6

1-9
2

Getting Started with Database


Toolbox

• “Working with a Database and MATLAB” on page 2-3


• “Working with the MATLAB Interface to SQLite” on page 2-6
• “Connection Options” on page 2-9
• “Initial Setup Requirements” on page 2-12
• “Choosing Between ODBC and JDBC Drivers” on page 2-13
• “Configuring a Driver and Data Source” on page 2-16
• “Microsoft Access ODBC for Windows” on page 2-19
• “Microsoft SQL Server ODBC for Windows” on page 2-26
• “Microsoft SQL Server JDBC for Windows” on page 2-35
• “Oracle ODBC for Windows” on page 2-46
• “Oracle JDBC for Windows” on page 2-50
• “MySQL ODBC for Windows” on page 2-59
• “MySQL JDBC for Windows” on page 2-65
• “PostgreSQL ODBC for Windows” on page 2-71
• “PostgreSQL JDBC for Windows” on page 2-77
• “SQLite JDBC for Windows” on page 2-83
• “Sybase ODBC for Windows” on page 2-90
• “Sybase JDBC for Windows” on page 2-97
• “Microsoft SQL Server JDBC for Mac OS X” on page 2-104
• “Microsoft SQL Server JDBC for Linux” on page 2-111
• “Oracle JDBC for Mac OS X” on page 2-118
• “Oracle JDBC for Linux” on page 2-125
• “MySQL JDBC for Mac OS X” on page 2-132
2 Getting Started with Database Toolbox

• “MySQL JDBC for Linux” on page 2-139


• “PostgreSQL JDBC for Mac OS X” on page 2-146
• “PostgreSQL JDBC for Linux” on page 2-153
• “SQLite JDBC for Mac OS X” on page 2-160
• “SQLite JDBC for Linux” on page 2-167
• “Sybase JDBC for Mac OS X” on page 2-174
• “Sybase JDBC for Linux” on page 2-181
• “Other ODBC- or JDBC-Compliant Databases” on page 2-188
• “Connecting to a Database” on page 2-191
• “Selecting Data” on page 2-195
• “Inserting Data Using the Command Line” on page 2-197
• “Working with Large Data Sets” on page 2-199
• “Deploying a Database Application with MATLAB Compiler” on page 2-201

2-2
Working with a Database and MATLAB

Working with a Database and MATLAB


This tutorial shows how to use Database Toolbox. To get maximum benefit from and
understand the capabilities of this toolbox, use these steps and decision flow chart.

1 If you do not have an installed database and want to store relational data quickly,
you can use the MATLAB Interface to SQLite. For details, see “Working with the
MATLAB Interface to SQLite” on page 2-6.
2 Install your database. For details, refer to your database administrator or your
database documentation.
3 Choose whether you want to use Database Explorer or the command line using the
following flow chart.
4 Choose whether you want to use an ODBC or JDBC driver. For details, see
“Choosing Between ODBC and JDBC Drivers” on page 2-13.
5 For ODBC drivers, the driver is typically preinstalled on your computer. For JDBC
drivers, install the driver. For details about ODBC and JDBC drivers, see Driver
Installation. If you have questions about which driver you need, refer to your
database administrator or your database documentation.
6 Define your data source for ODBC-compliant drivers or add the full path of the
driver to the static Java class path for JDBC-compliant drivers. For details, see
“Configuring a Driver and Data Source” on page 2-16.
7 Test the connection to your database using Database Explorer or the command line.
8 Connect to your database using Database Explorer or the command line. For details,
see “Connecting to a Database” on page 2-191.
9 Select data from your database and import the data into a MATLAB variable using
Database Explorer or the command-line exec and fetch functions. For details, see
“Selecting Data” on page 2-195.
10 Insert data into your database by exporting data from a MATLAB variable using
datainsert, fastinsert, and insert functions. For details, see “Inserting Data
Using the Command Line” on page 2-197.
11 To automate your tasks using the Database Explorer import functionality, generate
a MATLAB script. For details, see “Generate MATLAB Code” on page 4-26.

For a graphical representation of the steps and the decisions you must make, see this
flow chart.

2-3
2 Getting Started with Database Toolbox

2-4
Working with a Database and MATLAB

More About
• “Initial Setup Requirements” on page 2-12
• “Working with Database Explorer” on page 4-2
• “Choosing Between ODBC and JDBC Drivers” on page 2-13
• “Configuring a Driver and Data Source” on page 2-16
• “Connecting to a Database” on page 2-191
• “Working with the MATLAB Interface to SQLite” on page 2-6

2-5
2 Getting Started with Database Toolbox

Working with the MATLAB Interface to SQLite


To analyze your data using SQL in MATLAB without access to a database or driver, use
the MATLAB Interface to SQLite. After installing Database Toolbox, you can use the
MATLAB Interface to SQLite to move data between MATLAB and a SQLite database
file. The SQLite connection is different from a database connection created using a JDBC
driver. For background information about SQLite databases, see SQLite Home Page. To
use all the Database Toolbox functionality, install the SQLite JDBC driver and connect
to your SQLite database file using a URL string. For details, see “Configuring a Driver
and Data Source” on page 2-16.

In this section...
“MATLAB Interface to SQLite Advantages” on page 2-6
“SQLite JDBC Connection Differences” on page 2-6
“MATLAB Interface to SQLite Workflow” on page 2-7
“MATLAB Interface to SQLite Limitations” on page 2-7

MATLAB Interface to SQLite Advantages


The advantages of using the MATLAB Interface to SQLite are:

• Start working with data immediately after installing the Database Toolbox by
creating a SQLite database file.
• No installation or administration of software or drivers required.
• Share data using SQLite database files.
• Support for Windows, Linux®, and Mac.

SQLite JDBC Connection Differences


The following table describes the differences between the MATLAB Interface to SQLite
and connecting to a SQLite database using the JDBC driver.

SQLite Connection Using the SQLite Database Connection


MATLAB Interface to SQLite Using a JDBC Driver
Driver installation Not required Required
Database installation Not required Required

2-6
Working with the MATLAB Interface to SQLite

SQLite Connection Using the SQLite Database Connection


MATLAB Interface to SQLite Using a JDBC Driver
Database administration Not required Required
Database connection sqlite database
function
Import data Yes Yes
Export data Yes Yes
Database Explorer No Yes
Run stored procedures No Yes
Database metadata No Yes
Other complex database No Yes
operations and functionality

MATLAB Interface to SQLite Workflow


To connect to a database quickly and import data, use the MATLAB Interface to SQLite.
These steps provide a high-level workflow for using the MATLAB Interface to SQLite.

1 Create a SQLite database file using sqlite. The SQLite database file has a .db
extension.
2 Create tables in the SQLite database file using exec.
3 Export your data into the SQLite database file using insert.
4 Import data into MATLAB using fetch.
5 Perform data analysis in MATLAB.
6 Export results into the SQLite database file using insert.
7 Close the SQLite connection using close.
8 Share the SQLite database file with others.

MATLAB Interface to SQLite Limitations


The limitations of using the MATLAB Interface to SQLite are:

• Only DOUBLE, INT64, and CHAR data types are supported.


• NULL values in columns are not supported.

2-7
2 Getting Started with Database Toolbox

• Database Explorer is not supported. Use the command line.

See Also
close | exec | fetch | insert | sqlite

Related Examples
• “Work with Data Using the MATLAB Interface to SQLite” on page 6-99

More About
• “Working with a Database and MATLAB” on page 2-3
• “Configuring a Driver and Data Source” on page 2-16

External Websites
• SQLite Home Page

2-8
Connection Options

Connection Options
In this section...
“Creating or Connecting to a Data Source” on page 2-9
“Defining Operating System Authentication” on page 2-9
“Connection Options” on page 2-10
“Working with Multiple Databases” on page 2-11

There are various ways to connect to your database using Database Toolbox. If you
have access to a database, create a data source. Then, you can connect to your database
either by using Database Explorer or the command line. If you do not have an installed
database and want to store relational data quickly, you can use the MATLAB Interface to
SQLite. For details, see “Working with the MATLAB Interface to SQLite” on page 2-6.

Creating or Connecting to a Data Source


If you already have your driver installed, you can create a data source. For an ODBC
driver, use the Microsoft ODBC Data Source Administrator. For a JDBC driver, add the
path of the driver to the Java class path in MATLAB. For examples, see “Configuring
a Driver and Data Source” on page 2-16. Otherwise, see Driver Installation to help
you install your driver. If your data sources are defined, then you are ready to connect
to your database. If you created JDBC data sources using VQB, then see “Migrate from
VQB to Database Explorer” on page 4-2. For details, see “Connecting to a Database”
on page 2-191. Once connected, you can begin to explore your database using Database
Explorer or the command line to view your data. For details, see “Selecting Data” on page
2-195.

Defining Operating System Authentication


Operating system authentication allows you to connect to your database using your
operating system user account. The operating system performs user validation and
the database does not require a different user name and password. Operating system
authentication facilitates easy maintenance of database access credentials. For example,
Windows provides operating system authentication that can be configured to work with
a Microsoft SQL Server database. For details about Microsoft SQL Server Windows
authentication, see “Step 3. Set up the operating system authentication.” on page
2-38

2-9
2 Getting Started with Database Toolbox

Connection Options
Use this table to choose your best connection option.

Connection Option Why Use This Option?


Database Explorer Use Database Explorer to:

• Visually inspect the structure, or schema, of your


database.
• Assess the general size of your database by viewing
the database structure.
• Select the data in a table and import it into a
MATLAB variable.
• Generate a MATLAB script.
• Generate an SQL query.

For details, see “Selecting Data” on page 2-195.


Command line Use the command line to:

• Import data from a database into MATLAB.


• Export data from MATLAB into a database.
• Work with large amounts of data.
• Run SQL queries stored in text files.
• Run stored procedures and functions.

There are multiple options to connect to your database using the command line. Use this
table to choose your best connection option.

Connection Option Why Use This Option?


Native ODBC connection Connect to your database with maximum performance.
For details about the native ODBC interface, see
“Connecting to a Database Using the Native ODBC
Interface” on page 3-18.
JDBC connection Achieve maximum platform independence. Use
functionality not supported by native ODBC.

2-10
Connection Options

Connection Option Why Use This Option?


ODBC connection Only use this option after trying to connect to
your database using the native ODBC and JDBC
connections.
SQLite connection Import data without installing a database or a driver.
For details about the MATLAB Interface to SQLite, see
“Working with the MATLAB Interface to SQLite” on
page 2-6.

Working with Multiple Databases


You can connect to multiple databases using Database Explorer or the command line. For
details, see “Work with Multiple Databases” on page 4-17.

See Also
database

More About
• “Choosing Between ODBC and JDBC Drivers” on page 2-13
• “Connecting to a Database” on page 2-191
• “Connecting to a Database Using the Native ODBC Interface” on page 3-18
• “Selecting Data” on page 2-195
• “Working with the MATLAB Interface to SQLite” on page 2-6

2-11
2 Getting Started with Database Toolbox

Initial Setup Requirements


Refer to the following setup requirements to establish the first connection to your
database.

• If you do not have an installed database and want to store relational data quickly,
you can use the MATLAB Interface to SQLite. For details, see “Working with the
MATLAB Interface to SQLite” on page 2-6.
• If you use Visual Query Builder (VQB) to explore the data in your database, migrate
to the Database Explorer app. For details, see “Migrate from VQB to Database
Explorer” on page 4-2.
• Ensure that you know the name of your database server or machine, the name of your
database, the port number, and your user name and password. For ODBC drivers,
once you create a data source, remember the data source name. For JDBC drivers,
ensure that you know the file path of where the JDBC driver is installed. For some
JDBC drivers, you need the URL string and the driver Java class object. For some
databases, more credentials are required. Contact your database administrator for all
required database credentials needed for establishing connection to your database.
• Ensure that you have access to your database and driver documentation.
• Check if your database uses operating system authentication. If you can connect to
your database from outside of MATLAB without providing a user name and password,
then your database uses operating system authentication. Exceptions to this rule
are databases set up without any operating system or database authentication
requirements, such as Microsoft Access or SQLite database files. To set up connection
to your database using operating system authentication from MATLAB, there can be
additional required steps.
• Ensure that you have write access to the path MATLAB displays after executing
prefdir on the command line.

See Also
database

More About
• “Working with a Database and MATLAB” on page 2-3
• “Connecting to a Database” on page 2-191

2-12
Choosing Between ODBC and JDBC Drivers

Choosing Between ODBC and JDBC Drivers


In this section...
“Defining Database Drivers” on page 2-13
“Deciding Between ODBC and JDBC Drivers” on page 2-13

Defining Database Drivers


Different database vendors, such as Microsoft or Oracle, implement their database
systems using various technologies depending on customer needs, market demands, and
several other factors. Software applications written in popular programming languages,
such as C, C++, or Java, need a way to communicate with these databases. Open
Database Connectivity (ODBC) and Java Database Connectivity (JDBC) are standards
for drivers that enable programmers to write database-agnostic software applications.
ODBC and JDBC are simply standards, or a set of rules recommended for efficient
communication with a database. The database vendor is responsible for implementing
and providing drivers that are committed to follow these rules.

Deciding Between ODBC and JDBC Drivers


ODBC is a standard Microsoft Windows interface that enables communication between
database management systems and applications typically written in C or C++.

JDBC is a standard interface that enables communication between applications based on


Oracle Java and database management systems.

The JDBC/ODBC bridge is a Java library that allows Java applications to access the
ODBC interface.

Database Toolbox has a C++ library that connects natively to an ODBC driver. Database
Toolbox has a Java library that connects directly to a pure JDBC driver or uses
the JDBC/ODBC bridge to connect to an ODBC driver. The JDBC/ODBC bridge is
automatically installed as part of the MATLAB JVM™.

Note: The JDBC/ODBC bridge functionality will be removed in a future release.

The following figure illustrates how drivers interact with Database Toolbox.

2-13
2 Getting Started with Database Toolbox

Depending on your environment and what you want to accomplish, decide whether using
an ODBC driver or a JDBC driver suits your needs the best. Use the following to help
you decide.

Use native ODBC for:

• Fastest performance for data imports and exports


• Memory-intensive data imports and exports

Use JDBC for:

• Platform independence allowing you to work with any operating system (including
Mac and Linux), driver version, or bitness
• Using Database Toolbox functions not supported by the native ODBC interface (such
as runstoredprocedure)
• Working with complex or long data types (e.g., LONG, BLOB, text, etc.)

Tip: On Windows systems that support both ODBC and JDBC drivers, JDBC drivers and
the native ODBC interface provide better connectivity and performance than the JDBC/
ODBC bridge. First, use the native ODBC or JDBC drivers to connect to your database.
Use the JDBC/ODBC bridge only after trying to connect through native ODBC or JDBC
drivers.

2-14
Choosing Between ODBC and JDBC Drivers

For a list of native ODBC supported functionality and a full comparison of the JDBC/
ODBC bridge to the native ODBC interface, see “Connecting to a Database Using the
Native ODBC Interface” on page 3-18.

See Also
close | database

More About
• “Working with a Database and MATLAB” on page 2-3
• “Connection Options” on page 2-9
• “Configuring a Driver and Data Source” on page 2-16
• “Connecting to a Database” on page 2-191
• “Working with Large Data Sets” on page 2-199

2-15
2 Getting Started with Database Toolbox

Configuring a Driver and Data Source


To connect to an installed database, install the driver. Then, define a data source for
ODBC or add the full path of the driver to the static Java class path for JDBC. If you do
not have an installed database and want to store relational data quickly, you can use the
MATLAB Interface to SQLite. For details, see “Working with the MATLAB Interface to
SQLite” on page 2-6.

ODBC uses a Data Source Name (DSN) that is the logical name to refer to the drive and
other required information for accessing data. This name is used to connect to an ODBC
data source, such as a Microsoft SQL Server database.

Find your database environment in the following table by choosing your platform across
the top and your database on the left. The link brings you to a page that has all the
required steps for connecting to your database.

Database Platform
Windows Mac OS X 64-bit Linux 64-bit
Microsoft Access “Microsoft Access
ODBC for Windows”
on page 2-19
Microsoft SQL “Microsoft SQL “Microsoft SQL “Microsoft SQL
Server Server ODBC for Server JDBC for Server JDBC for
Windows” on page Mac OS X” on page Linux” on page
2-26 2-104 2-111

“Microsoft SQL
Server JDBC for
Windows” on page
2-35
Oracle “Oracle ODBC for “Oracle JDBC for “Oracle JDBC for
Windows” on page Mac OS X” on page Linux” on page
2-46 2-118 2-125

“Oracle JDBC for


Windows” on page
2-50

2-16
Configuring a Driver and Data Source

Database Platform
Windows Mac OS X 64-bit Linux 64-bit
MySQL “MySQL ODBC for “MySQL JDBC for “MySQL JDBC
Windows” on page Mac OS X” on page for Linux” on page
2-59 2-132 2-139

“MySQL JDBC for


Windows” on page
2-65
PostgreSQL “PostgreSQL ODBC “PostgreSQL JDBC “PostgreSQL JDBC
for Windows” on for Mac OS X” on for Linux” on page
page 2-71 page 2-146 2-153

“PostgreSQL JDBC
for Windows” on
page 2-77
SQLite “SQLite JDBC for “SQLite JDBC for “SQLite JDBC for
Windows” on page Mac OS X” on page Linux” on page
2-83 2-160 2-167
Sybase “Sybase ODBC for “Sybase JDBC for “Sybase JDBC for
Windows” on page Mac OS X” on page Linux” on page
2-90 2-174 2-181

“Sybase JDBC for


Windows” on page
2-97

Microsoft Access is not supported for Mac 64-bit and Linux 64-bit platforms.

For ODBC- or JDBC- compliant databases that are not listed in the table, see “Other
ODBC- or JDBC-Compliant Databases” on page 2-188.

See Also
close | database

More About
• “Working with a Database and MATLAB” on page 2-3

2-17
2 Getting Started with Database Toolbox

• “Initial Setup Requirements” on page 2-12


• “Choosing Between ODBC and JDBC Drivers” on page 2-13
• “Connecting to a Database” on page 2-191
• “Working with the MATLAB Interface to SQLite” on page 2-6

2-18
Microsoft Access ODBC for Windows

Microsoft Access ODBC for Windows


This tutorial shows how to set up a data source and connect to your Microsoft Access
database. This tutorial uses the Microsoft Access Driver (*.mdb, *accdb) to connect to the
Microsoft Access 2010 database.

In this section...
“Step 1. Verify the driver installation.” on page 2-19
“Step 2. Set up the data source using Database Explorer.” on page 2-19
“Step 3. Connect using Database Explorer or the command line.” on page 2-22

Step 1. Verify the driver installation.


The ODBC driver is typically preinstalled on your computer. For details about the driver
installation or troubleshooting the installation, contact your database administrator
or refer to your database documentation on ODBC drivers. For information about the
Microsoft ODBC Data Source Administrator, see Driver Installation.

Note: The Database Toolbox no longer supports connection to a database using a 32-
bit driver. Use a 64-bit version of Microsoft Access. Or, to connect to a 32-bit version of
Microsoft Access, see http://www.mathworks.com/matlabcentral/answers/235949-how-
to-connect-to-32-bit-microsoft-access-database-from-64-bit-matlab. For details about
working with a 64-bit version of Windows, see http://www.mathworks.com/products/
matlab/preparing-for-64-bit-windows.html.

Step 2. Set up the data source using Database Explorer.


Set up your Microsoft Access database using Database Explorer. When setting up a data
source for use with an ODBC driver, you can locate the target database on a PC running
the Windows operating system or on another system to which the PC is networked. These
instructions use the Microsoft ODBC Data Source Administrator Version 6.1 for the U.S.
English version of Microsoft Access 2010 for Windows systems.

1 Close all open databases, including tutorial.mdb, in the database program.


2 Open Database Explorer by clicking the Apps tab on the MATLAB Toolstrip. Then,
select Database Explorer from the Database Connectivity and Reporting

2-19
2 Getting Started with Database Toolbox

section in the apps gallery. Alternatively, enter dexplore at the command line. If
no data sources are set up, a message box opens. Click OK to close it. Otherwise, the
Connect to a Data Source dialog box opens. Click Cancel to close this dialog box.
3 Click the Database Explorer tab, and then select New > ODBC.

In the ODBC Data Source Administrator dialog box, you can define the ODBC data
source.

2-20
Microsoft Access ODBC for Windows

4 Click the User DSN tab and then click Add. When setting up an ODBC data source,
you can use a User DSN or System DSN. A User DSN is specific to the user on a
machine. Any data sources a user defines under User DSN are seen only by that
specific user. Conversely, a System DSN is not specific to the user on a machine. Any
data sources a user defines under System DSN on a machine can be seen by any user
who logs into that machine. Your ability to set up a User DSN or System DSN might
depend on the database and ODBC driver you are using. For details, contact your
database administrator or your database ODBC driver documentation.
5 A list of installed ODBC drivers appears in the Create New Data Source dialog box.
Select Microsoft Access Driver (*.mdb, *.accdb) and click Finish.
6 In the ODBC Microsoft Access Setup dialog box for your driver, enter
dbtoolboxdemo as the data source name. Enter tutorial database as the
description. Click Select to open the Select Database dialog box.

7 Specify the database you want to use. For the dbtoolboxdemo data source, select
tutorial.mdb. If your database is on a system to which your PC is connected:

a Click Network.
b In the Map Network Drive dialog box, specify the folder containing the database
that you want to use.
c Click Finish.
8 Click OK to close the Select Database dialog box. In the ODBC Microsoft Access
Setup dialog box, click OK. The ODBC Data Source Administrator dialog box

2-21
2 Getting Started with Database Toolbox

displays the dbtoolboxdemo and any additional data sources that you added in the
User DSN tab. Click OK to close the dialog box.
9 Test the connection to the data source by using Database Explorer to connect to the
database.

After you complete the data source setup, connect to the Microsoft Access database
using Database Explorer or the command line with the native ODBC or ODBC
connection.

Step 3. Connect using Database Explorer or the command line.


Connect to Microsoft Access using Database Explorer.

1 After setting up the data source, click Connect in the Database Explorer tab.
2 In the Connect to a Data Source dialog box, connect to your database by selecting the
data source name dbtoolboxdemo from the Data Sources list.
3 Enter a user name and password and click Connect.

Database Explorer connects to the database and displays the tables list, or database
schema, on the left side of the window.

2-22
Microsoft Access ODBC for Windows

4 Close the connection using Database Explorer by hovering the cursor over the Close
button ( ) next to the dbtoolboxdemo data source name on the database tab. The
Close button turns into a red circle ( ). Click it to close the database connection. If
you want to close Database Explorer and all database connections, click the Close
button ( ) in the top-right corner.

If Database Explorer is docked, click the Close button ( ) to close all database
connections and Database Explorer.

2-23
2 Getting Started with Database Toolbox

Connect to Microsoft Access using the native ODBC connection command line.

1 Connect to the database with the ODBC data source name. For example, the
following code assumes you are connecting to a data source named dbtoolboxdemo
with user name admin and password admin.

conn = database.ODBCConnection('dbtoolboxdemo','admin','admin');
2 Close the database connection conn.

close(conn)

Connect to Microsoft Access using the ODBC connection command line.

1 Connect to the database with the ODBC data source name. For example, the
following code assumes you are connecting to a data source named dbtoolboxdemo
with user name admin and password admin.

conn = database('dbtoolboxdemo','admin','admin');
2 Close the database connection conn.

close(conn)

2-24
Exploring the Variety of Random
Documents with Different Content
Protector;" "Adelaide, or the Countercharm;" and "Forest of
Montalbano."
HARRINGTON, a Tale; and Ormond, a Tale. By Maria Edgeworth;
Author of "Tales of Fashionable Life," &c. &c. 3 vols.
PATRONAGE. By the same Author. Third Edition.
COMIC DRAMAS. By the same Author. 1 vol.
SARSFIELD, or the Wanderings of Youth; an Irish Tale. By John
Gamble, Esq. Strabane. 3 vols.
HOWARD. By the same Author. 2 vols.
WARWICK CASTLE, an Historical Novel. By Miss Prickett; containing,
amongst other desultory information, the Descent and Achievements
of the ancient Earls of Warwick, from the earliest period of their
creation to the present time. With some Account of Warwick,
Birmingham, Lemington, &c. &c. interspersed with Pieces of local
Poetry, incidental Biography, and Anecdotes of English History. 3
vols.
MODERN TIMES, or the Age We Live In; a Posthumous Novel,
dedicated by Permission to the Right Honourable Countess Cowper.
By Elizabeth Helme; Author of "The Pilgrim of the Cross," &c. 3 vols.
THE BRITISH PLUTARCH; containing the Lives of the most Eminent
Divines, Patriots, Statesmen, Warriors, Philosophers, Poets, and
Artists of Great Britain and Ireland, from the Accession of Henry
VIII. to the present time. A new Edition, re-arranged and enriched
with several additional Lives. By the Rev. Francis Wrangham, M.A.
F.R.S. 6 large vols.
Besides presenting at least one distinguished example, and
frequently several, in nearly every respectable division of society, this
collection of one hundred Lives exhibits an almost continuous view
of the English annals.
*** END OF THE PROJECT GUTENBERG EBOOK MANNERS: A
NOVEL, VOL 1 ***

Updated editions will replace the previous one—the old editions


will be renamed.

Creating the works from print editions not protected by U.S.


copyright law means that no one owns a United States
copyright in these works, so the Foundation (and you!) can copy
and distribute it in the United States without permission and
without paying copyright royalties. Special rules, set forth in the
General Terms of Use part of this license, apply to copying and
distributing Project Gutenberg™ electronic works to protect the
PROJECT GUTENBERG™ concept and trademark. Project
Gutenberg is a registered trademark, and may not be used if
you charge for an eBook, except by following the terms of the
trademark license, including paying royalties for use of the
Project Gutenberg trademark. If you do not charge anything for
copies of this eBook, complying with the trademark license is
very easy. You may use this eBook for nearly any purpose such
as creation of derivative works, reports, performances and
research. Project Gutenberg eBooks may be modified and
printed and given away—you may do practically ANYTHING in
the United States with eBooks not protected by U.S. copyright
law. Redistribution is subject to the trademark license, especially
commercial redistribution.

START: FULL LICENSE


THE FULL PROJECT GUTENBERG LICENSE
PLEASE READ THIS BEFORE YOU DISTRIBUTE OR USE THIS WORK

To protect the Project Gutenberg™ mission of promoting the


free distribution of electronic works, by using or distributing this
work (or any other work associated in any way with the phrase
“Project Gutenberg”), you agree to comply with all the terms of
the Full Project Gutenberg™ License available with this file or
online at www.gutenberg.org/license.

Section 1. General Terms of Use and


Redistributing Project Gutenberg™
electronic works
1.A. By reading or using any part of this Project Gutenberg™
electronic work, you indicate that you have read, understand,
agree to and accept all the terms of this license and intellectual
property (trademark/copyright) agreement. If you do not agree
to abide by all the terms of this agreement, you must cease
using and return or destroy all copies of Project Gutenberg™
electronic works in your possession. If you paid a fee for
obtaining a copy of or access to a Project Gutenberg™
electronic work and you do not agree to be bound by the terms
of this agreement, you may obtain a refund from the person or
entity to whom you paid the fee as set forth in paragraph 1.E.8.

1.B. “Project Gutenberg” is a registered trademark. It may only


be used on or associated in any way with an electronic work by
people who agree to be bound by the terms of this agreement.
There are a few things that you can do with most Project
Gutenberg™ electronic works even without complying with the
full terms of this agreement. See paragraph 1.C below. There
are a lot of things you can do with Project Gutenberg™
electronic works if you follow the terms of this agreement and
help preserve free future access to Project Gutenberg™
electronic works. See paragraph 1.E below.
1.C. The Project Gutenberg Literary Archive Foundation (“the
Foundation” or PGLAF), owns a compilation copyright in the
collection of Project Gutenberg™ electronic works. Nearly all the
individual works in the collection are in the public domain in the
United States. If an individual work is unprotected by copyright
law in the United States and you are located in the United
States, we do not claim a right to prevent you from copying,
distributing, performing, displaying or creating derivative works
based on the work as long as all references to Project
Gutenberg are removed. Of course, we hope that you will
support the Project Gutenberg™ mission of promoting free
access to electronic works by freely sharing Project Gutenberg™
works in compliance with the terms of this agreement for
keeping the Project Gutenberg™ name associated with the
work. You can easily comply with the terms of this agreement
by keeping this work in the same format with its attached full
Project Gutenberg™ License when you share it without charge
with others.

1.D. The copyright laws of the place where you are located also
govern what you can do with this work. Copyright laws in most
countries are in a constant state of change. If you are outside
the United States, check the laws of your country in addition to
the terms of this agreement before downloading, copying,
displaying, performing, distributing or creating derivative works
based on this work or any other Project Gutenberg™ work. The
Foundation makes no representations concerning the copyright
status of any work in any country other than the United States.

1.E. Unless you have removed all references to Project


Gutenberg:

1.E.1. The following sentence, with active links to, or other


immediate access to, the full Project Gutenberg™ License must
appear prominently whenever any copy of a Project
Gutenberg™ work (any work on which the phrase “Project
Gutenberg” appears, or with which the phrase “Project
Gutenberg” is associated) is accessed, displayed, performed,
viewed, copied or distributed:

This eBook is for the use of anyone anywhere in the United


States and most other parts of the world at no cost and
with almost no restrictions whatsoever. You may copy it,
give it away or re-use it under the terms of the Project
Gutenberg License included with this eBook or online at
www.gutenberg.org. If you are not located in the United
States, you will have to check the laws of the country
where you are located before using this eBook.

1.E.2. If an individual Project Gutenberg™ electronic work is


derived from texts not protected by U.S. copyright law (does not
contain a notice indicating that it is posted with permission of
the copyright holder), the work can be copied and distributed to
anyone in the United States without paying any fees or charges.
If you are redistributing or providing access to a work with the
phrase “Project Gutenberg” associated with or appearing on the
work, you must comply either with the requirements of
paragraphs 1.E.1 through 1.E.7 or obtain permission for the use
of the work and the Project Gutenberg™ trademark as set forth
in paragraphs 1.E.8 or 1.E.9.

1.E.3. If an individual Project Gutenberg™ electronic work is


posted with the permission of the copyright holder, your use and
distribution must comply with both paragraphs 1.E.1 through
1.E.7 and any additional terms imposed by the copyright holder.
Additional terms will be linked to the Project Gutenberg™
License for all works posted with the permission of the copyright
holder found at the beginning of this work.

1.E.4. Do not unlink or detach or remove the full Project


Gutenberg™ License terms from this work, or any files
containing a part of this work or any other work associated with
Project Gutenberg™.

1.E.5. Do not copy, display, perform, distribute or redistribute


this electronic work, or any part of this electronic work, without
prominently displaying the sentence set forth in paragraph 1.E.1
with active links or immediate access to the full terms of the
Project Gutenberg™ License.

1.E.6. You may convert to and distribute this work in any binary,
compressed, marked up, nonproprietary or proprietary form,
including any word processing or hypertext form. However, if
you provide access to or distribute copies of a Project
Gutenberg™ work in a format other than “Plain Vanilla ASCII” or
other format used in the official version posted on the official
Project Gutenberg™ website (www.gutenberg.org), you must,
at no additional cost, fee or expense to the user, provide a copy,
a means of exporting a copy, or a means of obtaining a copy
upon request, of the work in its original “Plain Vanilla ASCII” or
other form. Any alternate format must include the full Project
Gutenberg™ License as specified in paragraph 1.E.1.

1.E.7. Do not charge a fee for access to, viewing, displaying,


performing, copying or distributing any Project Gutenberg™
works unless you comply with paragraph 1.E.8 or 1.E.9.

1.E.8. You may charge a reasonable fee for copies of or


providing access to or distributing Project Gutenberg™
electronic works provided that:

• You pay a royalty fee of 20% of the gross profits you derive
from the use of Project Gutenberg™ works calculated using the
method you already use to calculate your applicable taxes. The
fee is owed to the owner of the Project Gutenberg™ trademark,
but he has agreed to donate royalties under this paragraph to
the Project Gutenberg Literary Archive Foundation. Royalty
payments must be paid within 60 days following each date on
which you prepare (or are legally required to prepare) your
periodic tax returns. Royalty payments should be clearly marked
as such and sent to the Project Gutenberg Literary Archive
Foundation at the address specified in Section 4, “Information
about donations to the Project Gutenberg Literary Archive
Foundation.”

• You provide a full refund of any money paid by a user who


notifies you in writing (or by e-mail) within 30 days of receipt
that s/he does not agree to the terms of the full Project
Gutenberg™ License. You must require such a user to return or
destroy all copies of the works possessed in a physical medium
and discontinue all use of and all access to other copies of
Project Gutenberg™ works.

• You provide, in accordance with paragraph 1.F.3, a full refund of


any money paid for a work or a replacement copy, if a defect in
the electronic work is discovered and reported to you within 90
days of receipt of the work.

• You comply with all other terms of this agreement for free
distribution of Project Gutenberg™ works.

1.E.9. If you wish to charge a fee or distribute a Project


Gutenberg™ electronic work or group of works on different
terms than are set forth in this agreement, you must obtain
permission in writing from the Project Gutenberg Literary
Archive Foundation, the manager of the Project Gutenberg™
trademark. Contact the Foundation as set forth in Section 3
below.

1.F.

1.F.1. Project Gutenberg volunteers and employees expend


considerable effort to identify, do copyright research on,
transcribe and proofread works not protected by U.S. copyright
law in creating the Project Gutenberg™ collection. Despite these
efforts, Project Gutenberg™ electronic works, and the medium
on which they may be stored, may contain “Defects,” such as,
but not limited to, incomplete, inaccurate or corrupt data,
transcription errors, a copyright or other intellectual property
infringement, a defective or damaged disk or other medium, a
computer virus, or computer codes that damage or cannot be
read by your equipment.

1.F.2. LIMITED WARRANTY, DISCLAIMER OF DAMAGES - Except


for the “Right of Replacement or Refund” described in
paragraph 1.F.3, the Project Gutenberg Literary Archive
Foundation, the owner of the Project Gutenberg™ trademark,
and any other party distributing a Project Gutenberg™ electronic
work under this agreement, disclaim all liability to you for
damages, costs and expenses, including legal fees. YOU AGREE
THAT YOU HAVE NO REMEDIES FOR NEGLIGENCE, STRICT
LIABILITY, BREACH OF WARRANTY OR BREACH OF CONTRACT
EXCEPT THOSE PROVIDED IN PARAGRAPH 1.F.3. YOU AGREE
THAT THE FOUNDATION, THE TRADEMARK OWNER, AND ANY
DISTRIBUTOR UNDER THIS AGREEMENT WILL NOT BE LIABLE
TO YOU FOR ACTUAL, DIRECT, INDIRECT, CONSEQUENTIAL,
PUNITIVE OR INCIDENTAL DAMAGES EVEN IF YOU GIVE
NOTICE OF THE POSSIBILITY OF SUCH DAMAGE.

1.F.3. LIMITED RIGHT OF REPLACEMENT OR REFUND - If you


discover a defect in this electronic work within 90 days of
receiving it, you can receive a refund of the money (if any) you
paid for it by sending a written explanation to the person you
received the work from. If you received the work on a physical
medium, you must return the medium with your written
explanation. The person or entity that provided you with the
defective work may elect to provide a replacement copy in lieu
of a refund. If you received the work electronically, the person
or entity providing it to you may choose to give you a second
opportunity to receive the work electronically in lieu of a refund.
If the second copy is also defective, you may demand a refund
in writing without further opportunities to fix the problem.

1.F.4. Except for the limited right of replacement or refund set


forth in paragraph 1.F.3, this work is provided to you ‘AS-IS’,
WITH NO OTHER WARRANTIES OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO WARRANTIES OF
MERCHANTABILITY OR FITNESS FOR ANY PURPOSE.

1.F.5. Some states do not allow disclaimers of certain implied


warranties or the exclusion or limitation of certain types of
damages. If any disclaimer or limitation set forth in this
agreement violates the law of the state applicable to this
agreement, the agreement shall be interpreted to make the
maximum disclaimer or limitation permitted by the applicable
state law. The invalidity or unenforceability of any provision of
this agreement shall not void the remaining provisions.

1.F.6. INDEMNITY - You agree to indemnify and hold the


Foundation, the trademark owner, any agent or employee of the
Foundation, anyone providing copies of Project Gutenberg™
electronic works in accordance with this agreement, and any
volunteers associated with the production, promotion and
distribution of Project Gutenberg™ electronic works, harmless
from all liability, costs and expenses, including legal fees, that
arise directly or indirectly from any of the following which you
do or cause to occur: (a) distribution of this or any Project
Gutenberg™ work, (b) alteration, modification, or additions or
deletions to any Project Gutenberg™ work, and (c) any Defect
you cause.

Section 2. Information about the Mission


of Project Gutenberg™
Project Gutenberg™ is synonymous with the free distribution of
electronic works in formats readable by the widest variety of
computers including obsolete, old, middle-aged and new
computers. It exists because of the efforts of hundreds of
volunteers and donations from people in all walks of life.

Volunteers and financial support to provide volunteers with the


assistance they need are critical to reaching Project
Gutenberg™’s goals and ensuring that the Project Gutenberg™
collection will remain freely available for generations to come. In
2001, the Project Gutenberg Literary Archive Foundation was
created to provide a secure and permanent future for Project
Gutenberg™ and future generations. To learn more about the
Project Gutenberg Literary Archive Foundation and how your
efforts and donations can help, see Sections 3 and 4 and the
Foundation information page at www.gutenberg.org.

Section 3. Information about the Project


Gutenberg Literary Archive Foundation
The Project Gutenberg Literary Archive Foundation is a non-
profit 501(c)(3) educational corporation organized under the
laws of the state of Mississippi and granted tax exempt status
by the Internal Revenue Service. The Foundation’s EIN or
federal tax identification number is 64-6221541. Contributions
to the Project Gutenberg Literary Archive Foundation are tax
deductible to the full extent permitted by U.S. federal laws and
your state’s laws.

The Foundation’s business office is located at 809 North 1500


West, Salt Lake City, UT 84116, (801) 596-1887. Email contact
links and up to date contact information can be found at the
Foundation’s website and official page at
www.gutenberg.org/contact
Section 4. Information about Donations to
the Project Gutenberg Literary Archive
Foundation
Project Gutenberg™ depends upon and cannot survive without
widespread public support and donations to carry out its mission
of increasing the number of public domain and licensed works
that can be freely distributed in machine-readable form
accessible by the widest array of equipment including outdated
equipment. Many small donations ($1 to $5,000) are particularly
important to maintaining tax exempt status with the IRS.

The Foundation is committed to complying with the laws


regulating charities and charitable donations in all 50 states of
the United States. Compliance requirements are not uniform
and it takes a considerable effort, much paperwork and many
fees to meet and keep up with these requirements. We do not
solicit donations in locations where we have not received written
confirmation of compliance. To SEND DONATIONS or determine
the status of compliance for any particular state visit
www.gutenberg.org/donate.

While we cannot and do not solicit contributions from states


where we have not met the solicitation requirements, we know
of no prohibition against accepting unsolicited donations from
donors in such states who approach us with offers to donate.

International donations are gratefully accepted, but we cannot


make any statements concerning tax treatment of donations
received from outside the United States. U.S. laws alone swamp
our small staff.

Please check the Project Gutenberg web pages for current


donation methods and addresses. Donations are accepted in a
number of other ways including checks, online payments and
credit card donations. To donate, please visit:
www.gutenberg.org/donate.

Section 5. General Information About


Project Gutenberg™ electronic works
Professor Michael S. Hart was the originator of the Project
Gutenberg™ concept of a library of electronic works that could
be freely shared with anyone. For forty years, he produced and
distributed Project Gutenberg™ eBooks with only a loose
network of volunteer support.

Project Gutenberg™ eBooks are often created from several


printed editions, all of which are confirmed as not protected by
copyright in the U.S. unless a copyright notice is included. Thus,
we do not necessarily keep eBooks in compliance with any
particular paper edition.

Most people start at our website which has the main PG search
facility: www.gutenberg.org.

This website includes information about Project Gutenberg™,


including how to make donations to the Project Gutenberg
Literary Archive Foundation, how to help produce our new
eBooks, and how to subscribe to our email newsletter to hear
about new eBooks.
Welcome to our website – the perfect destination for book lovers and
knowledge seekers. We believe that every book holds a new world,
offering opportunities for learning, discovery, and personal growth.
That’s why we are dedicated to bringing you a diverse collection of
books, ranging from classic literature and specialized publications to
self-development guides and children's books.

More than just a book-buying platform, we strive to be a bridge


connecting you with timeless cultural and intellectual values. With an
elegant, user-friendly interface and a smart search system, you can
quickly find the books that best suit your interests. Additionally,
our special promotions and home delivery services help you save time
and fully enjoy the joy of reading.

Join us on a journey of knowledge exploration, passion nurturing, and


personal growth every day!

ebookbell.com

You might also like