Dbadmin En11
Dbadmin En11
Database Administration
June 2008
Version 11.0.0
Copyright and trademarks
Copyright © 2008 iAnywhere Solutions, Inc. Portions copyright © 2008 Sybase, Inc. All rights reserved.
This documentation is provided AS IS, without warranty or liability of any kind (unless provided by a separate written agreement between
you and iAnywhere).
You may use, print, reproduce, and distribute this documentation (in whole or in part) subject to the following conditions: 1) you must retain
this and all other proprietary notices, on all copies of the documentation or portions thereof, 2) you may not modify the documentation, 3) you
may not do anything to indicate that you or anyone other than iAnywhere is the author or source of the documentation.
iAnywhere®, Sybase®, and the marks listed at http://www.sybase.com/detail?id=1011207 are trademarks of Sybase, Inc. or its subsidiaries.
® indicates registration in the United States of America.
All other company and product names mentioned may be trademarks of the respective companies with which they are associated.
Contents
Audience
This book is for all users of SQL Anywhere. It is to be used in conjunction with other books in the
documentation set.
● SQL Anywhere 11 - Introduction This book introduces SQL Anywhere 11—a comprehensive
package that provides data management and data exchange, enabling the rapid development of database-
powered applications for server, desktop, mobile, and remote office environments.
● SQL Anywhere 11 - Changes and Upgrading This book describes new features in SQL Anywhere
11 and in previous versions of the software.
● SQL Anywhere Server - Database Administration This book describes how to run, manage, and
configure SQL Anywhere databases. It describes database connections, the database server, database
files, backup procedures, security, high availability, and replication with Replication Server, as well as
administration utilities and options.
● SQL Anywhere Server - Programming This book describes how to build and deploy database
applications using the C, C++, Java, PHP, Perl, Python, and .NET programming languages such as Visual
Basic and Visual C#. A variety of programming interfaces such as ADO.NET and ODBC are described.
● SQL Anywhere Server - SQL Reference This book provides reference information for system
procedures, and the catalog (system tables and views). It also provides an explanation of the SQL
Anywhere implementation of the SQL language (search conditions, syntax, data types, and functions).
● SQL Anywhere Server - SQL Usage This book describes how to design and create databases; how
to import, export, and modify data; how to retrieve data; and how to build stored procedures and triggers.
● MobiLink - Getting Started This book introduces MobiLink, a session-based relational-database
synchronization system. MobiLink technology allows two-way replication and is well suited to mobile
computing environments.
● MobiLink - Client Administration This book describes how to set up, configure, and synchronize
MobiLink clients. MobiLink clients can be SQL Anywhere or UltraLite databases. This book also
describes the Dbmlsync API, which allows you to integrate synchronization seamlessly into your C++
or .NET client applications.
● MobiLink - Server Administration This book describes how to set up and administer MobiLink
applications.
● MobiLink - Server-Initiated Synchronization This book describes MobiLink server-initiated
synchronization, a feature of MobiLink that allows you to initiate synchronization or other remote actions
from the consolidated database.
● QAnywhere This book describes QAnywhere, which is a messaging platform for mobile and wireless
clients, as well as traditional desktop and laptop clients.
● SQL Remote This book describes the SQL Remote data replication system for mobile computing,
which enables sharing of data between a SQL Anywhere consolidated database and many SQL Anywhere
remote databases using an indirect link such as email or file transfer.
● UltraLite - Database Management and Reference This book introduces the UltraLite database
system for small devices.
● UltraLite - C and C++ Programming This book describes UltraLite C and C++ programming
interfaces. With UltraLite, you can develop and deploy database applications to handheld, mobile, or
embedded devices.
● UltraLite - M-Business Anywhere Programming This book describes UltraLite for M-Business
Anywhere. With UltraLite for M-Business Anywhere you can develop and deploy web-based database
applications to handheld, mobile, or embedded devices, running Palm OS, Windows Mobile, or
Windows.
● UltraLite - .NET Programming This book describes UltraLite.NET. With UltraLite.NET you can
develop and deploy database applications to computers, or handheld, mobile, or embedded devices.
● UltraLiteJ This book describes UltraLiteJ. With UltraLiteJ, you can develop and deploy database
applications in environments that support Java. UltraLiteJ supports BlackBerry smartphones and Java
SE environments. UltraLiteJ is based on the iAnywhere UltraLite database product.
● Error Messages This book provides a complete listing of SQL Anywhere error messages together
with diagnostic information.
Documentation conventions
This section lists the typographic and graphical conventions used in this documentation.
Syntax conventions
The following conventions are used in the SQL syntax descriptions:
● Keywords All SQL keywords appear in uppercase, like the words ALTER TABLE in the following
example:
One or more list elements are allowed. In this example, if more than one is specified, they must be
separated by commas.
● Optional portions Optional portions of a statement are enclosed by square brackets.
These square brackets indicate that the savepoint-name is optional. The square brackets should not be
typed.
● Options When none or only one of a list of items can be chosen, vertical bars separate the items and
the list is enclosed in square brackets.
[ ASC | DESC ]
For example, you can choose one of ASC, DESC, or neither. The square brackets should not be typed.
● Alternatives When precisely one of the options must be chosen, the alternatives are enclosed in curly
braces and a bar is used to separate the options.
[ QUOTES { ON | OFF } ]
If the QUOTES option is used, one of ON or OFF must be provided. The brackets and braces should not
be typed.
Limitations or variations in SQL Anywhere are commonly based on the underlying operating system,
and seldom on the particular variant used (Windows Mobile).
● Unix Unless specified, Unix refers to Linux, Mac OS X, and Unix platforms.
In many cases, references to file and directory names are similar on all supported platforms, with simple
transformations between the various forms. To simplify the documentation in these cases, Windows
conventions are used. In other cases, where the details are more complex, the documentation shows all
relevant forms.
Here are the conventions used to simplify the documentation of file and directory names:
● install-dir During the installation process, you choose where to install SQL Anywhere. The
documentation refers to this location using the convention install-dir.
After installation is complete, the environment variable SQLANY11 specifies the location of the
installation directory containing the SQL Anywhere components (install-dir).
For example, the documentation may refer to a file as install-dir\readme.txt. On Windows platforms, this
reference is equivalent to %SQLANY11%\readme.txt. On Unix platforms, this reference is equivalent to
$SQLANY11/readme.txt.
For more information about the default location of install-dir, see “SQLANY11 environment
variable” on page 328.
● Uppercase and lowercase directory names On Windows, directory names often use mixed case.
References to directory names can use any case, since the Windows file system is not case sensitive.
Unix file systems are case sensitive. The use of mixed-case is less common.
The SQL Anywhere installation program follows operating system conventions for its directory structure.
On Windows, the installation contains directories such as Bin32 and Documentation. On Unix, these
directories are called bin32 and documentation.
The documentation often uses the mixed case forms of directory names. Usually, you can convert a
mixed case directory name to lowercase for the equivalent directory name on Unix platforms. For
example, the directory MobiLink is mobilink on Unix platforms.
● Slashes separating parts of directory names The documentation uses backslashes as the
directory separator. For example, the PDF form of the documentation is found in the directory install-dir
\Documentation\en\pdf, which is the Windows form.
On Unix platforms, replace the backslash with the forward slash. The PDF documentation is found in
the directory install-dir/Documentation/en/pdf.
● Executable files The documentation shows executable file names using Windows conventions, with
a suffix such as .exe or .bat. On Unix platforms, executable file names have no suffix.
For example, on Windows, the network database server is dbsrv11.exe. On Unix, Linux, and Mac OS
X, it is dbsrv11.
● samples-dir The installation process allows you to choose where to install the samples that are
included with SQL Anywhere, and the documentation refers to this location using the convention samples-
dir.
After installation is complete, the environment variable SQLANYSAMP11 specifies the location of the
directory containing the samples (samples-dir). From the Windows Start menu, choosing Programs »
SQL Anywhere 11 » Sample Applications And Projects opens a Windows Explorer window in this
directory.
For more information about the default location of samples-dir, by operating system, see “Samples
directory” on page 336.
● Environment variables The documentation refers to setting environment variables. On Windows,
environment variables are referred to using the syntax %ENVVAR%. On Unix, Linux, and Mac OS X,
environment variables are referred to using the syntax $ENVVAR or ${ENVVAR}.
Unix, Linux, and Mac OS X environment variables are stored in shell and login startup files, such
as .cshrc or .tcshrc.
Graphic icons
The following icons are used in this documentation.
● A client application.
● A database. In some high-level diagrams, the icon may be used to represent both the database and the
database server that manages it.
● Replication or synchronization middleware. These assist in sharing data among databases. Examples are
the MobiLink server and the SQL Remote Message Agent.
● A programming interface.
Newsgroup disclaimer
iAnywhere Solutions has no obligation to provide solutions, information, or ideas on its newsgroups, nor is
iAnywhere Solutions obliged to provide anything other than a systems operator to monitor the service and
ensure its operation and availability.
iAnywhere Technical Advisors, as well as other staff, assist on the newsgroup service when they have time
available. They offer their help on a volunteer basis and may not be available on a regular basis to provide
solutions and information. Their ability to help is based on their workload.
Contents
Lesson 1: Make a copy of the sample database ........................................................... 4
Lesson 2: Start the SQL Anywhere database server .................................................... 5
Lesson 3: Display the database server messages window ........................................... 6
Lesson 4: Stop the database server .............................................................................. 8
Summary ....................................................................................................................... 9
For more information about starting the network database server, see “Connecting to a server on a
network” on page 85.
See also
● “Running the database server” on page 29
● “The database server” on page 147
database server is given the name of the first database started. This name can be used by applications
when they connect to a database. See “Naming the server and the databases” on page 37.
● The version and build numbers The numbers following the server name (for example,
11.0.0.1083) are the version and build numbers. The version number represents the specific release of
SQL Anywhere, and the build number relates to the specific instance of the software that was compiled.
● Startup information When a database server starts, it sets aside some memory that it uses when
processing database requests. This reserved memory is called the cache. The amount of cache memory
appears in the window. The cache is organized in fixed-size pages, and the page size also appears in the
window.
● Database information The names of the database file and its transaction log file appear in the
window.
In this case, the startup cache size and page size are the default values. For many purposes, including
those of this tutorial, the default startup options are fine.
To stop the database server running the sample database (Command prompt)
● Run the following command to stop the personal database server running the sample database:
dbstop mydemo11
The Stop Server utility (dbstop) can only be run at a command prompt. See “Stop Server utility
(dbstop)” on page 762.
Tutorial cleanup
Once you have shut down the database server, you can delete the c:\demodb directory and its contents.
Summary
In this tutorial, you learned how to make a copy of the sample database, how to start a database server running
the sample database, and how to view the contents of the database server messages window. You also learned
how to stop the database server.
See also
● “Starting Interactive SQL” on page 613
● “Connecting from Sybase Central, Interactive SQL, or the SQL Anywhere Console
utility” on page 78
● “Running the database server” on page 29
Contents
Overview of database files .......................................................................................... 12
Creating a database .................................................................................................... 14
Using additional dbspaces ........................................................................................... 17
Using the utility database ............................................................................................ 22
Erasing a database ...................................................................................................... 26
If none of these are defined, SQL Anywhere places its temporary file in the current directory on Windows
operating systems, or in the /tmp directory on Unix.
The server creates, maintains, and removes the temporary file. You only need to ensure that there is
enough free space available for the temporary file. You can obtain information about the space available
for the temporary file using the sa_disk_free_space procedure. See “sa_disk_free_space system
procedure” [SQL Anywhere Server - SQL Reference].
Pre-defined dbspaces
SQL Anywhere uses the following pre-defined dbspaces for its databases:
Dbspace Name
You cannot create user-defined dbspaces with these names and you cannot drop the pre-defined dbspaces.
If you upgrade a version 10.0.0 or earlier database with user-defined dbspaces that use the pre-defined
dbspace names, then all references to these dbspaces in SQL statements are assumed to be referring to the
user-defined dbspaces, and not the pre-defined dbspaces. The only way that you can refer to the pre-defined
dbspaces is by dropping the user-defined dbspaces, or renaming them to not use the same names as the pre-
defined dbspaces.
The ALTER DBSPACE statement supports the pre-defined dbspace names so you can add more space to
them. See “ALTER DBSPACE statement” [SQL Anywhere Server - SQL Reference].
The DB_EXTENDED_PROPERTY function also accepts the pre-defined dbspace names. See
“DB_EXTENDED_PROPERTY function [System]” [SQL Anywhere Server - SQL Reference].
Additional files
Other files can also become part of a database system, including:
● Dbspace files You can spread your data over several separate files, in addition to the database file.
See “CREATE DBSPACE statement” [SQL Anywhere Server - SQL Reference].
For information on dbspaces, see “Using additional dbspaces” on page 17.
● Transaction log mirror files For additional security, you can create a mirror copy of the transaction
log. This file typically has the extension .mlg. See “Protecting against media failure on the transaction
log” on page 865.
Creating a database
SQL Anywhere provides a number of ways to create a database: in Sybase Central, in Interactive SQL, and
at the command line. Creating a database is also called initializing it. Once the database is created, you can
connect to it and build the tables and other objects that you need in the database.
Other application design systems, such as Sybase PowerDesigner Physical Data Model, contain tools for
creating database objects. These tools construct SQL statements that are submitted to the database server,
typically through its ODBC interface. If you are using one of these tools, you do not need to construct SQL
statements to create tables, assign permissions, and so on. See “About PowerDesigner Physical Data
Model” [SQL Anywhere 11 - Introduction].
For more information about database design, see “Designing and creating your database” [SQL Anywhere
Server - SQL Usage].
Transaction log
When you create a database, you must decide where to place the transaction log. This log stores all changes
made to a database, in the order in which they are made. In the event of a media failure on a database file,
the transaction log is essential for database recovery. It also makes your work more efficient. By default, it
is placed in the same directory as the database file, but this is not recommended for production use.
For more information about placing the transaction log, see “The transaction log” on page 852.
Tip
You can also access the Create Database Wizard from within Sybase Central using the following methods:
● Selecting a server, and choosing File » Create Database.
● Right-clicking a server, and choosing Create Database.
You can create databases for Windows Mobile by copying a SQL Anywhere database file to the device.
Sybase Central has features to make database creation easy for Windows Mobile databases. If you have
Windows Mobile services installed on your Windows desktop, you have the option to create a Windows
Mobile database when you create a database from Sybase Central. Sybase Central omits some features for
Windows Mobile databases, and optionally copies the resulting database file to your Windows Mobile
device.
When you run a database on Windows Mobile, the database server automatically enables checksums to help
provide early detection if the database file becomes corrupt. See “Using checksums” on page 863.
Example
Create a database file in the c:\temp directory with the file name temp.db.
CREATE DATABASE 'c:\\temp\\temp.db';
The directory path is relative to the database server. You set the permissions required to execute this statement
on the server command line, using the -gu option. The default setting requires DBA authority.
The backslash is an escape character in SQL, and must be doubled in some cases. The \x and \n sequences
can be used to specifying hexadecimal and newline characters. Letters other than n and x do not have any
special meaning if they are preceded by a backslash. Here are some examples where this is important.
CREATE DATABASE 'c:\\temp\\\x41\x42\x43xyz.db';
The initial \\ sequence represents a backslash. The \x sequences represent the characters A, B, and C,
respectively. The file name here is ABCxyz.db.
CREATE DATABASE 'c:\temp\\nest.db';
To avoid having the \n sequence interpreted as a newline character, the backslash is doubled.
See “Escape sequences” [SQL Anywhere Server - SQL Reference].
See also
● “Initialization utility (dbinit)” on page 703
When you initialize a database, it contains one database file. This first database file is called the main file.
All database objects and all data are placed, by default, in the main file.
A dbspace is an additional database file that creates more space for data. A database can be held in up to 13
separate files (the main file and 12 dbspaces). Each table, together with its indexes, must be contained in a
single database file. The SQL command CREATE DBSPACE adds a new file to the database.
Temporary tables can only be created in the temporary dbspace.
There are several ways to specify the dbspace where a base table or other database object is created. In the
following lists, the location specified by methods occurring earlier in the list take precedence over those
occurring later in the list.
1. IN DBSPACE clause (if specified)
2. default_dbspace option (if set)
3. system dbspace
If a dbspace name contains a period and is not quoted, the database server generates an error for the name.
Each database file has a maximum allowable size of 228 (approximately 268 million) database pages. For
example, a database file created with a database page size of 4 KB can grow to a maximum size of one
terabyte (228*4 KB). However, in practice, the maximum file size allowed by the physical file system in
which the file is created affects the maximum allowable size significantly.
While many commonly-employed file systems restrict file size to a maximum of 2 GB, some, such as the
Windows file system using the NTFS file system, allow you to exploit the full database file size. In scenarios
where the amount of data placed in the database exceeds the maximum file size, it is necessary to divide the
data into more than one database file. As well, you may want to create multiple dbspaces for reasons other
than size limitations, for example, to cluster related objects.
For information about the maximum file size allowed on the supported operating systems, see “SQL
Anywhere size and number limitations” on page 588.
You can use the sa_disk_free system procedure to obtain information about space available for a dbspace.
See “sa_disk_free_space system procedure” [SQL Anywhere Server - SQL Reference].
The SYSDBSPACE system view contains information about all the dbspaces for a database. See
“SYSDBSPACE system view” [SQL Anywhere Server - SQL Reference].
Permissions on dbspaces
SQL Anywhere supports permissions on dbspaces. Only the CREATE permission is supported. The
CREATE permission allows a user to create database objects in the specified dbspace. You can grant
CREATE permission for a dbspace by executing a GRANT CREATE statement. See “GRANT
statement” [SQL Anywhere Server - SQL Reference].
Dbspace permissions behave as follows:
● A user trying to create a new object with underlying data must have CREATE permission on the dbspace
where the data is being placed.
● Even if a GRANT CREATE ON statement was issued, the user (grantee) must have RESOURCE
authority to create new database objects.
● The current list of objects that can be placed in specific dbspaces, and that require the CREATE
permission, includes tables, indexes, text indexes, and materialized views. Note that objects such as
normal views and procedures do not have any underlying data and do not require the CREATE
permission.
● A user can be granted the CREATE permission directly, or they can inherit the permission through
membership in a group that has been granted the permission.
● It is possible to grant PUBLIC the CREATE permission on a specific dbspace, in which case any user
who also has RESOURCE authority can create objects on the dbspace.
● A newly-created dbspace automatically grants CREATE permission on itself to PUBLIC.
● It is possible to revoke permissions, for example when trying to secure a dbspace. Permissions on the
internal dbspaces system and temporary can also be managed to control access.
● Creating local temporary tables does not require any permissions; dbspace permissions do not affect the
creation of local temporary tables. However, the creation of global temporary tables requires
RESOURCE authority and CREATE permission on the temporary dbspace.
See also
● “CREATE DBSPACE statement” [SQL Anywhere Server - SQL Reference]
● “DB_EXTENDED_PROPERTY function [System]” [SQL Anywhere Server - SQL Reference]
● “CREATE TABLE statement” [SQL Anywhere Server - SQL Reference]
● “UNLOAD statement” [SQL Anywhere Server - SQL Reference]
Creating a dbspace
You create a new database file, or dbspace, either from Sybase Central, or using the CREATE DBSPACE
statement. The database file for a new dbspace may be on the same disk drive as the main file or on another
disk drive. You must have DBA authority to create dbspaces.
For each database, you can create up to twelve dbspaces in addition to the main dbspace. You can specify
the dbspace in which an object is stored by setting the default_dbspace database option.
Examples
The following command creates a new dbspace called MyLibrary in the file library.db in the same directory
as the main file:
CREATE DBSPACE MyLibrary
AS 'library.db';
The following command creates a table LibraryBooks and places it in the MyLibrary dbspace.
CREATE TABLE LibraryBooks (
title CHAR(100),
author CHAR(50),
isbn CHAR(30)
) IN MyLibrary;
The following commands create a new dbspace named MyLibrary, set the default dbspace to the MyLibrary
dbspace, and then create the LibraryBooks table in the MyLibrary dbspace.
CREATE DBSPACE MyLibrary
AS 'e:\\dbfiles\\library.db';
SET OPTION default_dbspace = 'MyLibrary';
CREATE TABLE LibraryBooks (
title CHAR(100),
author CHAR(50),
isbn CHAR(30),
);
See also
● “CREATE DBSPACE statement” [SQL Anywhere Server - SQL Reference]
● “default_dbspace option [database]” on page 469
● “Creating tables” [SQL Anywhere Server - SQL Usage]
● “CREATE INDEX statement” [SQL Anywhere Server - SQL Reference]
Performance tip
Running a disk defragmentation utility after pre-allocating disk space helps ensure that the database file is
not fragmented over many disjointed areas of the disk drive. Performance can suffer if there is excessive
fragmentation of database files.
Examples
Increase the size of the system dbspace by 200 pages.
See also
● “Creating a dbspace” on page 18
● “ALTER DBSPACE statement” [SQL Anywhere Server - SQL Reference]
Deleting a dbspace
You can delete a dbspace using either Sybase Central or the DROP DBSPACE statement. Before you can
delete a dbspace, you must delete all tables and indexes that use the dbspace. You must have DBA authority
to delete a dbspace.
To delete a dbspace (Sybase Central)
1. Open the Dbspaces folder.
2. Right-click the dbspace and choose Delete.
See also
● “Dropping tables” [SQL Anywhere Server - SQL Usage]
● “DROP statement” [SQL Anywhere Server - SQL Reference]
For information about connection and server properties, see “Understanding database
properties” on page 538.
For the personal database server, if -su is not specified, then there are no security restrictions for connecting
to the utility database. For the personal server, you must specify the user ID DBA. You must also specify a
password, but it can be any password. It is assumed that anybody who can connect to the personal database
server can access the file system directly so no attempt is made to screen users based on passwords.
To avoid typing the utility database password in plain text, when using the -su option, you can create a file
that contains the password and then obfuscate it using the dbfhide utility. For example, suppose the file
named util_db_pwd.cfg contains the utility database password. You could obfuscate this file using dbfhide
and rename it to util_db_pwd_hide.cfg:
dbfhide util_db_pwd.cfg util_db_pwd_hide.cfg
The util_db_pwd_hide.cfg file can then be used to specify the utility database password:
dbsrv11 -su @util_db_pwd_hide.cfg -n my_server c:\mydb.db
Note
The util_db.ini file is deprecated. You should use the -su server option to specify the password for the utility
database's DBA user. See “-su server option” on page 212.
For additional security, the -su option can be used to specify the utility database password.
2. Start Interactive SQL.
3. In the Connect window, type DBA for the User ID, and type any non-blank password. The password
itself is not checked, but the field must not be empty.
4. On the Database tab, enter utility_db as the Database Name and TestEng as the Server Name.
5. Click OK to connect.
Interactive SQL connects to the utility database on the personal server named TestEng.
4. On the Database tab, enter utility_db as the Database Name and TestEng as the Server Name.
5. Click OK to connect.
Interactive SQL connects to the utility database on the network server named TestEng.
See “Connecting to a database” on page 73 and “-su server option” on page 212.
Note
When you are connected to the utility database, executing REVOKE CONNECT FROM DBA disables
future connections to the utility database. This means that no future connections can be made to the utility
database unless you use a connection that existed before the REVOKE CONNECT was done, or restart the
database server. See “REVOKE statement” [SQL Anywhere Server - SQL Reference].
Note
Because the use of the util_db.ini file is deprecated, it is recommended that you use the -su server option to
specify the DBA user's password for the utility database.
Using util_db.ini relies on the physical security of the computer hosting the database server since the
util_db.ini file can be easily read using a text editor.
For the network server, by default you cannot connect to the utility database without specifying -su or using
util_db.ini. If you use util_db.ini, the file holds the password and is located in the same directory as the
database server executable and contains the text:
[UTILITY_DB]
PWD=password
To protect the contents of the util_db.ini file from casual direct access, you can add simple encryption to the
file using the File Hiding utility (dbfhide). You can also use operating system features to limit access to the
server file system.
For more information about obfuscating .ini files, see “Hiding the contents of .ini files” on page 698.
all Anyone can execute file adminis- Any database including utility
tration statements database
none No one can execute file adminis- Any database including utility
tration statements database
DBA Only users with DBA authority can Any database including utility
execute file administration state- database
ments
utility_db Only the users who can connect to Only the utility database
the utility database can execute file
administration statements
Examples
To prevent the use of the file administration statements, start the database server using the none permission
level of the -gu option. The following command starts a database server and names it TestSrv. It loads the
mytestdb.db database, but prevents anyone from using that server to create or delete a database, or execute
any other file administration statement regardless of their resource creation rights, or whether or not they
can load and connect to the utility database.
dbsrv11 -n TestSrv -gu none c:\mytestdb.db
To permit only the users knowing the utility database password to execute file administration statements,
start the server by running the following command.
dbsrv11 -n TestSrv -su secret -gu utility_db
The following command starts Interactive SQL as a client application, connects to the server named TestSrv,
loads the utility database, and connects the user.
dbisql -c "UID=DBA;PWD=secret;DBN=utility_db;ENG=TestSrv"
Having executed the above command successfully, the user connects to the utility database, and can execute
file administration statements.
Erasing a database
Erasing a database deletes all tables and data from disk, including the transaction log that records alterations
to the database. All database files are read-only to prevent accidental modification or deletion of database
files. By default, you need DBA authority to erase a database. You can change the required permissions by
using the database server -gu option. See “-gu server option” on page 188.
In Sybase Central, you can erase a database using the Erase Database Wizard.
In Interactive SQL, you can erase a database using the DROP DATABASE statement.
You can also erase a database from a command line with the dberase utility. However, the dberase utility
does not erase dbspaces. If you want to erase a dbspace, you can do so with the DROP DATABASE statement
or using the Erase Database Wizard in Sybase Central.
The database to be erased must not be running when the dberase utility, the Erase Database Wizard, or
DROP DATABASE statement is used. You must be connected to a database to drop another database.
For information about connecting to the utility database, see “Connecting to the utility
database” on page 22.
Windows Mobile databases must be erased manually. See “Erasing a Windows Mobile
database” on page 1069.
To erase a database (Sybase Central)
1. Choose Tools » SQL Anywhere 11 » Erase Database.
2. Follow the instructions in the wizard.
Tip
You can also access the Erase Database Wizard from within Sybase Central by using any of the following
methods:
● Selecting a database server, and choosing File » Erase Database.
● Right-clicking a server, and choosing Erase Database.
Contents
Introduction to running SQL Anywhere database servers ........................................... 30
Starting the database server ....................................................................................... 33
Some common options ................................................................................................ 37
Stopping the database server ...................................................................................... 48
Starting and stopping databases ................................................................................. 49
Running the server outside the current session .......................................................... 52
Troubleshooting server startup .................................................................................... 63
Running authenticated SQL Anywhere applications ................................................... 65
Error reporting in SQL Anywhere ................................................................................ 71
Server differences
The request-processing engine is identical in both the personal and network servers. Each one supports
exactly the same SQL, and exactly the same database features. A database created with a personal database
server can be used with a network database server and vice versa. The main differences include:
● Network protocol support Only the network server supports communications across a network.
● Number of connections The personal server has a limit of ten simultaneous connections. The limit
for the network server depends on your license. See “Server Licensing utility (dblic)” on page 745.
● Number of CPUs With per-seat licensing, the network database server uses all CPUs available on
the computer (the default). With CPU-based licensing, the network database server uses only the number
of processors you are licensed for. In addition, the personal database server and runtime database server
are both limited to a single processor.
● Startup defaults To reflect their use as a personal server and a network server for many users, the
startup defaults are slightly different for each.
If you are running a SQL Anywhere network server, you must have appropriate networking software installed
and running.
The SQL Anywhere network server is available for Windows, Linux, and Unix operating systems.
SQL Anywhere supports the TCP/IP network protocol.
First steps
You can start a personal server running a single database in several ways:
● On Windows, from the Start menu, choose Programs » SQL Anywhere 11 » SQL Anywhere »
Personal Server Sample.
● Execute the following command in the directory where demo.db is located to start both a personal server
and a database called demo.db:
dbeng11 demo
● Use a database file name in a connection string.
See “Connecting to an embedded database” on page 84.
There are slight variations in how you specify the basic command from platform to platform.
Notes
● Except where otherwise noted, these commands start the personal server (dbeng11). To start a network
server, replace dbeng11 with dbsrv11.
● If the database file is in the starting directory for the command, you do not need to specify path.
● If you do not specify a file extension in database-file, the extension .db is assumed.
To start the personal database server using default options (Windows except Windows
Mobile)
● Run the following command:
dbeng11 path\database-file
If you omit the database file, the Server Startup Options window appears where you can locate a
database file by clicking Browse.
For more information about starting a database server on Windows Mobile, see “Connecting to a database
running on a Windows Mobile device” on page 1057.
If you supply no options and no database file, then on Windows operating systems a window appears,
allowing you to browse to your database file.
The elements of the database server command include the following:
● Executable The personal server (dbeng11) or the network server (dbsrv11).
For more information about the executable names on different operating systems, see “Introduction to
running SQL Anywhere database servers” on page 30.
● Server options These options control the behavior of the database server for all running databases.
● Database file You can specify zero, one, or more database file names. Each of these databases starts
and remains available for applications.
Caution
The database file and the transaction log file must be located on the same physical computer as the
database server or accessed via a SAN or iSCSI configuration. Database files and transaction log files
located on a remote network directory can lead to poor performance, data corruption, and server
instability.
For more information, see http://www.sybase.com/detail?id=1034790.
For best results, the transaction log should be kept on a different disk from the database files. See “The
transaction log” on page 852.
● Database options For each database file you start, you can provide database options that control
certain aspects of its behavior. See “The SQL Anywhere database server” on page 148.
Case sensitivity
Database and server options are generally case sensitive. You should enter all options in lowercase.
See also
● “-o server option” on page 197
● “-oe server option” on page 197
● “-on server option” on page 198
● “-os server option” on page 199
● “-ot server option” on page 200
You can control the size of the database server message log file, and specify what you want done when a
file reaches its maximum size:
● Use the -o option to specify that a database server message log file should be used and to provide a name.
● Use the -ot option to specify that a database server message log file should be used and provide a name
when you want the previous contents of the file to be deleted before messages are sent to it.
● In addition to -o or -ot, use the -on option to specify the size at which the database server message log
file is renamed with the extension .old and a new file is started with the original name.
● In addition to -o or -ot, use the -os option to specify the size at which a new database server message log
file is started with a new name based on the date and a sequential number.
You can specify a separate file where startup errors, fatal errors, and assertions are logged using the -oe
option.
It is recommended that you do not end the database server message log file name with .log because this can
create problems for utilities that perform operations using the transaction log.
See also
● “-o server option” on page 197
● “-oe server option” on page 197
● “-on server option” on page 198
● “-os server option” on page 199
● “-ot server option” on page 200
For example, if the EventLogMask key is set to 0, no messages appear. When you set this key to 1,
informational and warning messages do not appear, but errors do. The default setting (no entry present) is
for all message types to appear.
When changing the setting of the EventLogMask key, you must restart the database server for the change
to take effect.
See also
● “Network protocol options” on page 286
In the example, samples-dir is the name of your SQL Anywhere samples directory. On Unix, you would use
a forward slash instead of the backslash in the file path.
For information about samples-dir, see “Samples directory” on page 336.
If you name the file sample.cfg, you could use these options as follows:
dbeng11 @sample.cfg
See also
● “@data server option” on page 156
● “Using configuration files” on page 669
If you supply a server name, you can start a database server without starting a database. The following
command starts a server named Galt with no database started:
dbeng11 -n Galt
Note
On Windows and Unix, version 9.0.2 and earlier clients cannot connect to version 10.0.0 and later database
servers with names longer than the following lengths:
● 40 bytes for Windows shared memory
● 31 bytes for Unix shared memory
● 40 bytes for TCP/IP
Naming databases
You may want to provide a meaningful database name for users of client applications. The database is
identified by that name until it is stopped. The maximum length for database names is 250 bytes.
If you don't provide a database name, the default name is the root of the database file name (the file name
without the .db extension). For example, in the following command the first database is named mydata, and
the second is named mysales.
dbeng11 c:\mydata.db c:\sales\mysales.db
You can name databases by supplying a -n option following the database file. For example, the following
command starts the sample database and names it MyDB:
dbeng11 samples-dir\demo.db -n MyDB
Case sensitivity
Server names and database names are case insensitive as long as the character set is single-byte. See
“Connection strings and character sets” on page 356.
For more information about performance tuning, see “Monitoring and improving performance” [SQL
Anywhere Server - SQL Usage].
For more information about controlling cache size, see “-c server option” on page 158.
On Windows and Unix, the database server automatically takes more memory for use in the cache as
needed, as determined by a heuristic algorithm. See “Use the cache to improve performance” [SQL
Anywhere Server - SQL Usage].
You can use database options to configure the upper cache limit. See “-ch server option” on page 161.
As well, you can force the cache to remain at its initial amount. See “-ca server option” on page 159.
● Multiprogramming level The database server's multiprogramming level is the maximum number of
server tasks that can execute concurrently. In general, a higher multiprogramming level increases the
overall throughput of the server by permitting more requests to execute simultaneously. However, if the
requests compete for the same resources, increasing the multiprogramming level can lead to additional
contention and actually increase transaction response time.
In some cases, increasing the multiprogramming level can even lower the system's throughput. You can
set the server's multiprogramming level with the -gn option. See “-gn server option” on page 183 and
“Setting the database server's multiprogramming level” on page 44.
● Number of processors If you are running on a multi-processor computer using a network database
server, you can set the number of processors with the -gt option. See “-gt server option” on page 186
and “Threading in SQL Anywhere” on page 41.
● Other performance-related options There are several options available for tuning network
performance, including -gb (database process priority), and -u (buffered disk I/O). See “The SQL
Anywhere database server” on page 148.
● Bulk load This is useful when loading large quantities of data into a database using the Interactive
SQL INPUT command. Do not use the -b option if you are using LOAD TABLE to bulk load data. See
“-b server option” on page 157, and “Importing and exporting data” [SQL Anywhere Server - SQL
Usage].
● Starting without a transaction log Use the -f database option for recovery—either to force the
database server to start after the transaction log has been lost, or to force the database server to start using
a transaction log it would otherwise not find. Note that -f is a database option, not a server option.
Once the recovery is complete, you should stop your server and restart without the -f option. See “-f
recovery option” on page 174.
● Operating quietly The database server supports quiet mode. You determine how quiet you want the
server to operate, ranging from suppressing messages or the icon in the system tray, to complete silence.
To operate a completely silent database server on Windows, specify the -qi, -qs, and -qw options. With
these options set, there is no visual indication that the server is running as all icons and all possible startup
error messages are suppressed. If you run the database server in quiet mode, you can use either (or both)
the -o or -oe options to diagnose errors.
Note that the -qi and -qs options do not suppress windows caused by the -v (version) and -ep (prompt
for database encryption password) server options.
See also
● “Controlling threading behavior” on page 43
● “Parallelism during query execution” [SQL Anywhere Server - SQL Usage]
● “-gn server option” on page 183
● “-gtc server option” on page 187
● “sa_clean_database system procedure” [SQL Anywhere Server - SQL Reference]
● “Transaction blocking and deadlock” [SQL Anywhere Server - SQL Usage]
Tasks on Unix
On Unix, a task is executed directly on an operating system thread. On these platforms, the value of the -gn
option sets the number of operating system threads created when the database server starts; all tasks are
serviced from this set of threads. When a thread becomes available, it picks up the next available task that
requires processing. Once processing a task, a thread remains with that task until it has been completed. If
the task needs to block for some reason, perhaps because it is pending an I/O operation, or while waiting for
a lock, the thread voluntarily relinquishes control of the CPU back to the operating system scheduler allowing
other threads to run on that CPU.
In addition to voluntarily relinquishing the CPU, a thread may be preempted by the operating system
scheduler. Each application thread within a process is given a series of time slices in which to run, the length
of which is determined by its priority and other system factors. When a thread reaches the end of its current
time slice it is preempted by the operating system and scheduled to run again at a later time. The operating
system scheduler then chooses another thread to execute for a time slice. This preemptive scheduling does
not affect the processing of tasks in any visible way; when a thread is scheduled to run again, the task is
picked up at the point where it left off.
Once processing of the active task is completed, the thread checks to see if any other tasks have come
available for processing. If so, it picks up the next available task and continues. Otherwise, it relinquishes
the CPU and waits for a new task to arrive at the database server.
See also
● “-gn server option” on page 183
a kernel context switch. If a fiber blocks and does not yield control, it blocks the thread that is hosting it and
prevents other fibers from running on that thread. If more than one thread is hosting fibers, only the thread
that is hosting the waiting fiber is blocked: other threads are still free to run fibers.
On platforms that support fibers, there are at least as many fibers created as required by the maximum
concurrency setting of the server, as specified by the -gn option. The server may create more than this value
so there is always a fiber available to service internal server tasks. See “-gn server option” on page 183.
Threading tips
● Increasing -gn can reduce the chance of thread deadlock occurring. See “-gn server
option” on page 183.
● Setting -gt to 1 can help work around concurrency problems. See “-gt server option” on page 186.
● Investigating the Performance Monitor readings for Requests: Active and Requests: Unscheduled can
help you determine an appropriate value for -gn on Windows. If the number of active requests is always
less than -gn, you can lower -gn. If the number of total requests (active + unscheduled) is often larger
than -gn, then you might want to increase the value for -gn. See “Performance Monitor statistics” [SQL
Anywhere Server - SQL Usage], and “-gn server option” on page 183.
It can be difficult to determine when to raise or lower the multiprogramming level. For example, if a database
application makes use of Java stored procedures, or if intra-query parallelism is enabled, then the additional
server tasks created to process these requests may exceed the multiprogramming limit, and execution of
these tasks will wait until another request completes. In this case, raising the multiprogramming level may
be appropriate. In many cases, increases to the multiprogramming level will correspondingly increase the
database server's overall throughput, as doing so permits additional tasks (requests) to execute concurrently.
However, there are tradeoffs in raising the multiprogramming level that should be considered. They include
the following:
● Increased contention By increasing the number of concurrent tasks, you may increase the
probability of contention between active requests. The contention can involve resources such as schema
or row locks, or on data structures and/or synchronization primitives internal to the database server. Such
a situation may actually decrease server throughput.
● Additional server overhead Each active task requires the allocation and maintenance of a thread
(in the case of Windows and Linux, a lightweight thread called a fiber) and additional bookkeeping
structures to control its scheduling. In addition, each active task requires the preallocation of address
space for its execution stack. The size of the stack varies by platform, but is roughly 1 MB on 32-bit
platforms, and larger on 64-bit platforms. On Windows systems, the allocation of stack space affects the
address space of the server process, but the stack memory is allocated on demand. On Unix platforms,
including Linux, the backing memory for the stack is allocated immediately. Hence, setting a higher
multiprogramming level increases the server's memory footprint, and reduces the amount of memory
available for the cache because the amount of available address space is reduced.
● Thrashing The database server can reach a state when it uses significant resources simply to manage
its execution overhead, rather than doing useful work for a specific request. This state is commonly called
thrashing. Thrashing can occur, for example, when too many active requests are competing for space in
the database cache, but the cache is insufficiently large to accommodate the working set of database
pages used by the set of active requests. This situation can result in page stealing, in a manner similar to
that which can occur with operating systems.
● Impact on query processing The database server selects a maximum number of memory-intensive
requests that can be processed concurrently. Even if you increase the database server's multiprogramming
level, requests may need to wait for memory to become available. See “The memory governor” [SQL
Anywhere Server - SQL Usage].
● Memory for data structures The database server uses resources to parse and optimize statements.
For very complex statements or small cache sizes, the memory consumed for server data structures can
exceed the amount that is available. A memory governor limits the amount of memory used for each
task’s server data structures. Each task has the following limit:
(3/4 maximum cache size) / (number of currently active tasks)
Reducing the database server's multiprogramming level by lowering the number of concurrently-executing
tasks usually lowers the server's throughput. However, lowering the multiprogramming level may improve
the response time of individual requests because there are fewer requests to compete for resources, and there
is a lower probability of lock contention.
In SQL Anywhere, threads (fibers) execute tasks in a cooperative fashion. Once a task has completed, the
thread (fiber) is free to pick up the next task awaiting execution. However, if a task is blocked, for example
when waiting for row lock, the thread (fiber) is also blocked.
When the multiprogramming level is set too low, thread deadlock can occur. Suppose that the database
server has n threads (fibers). Thread deadlock occurs when n-1 threads are blocked, and the last thread is
about to block. The database server's kernel cannot permit this last thread to block, since doing so would
result in all threads being blocked, and the server would hang. Rather, the database server ends the task that
is about to block the last thread with SQLSTATE 40W06.
If the multiprogramming level is at a reasonable level for the workload, the occurrence of thread deadlock
is symptomatic of an application design problem that results in substantial contention, and consequently
impairs scalability. One example is a table that every application must modify when inserting new data to
the database. This technique is often used as part of a scheme to generate primary keys. However, the
consequence is that it effectively serializes all of the application's insert transactions. When the rate of insert
transactions becomes higher than what the server can service because of the serialization on the shared table,
thread deadlock usually occurs.
It is recommended that you experiment with your application's workload to analyze the effects of the server's
multiprogramming level on server throughput and request response time. Various performance counters are
available as either property functions, or through the Windows Performance Monitor on Windows, to help
you analyze database server behavior when testing your application. The performance counters related to
active and unscheduled requests are particularly important to this analysis.
If the number of active requests is always less than the value of the -gn database server option, you can
consider lowering the multiprogramming level, but you must take into account the effects of intra-query
parallelism, which adds additional tasks to the server's execution queues. If the effect of intra-query
parallelism is marginal, lowering the multiprogramming level can be done safely without reducing overall
system throughput. However, if the number of total requests (active + unscheduled) is often larger than -gn,
then an increase in the multiprogramming level may be warranted, subject to the tradeoffs outlined above.
Note that the Performance Monitor is not available for Unix or Linux.
For information about securing shared memory connections on Unix, see “Security tips” on page 950.
Specifying protocols
By using the -x option, you can instruct a database server to use only some of the available network protocols.
The following command starts the sample database using the TCP/IP protocol:
dbsrv11 -x "tcpip" samples-dir\demo.db
Although not strictly required in this example, the quotes are necessary if there are spaces in any of the
arguments to -x.
You can add additional parameters to tune the behavior of the server for each protocol. For example, the
following command (typed all on one line) instructs the server to use two network cards, one with a specified
port number.
dbsrv11 -x "tcpip(MyIP=192.75.209.12:2367,192.75.209.32)" samples-dir\demo.db
For more information about available network protocol options that can be used with the -x option, see
“Network protocol options” on page 286.
Example
To stop a server using the dbstop utility
1. Start a server. For example, the following command executed from the SQL Anywhere installation
directory starts a server named Ottawa using the sample database:
dbsrv11 -n Ottawa samples-dir\demo.db
2. Stop the server using dbstop:
dbstop -c "ENG=Ottawa;UID=DBA;PWD=sql"
Caution
The database file must be on the same computer as the database server. Managing a database file that is
located on a network drive can lead to file corruption.
Limitations
● The server holds database information in memory using pages of a fixed size. Once a server has been
started, you cannot start a database that has a larger page size than the server.
See “Setting a maximum page size” on page 40.
● The -gd server option decides the permissions required to start databases.
Starting a database
With both Sybase Central and Interactive SQL, you can start a database without connecting to it.
To start a database on a server without connecting (Sybase Central)
1. Select the server and then choose File » Start Database.
2. In the Start Database window, enter the required values.
The database appears under the database server as a disconnected database.
Start the database file c:\temp\temp.db on the database server named sample.
START DATABASE 'c:\\temp\\temp.db'
AS tempdb ON 'sample'
AUTOSTOP OFF;
Stopping a database
You can stop a database by:
● Disconnecting from a database started by a connection string. Unless you explicitly set the AutoStop
(ASTOP) connection parameter to NO, this happens automatically.
See “AutoStop connection parameter [ASTOP]” on page 251.
● Using the STOP DATABASE statement from Interactive SQL or embedded SQL.
See “STOP DATABASE statement” [SQL Anywhere Server - SQL Reference].
With both Sybase Central and Interactive SQL, you can stop a database running on a database server. You
cannot stop a database you are currently connected to. You must first disconnect from the database, and then
stop it. You must be connected to another database on the same database server to stop a database.
For more detailed information about stopping a database, see “Running the database server” on page 29.
To stop a database on a server after disconnecting (Sybase Central)
1. Make sure you are connected to at least one other database on the same database server. If there is no
other database running on the server, you can connect to the utility database.
2. Select the database you want to stop and choose File » Stop Database.
When disconnecting from the database, the database may disappear from the left pane. This occurs if your
connection was the only remaining connection, and if AUTOSTOP was specified when the database was
started. AUTOSTOP causes the database to be stopped automatically when the last connection disconnects.
To stop a database on a server after disconnecting (SQL)
1. If you aren't connected to any database on the server, then connect to a database such as the utility
database.
2. Execute a STOP DATABASE statement.
Example
The following statements connect to the utility database and stops the tempdb database.
CONNECT to 'TestEng' DATABASE utility_db
AS conn2
USER 'DBA'
IDENTIFIED BY 'sql';
STOP DATABASE tempdb;
See also
● “Connecting to the utility database” on page 22
In addition to creating services for SQL Anywhere database servers, you can also create Windows services
for the following executables:
● SQL Anywhere Log Transfer Manager (LTM)
● SQL Remote Message Agent (dbremote)
● MobiLink server (mlsrv11)
● MobiLink synchronization client (dbmlsync)
● SQL Anywhere Broadcast Repeater (dbns11)
● Listener utility (dblsn)
See also
● “Service utility (dbsvc) for Windows” on page 748
You can run the Unix database server as a daemon in one of the following ways:
1. Use the -ud option when starting the database server. For example:
One advantage of using dbspawn is that the dbspawn process does not shut down until it has confirmed
that the daemon has started and is ready to accept requests. If for any reason the daemon fails to start,
the exit code for dbspawn will be non-zero.
When you start the daemon directly using the -ud option, the dbeng11 and dbsrv11 commands create
the daemon process and return immediately (exiting and allowing the next command to be executed)
before the daemon initializes itself or attempts to open any of the databases specified in the command.
If you want to ensure that a daemon is running one or more applications that will use the database server,
you can use dbspawn to ensure that the daemon is running before starting the applications. The following
is an example of how to test this using a csh script.
#!/bin/csh
# start the server as a daemon and ensure that it is
# running before you start any applications
dbspawn dbsrv11 demo
if ( $status != 0 ) then
echo Failed to start demo server
exit
endif
# ok, now you can start the applications
...
This example uses an sh script to test whether the daemon is running before starting the applications.
#!/bin/sh
# start the server as a daemon and ensure that it is
# running before you start any applications
dbspawn dbsrv11 demo
if [ $? != 0 ]; then
echo Failed to start demo server
exit
fi
# ok, now you can start the applications
...
3. Spawn a daemon from within a C program, for example:
...
if( fork() == 0 ) {
/* child process = start server daemon */
execl( "/opt/sqlanywhere11/bin/dbsrv11",
"dbsrv11", "-ud", "demo" );
exit(1);
}
/* parent process */
...
See also
● “-ud server option” on page 217
● “Start Server in Background utility (dbspawn)” on page 760
Advantages of services
Installing an application as a Windows service enables it to run even when you log off.
When you start a service, it logs on using a special system account called LocalSystem (or another account
that you specify). Since the service is not tied to the user ID of the person starting it, the service remains
open even when the person who started it logs off. You can also configure a service to start automatically
when the Windows computer starts, before a user logs on.
Managing services
Sybase Central provides a more convenient and comprehensive way of managing SQL Anywhere services
than the Windows services manager. You can also use the dbsvc utility to create and modify services. See
“Service utility (dbsvc) for Windows” on page 748.
Not all of these applications are supplied in all editions of SQL Anywhere.
The service icons in Sybase Central display the current state of each service using an icon that indicates
whether the service is running or stopped.
Tip
You can also create services for the MobiLink plug-in. See “Running the MobiLink server outside the current
session” [MobiLink - Server Administration].
Notes
● Service names must be unique within the first eight characters.
● If you choose to start a service automatically, it starts whenever the computer starts Windows. If you
choose to start the service manually, you need to start the service from Sybase Central each time. You
may want to select Disabled if you are setting up a service for future use.
● When creating a service in Sybase Central, type options for the executable, without the executable name
itself, in the window. For example, if you want a network server to run using the sample database with
a cache size of 20 MB and the name myserver, you would type the following in the Parameters text
box of the Create Service Wizard in Sybase Central:
-c 20M
-n myserver samples-dir\demo.db
dbsvc -y -d myserv
See also
● “Service utility (dbsvc) for Windows” on page 748
In addition to the options, services accept other parameters that specify the account under which the service
runs and the conditions under which it starts.
To change the parameters for a service
1. In the left pane, select SQL Anywhere 11.
2. In the right pane, select the service you want to change.
3. From the File menu, choose Properties.
4. Alter the parameters as needed on the tabs of the Service Properties window.
5. Click OK when finished.
Changes to a service configuration take effect the next time someone starts the service. The Startup option
is applied the next time Windows is started.
Specifying options
The options for a service are the same as those for the executable.
Caution
The Configuration tab of the Service Properties window provides a Parameters textbox for specifying
options for a service. Do not type the name of the program executable in this box.
Examples
To start a network server service with a cache size of 20 MB, named my_server running two databases, you
would type the following in the Parameters field:
-c 20M
-n my_server
c:\db_1.db
c:\db_2.db
To start a SQL Remote Message Agent service connecting to the sample database as user ID DBA, you
would type the following:
-c "UID=DBA;PWD=sql;DBN=demo"
Databases can be started on running servers by client applications, such as Interactive SQL.
For more information about starting a database from Interactive SQL, see “START DATABASE
statement” [SQL Anywhere Server - SQL Reference].
For more information about how to implement this function in an embedded SQL application, see
“db_start_database function” [SQL Anywhere Server - Programming].
Starting a database from an application does not attach it to the service. If the service is stopped and restarted,
the additional database will not be started automatically.
If you start a service, it keeps running until you stop it. Closing Sybase Central or logging off does not stop
the service.
Stopping a database server service closes all connections to the database and stops the database server. For
other applications, the program shuts down.
If you open the Windows Service Manager (from the Windows Control Panel), a list of services appears.
The names of the SQL Anywhere services are formed from the service name you provided when installing
the service, prefixed by SQL Anywhere. All the installed services appear together in the list.
Service dependencies
In some circumstances you may want to run more than one executable as a service, and these executables
may depend on each other. For example, you may want to run a server and a SQL Remote Message Agent
or Log Transfer Manager to assist in replication.
In cases such as these, the services must start in the proper order. If a SQL Remote Message Agent service
starts before the server has started, it fails because it cannot find the server.
You can prevent these problems by using service groups, which you manage from Sybase Central.
Before you can configure your services to ensure that they start in the correct order, you must check that
your service is a member of an appropriate group. You can check which group a service belongs to, and
change this group, from Sybase Central.
To check and change which group a service belongs to
1. From the Context dropdown list, choose SQL Anywhere 11.
2. In the right pane, click the Services tab.
3. Select the service and then from the File menu, choose Properties.
4. Click the Dependencies tab. The top text box displays the name of the group the service belongs to.
5. Click Change to display a list of available groups on your system.
6. Select one of the groups, or type a name for a new group.
7. Click OK to assign the service to that group.
See “-z server option” on page 227 and “-o server option” on page 197.
For more information about the sasrv.ini file, see “Server name caching for faster
connections” on page 110.
All the database tools included with SQL Anywhere, including Sybase Central, Interactive SQL, and the
utilities, such as dbbackup, are self-authenticating. They are unrestricted in their operations against any
authenticated database. If the database itself is not authenticated, the tools act in a restricted, read-only
fashion.
You must use the OEM Edition of the SQL Anywhere database server for an authenticated application. This
edition differs from the usual database server only in that it processes authentication instructions. The
authentication instructions are ignored by other editions of the database server. If you do not use the
authenticated database server, no restrictions are placed on unauthenticated applications.
Note
To get an authentication signature, you must have an OEM contract with Sybase iAnywhere.
For information about how the company name and application name are incorporated into the authentication
mechanism, see “Authenticating your database” on page 66.
Once you complete the form, you will be emailed a database signature and an application signature within
48 hours. These signatures are long (81 character) strings of characters and digits. The e-mail message
containing your authentication information includes some examples of how to use the information. Some e-
mail systems force line breaks in these instructions. Make sure you rejoin lines broken in the e-mail message
for the instructions to work.
When the database server loads an authenticated database, it displays a message in the database server
messages window describing the authenticated company and application. You can check that this message
is present to verify that the database_authentication option has taken effect. The message has the following
form:
This database is licensed for use with:
Application: application-name
Company: company-name
Tip
You can store the authentication statement in a SQL script file to avoid having to type in the long signature.
You can run the SQL script from Interactive SQL by choosing Run Script from the File menu.
If you create a file named authenticate.sql in the scripts subdirectory of your SQL Anywhere installation
directory and store the authentication statement in this file, it is applied whenever you create, rebuild, or
upgrade a database. See “Upgrading authenticated databases” on page 69.
The option must be set for the duration of the connection only by using the TEMPORARY keyword. The
company-name and application-name must match those in the database authentication statement. The
application-signature is the signature that you obtained from Sybase.
The database server verifies the application signature against the database signature. If the signature is
verified, the connection is authenticated and has no restrictions on its activities beyond those imposed by
the SQL permissions. If the signature is not verified, the connection is limited to those actions permitted by
unauthenticated applications.
ODBC
Use the following statement:
SQLExecDirect(
hstmt,
"SET TEMPORARY OPTION connection_authentication=
'Company=MyCo;
Application=MyApp;
Signature=0fa55159999e14d818e...';",
SQL_NTS
);
The string must be entered on a single line, or you must build it up by concatenation.
PowerBuilder
Use the following PowerScript statement:
EXECUTE IMMEDIATE
"SET TEMPORARY OPTION connection_authentication=
'Company=MyCo;
Application=MyApp;
Signature=0fa551599998e14d818e...';"
USING SQLCA
JDBC
Use the following statement:
Statement Stmt1 = con.createStatement();
Stmt1.executeUpdate(
"SET TEMPORARY OPTION connection_authentication=
'Company=MyCo;
Application=MyApp;
Signature=0fa55159999e14d818e...';"
);
The string must be entered on a single line, or you must build it up by concatenation.
ADO.NET
Use the following statement:
SACommand cmd=new SACommand(
"SET TEMPORARY OPTION connection_authentication=
'Company=MyCo;
Application=MyApp;
Signature=0fa551599998e14d818e...';",
con
);
cmd.ExecuteNonQuery();
The string must be entered on a single line, or you must build it up by concatenation.
Embedded SQL
Use the following statement:
EXEC SQL SET TEMPORARY OPTION connection_authentication=
'Company=MyCo;
Application=MyApp;
Signature=0fa551599998e14d818e...';
The string must be entered on a single line, or you must build it up by concatenation.
When connecting to an authenticated database, the connection and authentication steps are performed
separately. However, some objects, such as the Visual Basic Grid object can attempt a separate, implicit
connection, which does not automatically include authentication. In such cases, the connection is not
authenticated and the database operation can fail. You can avoid this problem by including the InitString
connection parameter in the connection string. The following example illustrates how you can modify a
Visual Basic application to include the InitString connection parameter so that every connection is
immediately followed by authentication:
mConnectionString =
"Provider=SAPROV.11;
UID=DBA;
PWD=sql;
ENG=test11;
InitString=SET TEMPORARY OPTION connection_authentication=
'Company=MyCo;
Application=MyApp;
Signature=0fa55157edb8e14d818e...'"
mdbName.ConnectionString = mConnectionString
mdbName.Open
mIsSQL = True
Create a file named authenticate.sql in the install-dir\scripts directory, with the following contents:
SET OPTION PUBLIC.database_authentication = 'authentication-statement'
go
For information about the content of the authentication-statement string, see “database_authentication
[database]” on page 464.
The error report includes information such as the execution state of the threads at the time of the crash, so
that iAnywhere is better able to diagnose the cause of the problem. By default, the error report is created in
the diagnostic directory (specified by the SADIAGDIR environment variable), or if this location does not
exist, it is created in the same directory as the database file.
Error report file names are composed as follows:
● a prefix that identifies the application:
SR SQL Remote
How SQL Anywhere software submits error reports and diagnostic information
After the database server successfully writes out error report information, it launches Support utility
(dbsupport) and passes it the name of the error report file to be submitted. By default, dbsupport attempts to
prompt you to submit an error report when it is generated, but if dbsupport is unable to prompt you, then the
report is not sent. iAnywhere encourages you to submit error reports when they occur. The report does not
contain any information that identifies the sender.
You can change the default behavior of dbsupport with the -cc option:
● The following command configures dbsupport to submit error reports automatically without prompting
the user:
dbsupport -cc autosubmit
● The following command turns off automatic error report submission:
dbsupport -cc no
If you choose not to submit an error report, it remains in the diagnostic directory on your hard disk. The
location of the diagnostic directory is specified by the SADIAGDIR environment variable. See
“SADIAGDIR environment variable” on page 321.
Submitting error reports to iAnywhere assists with diagnosing the cause of a fatal error or assertion. Once
an error report is submitted, it is deleted from the computer where it was generated. See “Support utility
(dbsupport)” on page 764.
Error reports and diagnostic information are uploaded to the iAnywhere Error Reporting web site via HTTP.
This process saves you time by making it as convenient as possible to send relevant files to iAnywhere so
that it is possible to diagnose and provide solutions to problems you encounter.
Connecting to a database
Contents
Introduction to SQL Anywhere database connections ................................................. 74
Connecting from Sybase Central, Interactive SQL, or the SQL Anywhere Console
utility ............................................................................................................................ 78
Simple connection examples ....................................................................................... 81
Disconnecting from a database ................................................................................... 89
Working with ODBC data sources ............................................................................... 90
Connecting from desktop applications to a Windows Mobile database ....................... 99
Connecting to a database using OLE DB .................................................................. 100
Connection parameter tips ........................................................................................ 102
Troubleshooting connections ..................................................................................... 104
Using integrated logins .............................................................................................. 113
Using Kerberos authentication .................................................................................. 121
To establish a connection, the client application calls functions in one of the SQL Anywhere interfaces. SQL
Anywhere provides the following interfaces:
Interface Details
iAnywhere “Connecting from a JDBC client application” [SQL Anywhere Server - Programming]
JDBC driver
“SQL Anywhere JDBC API” [SQL Anywhere Server - Programming]
jConnect “Connecting from a JDBC client application” [SQL Anywhere Server - Programming]
JDBC driver
“SQL Anywhere JDBC API” [SQL Anywhere Server - Programming]
The interface uses connection information included in the call from the client application, perhaps together
with information held in a data source, the SQLCONNECT environment variable, or the server address
cache, to locate and connect to a server running the required database. The following figure is a simplified
representation of the pieces involved.
What to read
The following table identifies where you can find answers to questions.
An overview of connecting from Sybase Central or “Connecting from Sybase Central, Interactive
Interactive SQL (including a description of the drivers SQL, or the SQL Anywhere Console utili-
involved) ty” on page 78
Some examples to get started quickly, including Syb- “Simple connection examples” on page 81
ase Central and Interactive SQL scenarios
To learn what connection parameters are available “Connection parameters” on page 248
To see an in-depth description of how connections are “Troubleshooting connections” on page 104
established
To learn about character set issues affecting connec- “Connection strings and character
tions sets” on page 356
To learn about connecting through a firewall “Connecting across a firewall” on page 136
Connection parameters are assembled into connection strings. In a connection string, a semicolon separates
each connection parameter, as follows:
ServerName=demo11;DatabaseName=demo
You must enter a connection string on a single line with the parameter settings separated by semicolons.
In general, the connection string built by an application and passed to the interface library does not correspond
directly to the way a user enters the information. Instead, a user may fill in a window, or the application may
read connection information from an initialization file.
Many of the SQL Anywhere utilities accept a connection string as the -c option and pass the connection
string on to the interface library without change. For example, the following is a typical Backup utility
(dbbackup) command line:
dbbackup -c "ENG=sample_server;DBN=demo;UID=DBA;PWD=sql" SQLAnybackup
See also
● “Connection parameter tips” on page 102
See also
● “Working with ODBC data sources” on page 90
See also
● “Simple connection examples” on page 81
Tip
You can make subsequent connections to a given database easier and faster using a connection profile.
Once the Connect window appears, you must specify the connection parameters you need to connect. For
example, you can connect to the sample database by choosing SQL Anywhere 11 Demo from the ODBC
Data Source Name list on the Identification tab and then clicking OK.
dbconsole
The Connect window has a Connect Assistant to help you connect to a database. To display or hide the
Connect Assistant, click the arrow in the top right corner of the window.
The Connect window also has a Tools button that contains the following tools:
● The Test Connection tool tests your connection before exiting the Connect window.
● The Copy Connection String To Clipboard tool creates a connection string from the options you
specified in the Connect window and copies the string into your clipboard.
● The Save As ODBC Data Source tool lets you quickly create an ODBC data source from the specified
options.
After you connect successfully in Sybase Central, the database name appears in the left pane of the main
window, under the server that it is running on. The user ID for the connection appears after the database
name.
In Interactive SQL, the connection information (including the database name, your user ID, and the database
server) appears in the title bar above the SQL Statements pane.
See also
● “Connection parameters” on page 248
Note
You do not need to enter a user ID and a password for this connection because the data source already
contains this information.
● Are there multiple databases running on your computer? If there is only one, Sybase Central or Interactive
SQL assumes that it is the one you want to connect to, and you don't need to specify it in the Connect
window. If so, you need to tell Sybase Central or Interactive SQL which database in particular to connect
to.
Tips
If the database is already loaded (started) on the server, you only need to provide a database name for a
successful connection. The database file is not necessary.
You can connect using a data source (a stored set of connection parameters) for either of the above scenarios
by selecting the appropriate data source option at the bottom of the Identification tab of the Connect
window.
See also
● “Simple connection examples” on page 81
It is recommended that you use the ServerName (ENG) connection parameter when using an embedded
database. This ensures that the database will connect to the correct database server in case there are other
applications running SQL Anywhere database servers on the same computer.
There are a number of connection parameters that affect how a server is started. It is recommended that you
use the following connection parameters instead of providing the corresponding server options within the
StartLine (START) connection parameter:
● ServerName (ENG)
● DatabaseFile (DBF)
● DatabaseSwitches (DBS)
● DatabaseName (DBN)
See also
● “DatabaseFile connection parameter [DBF]” on page 258
● “ServerName connection parameter [ENG]” on page 281
● “StartLine connection parameter [START]” on page 282
● “Elevate connection parameter” on page 264
● “Opening the Connect window” on page 78
● “Simple connection examples” on page 81
The SQL Anywhere 11 Demo data source holds a set of connection parameters, including the database file
and a StartLine (START) parameter to start the database.
See also
● “Opening the Connect window” on page 78
● “Simple connection examples” on page 81
● “Using ODBC data sources on Unix” on page 97
Network connections occur over a network protocol. TCP/IP is available on all platforms.
ENG=svr-name
DBN=db-name
UID=user-id
PWD=password
CommLinks=all
When CommLinks=all is specified, the client library first looks for a personal server of the given name, and
then looks on the network for a server of the given name. See “CommLinks connection parameter
[LINKS]” on page 254.
ENG=svr-name
DBN=db-name
UID=user-id
PWD=password
CommLinks=tcpip
The network library searches for a server by broadcasting over the network, which can be a time-consuming
process. Once the network library locates a server, the client library stores its name and network address in
a file (sasrv.ini), and reuses this entry for subsequent connection attempts to that server using the specified
protocol. Subsequent connections are normally faster than a connection achieved by broadcast.
Many other connection parameters are available to assist SQL Anywhere in locating a server efficiently over
a network.
To connect to a database on a network server ( Sybase Central or Interactive SQL )
1. Start Sybase Central or Interactive SQL and open the Connect window (if it doesn't appear
automatically).
Tips
You can connect using a data source (a stored set of connection parameters) by selecting the appropriate
data source option at the bottom of the Identification tab of the Connect window.
By default, all network connections in Sybase Central and Interactive SQL use the TCP/IP network protocol.
See also
● “Client/server communications” on page 133
● “Network protocol options” on page 286
● “Connecting across a firewall” on page 136
● “Opening the Connect window” on page 78
● “Simple connection examples” on page 81
Default database
If more than one server is running, you need to specify which server you want to connect to. If only one
database is loaded on that server, you do not need to specify the database name. The following connection
string connects to a named server, using the default database:
ENG=server-name
UID=user-id
PWD=password
If CommLinks is not specified, only local shared memory connections are attempted.
If you are connecting from Sybase Central, Interactive SQL, or the SQL Anywhere Console utility
(dbconsole), you can select the Search Network For Database Servers option on the Connect window to
attempt a network connection.
For more information about the options for each database utility, see “Database administration
utilities” on page 667.
2. Using the SQLCONNECT environment variable settings if any values are missing. SQL Anywhere does
not set this variable automatically.
See “SQLCONNECT environment variable” on page 330.
See “DISCONNECT statement [ESQL] [Interactive SQL]” [SQL Anywhere Server - SQL Reference] and
“DROP CONNECTION statement” [SQL Anywhere Server - SQL Reference].
Example 1
The following statement shows how to use the DISCONNECT statement to disconnect the current
connection, conn1, in Interactive SQL:
DISCONNECT conn1;
Example 2
The following statement shows how to use DISCONNECT in embedded SQL:
EXEC SQL DISCONNECT :conn-name
Example
The following statement drops connection number 4.
DROP CONNECTION 4;
Caution
Storing user IDs, passwords (encrypted or unencrypted), and/or database keys in a data source is not secure.
It is recommended that you do not store this information in a data source if the database contains sensitive
data.
The SQL Anywhere ODBC driver is named dbodbc11.dll, and it is located in install-dir\bin32.
For more information about using SQL Anywhere with ODBC, see “ODBC conformance” [SQL Anywhere
Server - Programming].
You can use ODBC data sources to connect to SQL Anywhere databases from any of the following
applications:
● Sybase Central, Interactive SQL, and the SQL Anywhere Console utility.
● All the SQL Anywhere utilities.
● PowerDesigner Physical Data Model and InfoMaker.
● Any application development environment that supports ODBC, such as Microsoft Visual Basic, Sybase
PowerBuilder, and Borland Delphi.
● SQL Anywhere client applications on Unix. On Unix, the data source is stored as a file.
For SQL Anywhere, the use of ODBC data sources goes beyond Windows applications using the ODBC
interface:
● SQL Anywhere client applications on Unix can use ODBC data sources, as well as those on Windows
operating systems.
● ODBC data sources can be used by all SQL Anywhere client interfaces except jConnect and Open Client.
Note
When creating a connection string, it can contain the name of an ODBC data source that contains connection
parameters, as well as connection parameters that are specified explicitly. If a connection parameter is
specified in the connection string as well as in the ODBC data source, the value that is specified explicitly
takes precedence.
Caution
Storing user IDs, passwords (encrypted or unencrypted), and/or database keys in a data source is not secure.
It is recommended that you do not store this information in a data source if the database contains sensitive
data.
5. When you have specified the parameters you need, click OK to close the window and create the data
source.
Caution
Storing user IDs, passwords (encrypted or unencrypted), and/or database keys in a data source is not secure.
It is recommended that you do not store this information in a data source if the database contains sensitive
data.
For more information about the dbdsn utility, see “Data Source utility (dbdsn)” on page 684.
Caution
Storing user IDs, passwords (encrypted or unencrypted), and/or database keys in a data source is not secure.
It is recommended that you do not store this information in a data source if the database contains sensitive
data.
3. Click Add.
4. In the Description field, type SQL Anywhere 11.
5. Click Choose and select the SQL Anywhere ODBC driver in both the Driver File Name and Setup File
Name fields. By default, it is located in /Applications/SQLAnywhere11/System/lib/dbodbc11_r.bundle.
The _r in the bundle name indicates that it is the threaded version of the driver. There is also an unthreaded
version (dbodbc11.bundle) for use with unthreaded applications.
6. Click OK.
Once you have added the SQL Anywhere ODBC driver, you can create an ODBC data source that is used
to connect to your database.
Keyword Value
UID DBA
PWD sql
START dbeng11
DBF /Applications/SQLAnywhere11/System/demo.db
ThreadManager ON
For more information about connection parameters, see “Connection parameters and network protocol
options” on page 247.
5. Click OK.
6. Click Apply.
7. Press Command+Q to exit the ODBC Administrator.
Alternatively, you can add the information with a text editor. The ODBC configuration files are located
in /Library/ODBC within your Home directory. There is an odbcinst.ini file for driver information and an
odbc.ini file for data source information.
You can also use the Data Source utility (dbdsn) to create ODBC data sources on Mac OS X. See “Data
Source utility (dbdsn)” on page 684.
Caution
Storing user IDs, passwords (encrypted or unencrypted), and/or database keys in a data source is not secure.
It is recommended that you do not store this information in a data source if the database contains sensitive
data.
See also
● “Using file data sources on Windows” on page 96
[ODBC]
DRIVER=\windows\dbodbc11.dll
UID=DBA
PWD=sql
Integrated=No
AutoStop=Yes
ServerName=SalesDB_remote
LINKS=tcpip(host=192.168.0.55;port=2638;dobroadcast=none)
LOG=\sa_connection.txt
START=dbsrv11 -c 8M
See also
● “Creating an ODBC data source to connect to your Windows Mobile device” on page 1058
Note
The ODBCINI and ODBC_INI environment variables point to the system information file (which may or
may not be named .odbc.ini), while the ODBCHOME and HOME environment variables point to a path
where the .odbc.ini file is located.
Both ODBCINI and ODBC_INI specify a full path, including the file name. If the system information file
is located in a directory specified by ODBCINI or ODBC_INI, it does not have to be named .odbc.ini.
You can enter any connection parameter in the system information file. See “Connection
parameters” on page 248.
Network protocol options are added as part of the CommLinks (LINKS) parameter. See “Network protocol
options” on page 286.
Caution
Storing user IDs, passwords (encrypted or unencrypted), and/or database keys in a data source is not secure.
It is recommended that you do not store this information in a data source if the database contains sensitive
data.
You can create and manage ODBC data sources on Unix using the dbdsn utility.
Caution
You should not add simple encryption to the system information file (named .odbc.ini by default) with the
File Hiding utility (dbfhide) on Unix unless you are using only SQL Anywhere data sources. If you plan to
use other data sources (for example, for MobiLink synchronization), then obfuscating the contents of the
system information file may prevent other drivers from functioning properly.
See also
● “Creating an ODBC data source” on page 91
● “Data Source utility (dbdsn)” on page 684
● “ODBCHOME environment variable [Unix]” on page 317
● “ODBCINI and ODBC_INI environment variables [Unix]” on page 318
See also
● “Starting a server on your Windows Mobile device” on page 1057
● “Creating an ODBC data source to connect to your Windows Mobile device” on page 1058
● “Determining the IP address of your Windows Mobile device” on page 1059
This section is an introduction to how to use OLE DB from Sybase PowerBuilder and Microsoft ADO
environments such as Visual Basic. It is not complete documentation on how to program using ADO or OLE
DB. The primary source of information about development topics is your development tool documentation.
See also
● “Introduction to OLE DB” [SQL Anywhere Server - Programming]
OLE DB providers
You need an OLE DB provider for each type of data source you want to access. Each OLE DB provider is
a dynamic-link library. There are two OLE DB providers you can use to access SQL Anywhere:
● Sybase SQL Anywhere OLE DB provider The SQL Anywhere OLE DB provider provides access
to SQL Anywhere as an OLE DB data source without the need for ODBC components. The short name
for this provider is SAOLEDB.
When the SAOLEDB provider is installed, it registers itself. This registration process includes making
registry entries in the COM section of the registry so that ADO can locate the DLL when the SAOLEDB
provider is called. If you change the location of your DLL, you must re-register it.
● Microsoft OLE DB provider for ODBC Microsoft provides an OLE DB provider with a short name
of MSDASQL.
The MSDASQL provider makes ODBC data sources appear as OLE DB data sources. It requires the
SQL Anywhere ODBC driver.
See also
● “Introduction to OLE DB” [SQL Anywhere Server - Programming]
Example
The following Visual Basic code initiates an OLE DB connection to SQL Anywhere:
' Declare the connection object
Dim myConn as New ADODB.Connection
myConn.Provider = "SAOLEDB"
myConn.ConnectionString = "DSN=SQL Anywhere 11 Demo"
myConn.Open
See also
● “ADO programming with SQL Anywhere” [SQL Anywhere Server - Programming]
DBF=samples-dir\demo.db
DBN=Sample
ENG=Sample Server
UID=DBA
PWD=sql
START=dbeng11 -c 8M
● Character set restrictions It is recommended that the server name must be composed of the ASCII
character set in the range 1 to 127. There is no such limitation on other parameters.
● Priority The following rules govern the priority of parameters:
○ The entries in a connect string are read left to right. If the same parameter is specified more than
once, the last one in the string applies. ODBC, OLE DB, Sybase Central, Interactive SQL, and the
SQL Anywhere Console utility are exceptions to this: if the same parameter is specified more than
once, the first string applies.
○ If a string contains a data source or file data source entry, the profile is read from the configuration
file, and the entries from the file are used if they are not already set. For example, if a connection
string contains a data source name and sets some of the parameters contained in the data source
explicitly, then in case of conflict the explicit parameters are used.
● Connection string parsing If there is a problem parsing the connection string, an error is generated
that indicates which connection parameter caused the problem.
● Empty connection parameters Connection parameters that are specified with empty values are
treated as a zero length string.
See also
● “Connection parameters and network protocol options” on page 247
● “Connection strings and character sets” on page 356
Troubleshooting connections
Who needs to read this section?
In many cases, establishing a connection to a database is straightforward using the information presented in
the first part of this chapter.
However, if you are having problems establishing connections to a server, you may need to understand the
process by which SQL Anywhere establishes connections to resolve your problems. This section describes
how SQL Anywhere connections work.
For more information about network-specific issues, including connections across firewalls, see “Client/
server communications” on page 133.
The software follows exactly the same procedure for each of the following types of client application:
● ODBC Any ODBC application using the SQLDriverConnect function, which is the common method
of connection for ODBC applications. Many application development systems, such as Sybase
PowerBuilder, belong to this class of application. The SQLConnect function is also available to ODBC
applications.
● Embedded SQL Any client application using embedded SQL and using the recommended function
for connecting to a database (db_string_connect).
In addition, The SQL CONNECT statement is available for embedded SQL applications and in
Interactive SQL. It has two forms: CONNECT AS ... and CONNECT USING. All the database
administration tools, including Interactive SQL, use db_string_connect.
● OLE DB Any ADO application using the ADODB Connection object. The Provider property is used
to locate the OLE DB driver. The Connection String property may use DataSource as an alternative to
DataSourceName and User ID as an alternative to UserID.
● JDBC Applications using the iAnywhere JDBC driver pass the URL jdbc:ianywhere: followed by
a standard connection string as a parameter to the Driver Manager.GetConnection method. The
connection string must include DataSource= and name a SQL Anywhere data source or include
Driver=SQL Anywhere 11 (this parameter is specified as Driver=libdbodbc11 on Unix and Linux).
See also
● “Troubleshooting server startup” on page 63
● “Troubleshooting network communications” on page 143
Since connection parameters may appear in several places (such as data sources, a connection string
assembled by the application, or an environment variable) SQL Anywhere assembles the parameters into
a single list.
3. Locate a server
Using the connection parameters, SQL Anywhere locates a database server on your computer or over a
network.
4. Locate the database
SQL Anywhere locates the database you want to connect to.
5. Start a personal server
If SQL Anywhere fails to locate a server, it attempts to start a personal database server and load the
database.
ADO.NET
ADO.NET programs add a reference to the SQL Anywhere ADO.NET provider, which is named
iAnywhere.Data.SQLAnywhere.dll. The .NET Data Provider DLL is added to the .NET Global Assembly
Cache (GAC) when it is installed.
Notes
Key points from the figure include:
● Precedence Parameters held in more than one place are subject to the following order of precedence:
1. Connection string
2. SQLCONNECT
3. Data source
That is, if a parameter is supplied both in a data source and in a connection string, the connection string
value overrides the data source value.
● Failure Failure at this stage occurs only if you specify in the connection string or in SQLCONNECT
a data source that does not exist.
● Common parameters Depending on other connections already in use, some connection parameters
may be ignored, including:
○ AutoStop Ignored if the database is already loaded.
○ DatabaseFile Ignored if DatabaseName is specified and a database with this name is already
running.
The interface library uses the completed list of connection parameters to attempt to connect.
If SQL Anywhere locates a server, it tries to locate or load the required database on that server. See “Locating
the database” on page 109.
If SQL Anywhere can not locate a server, it may attempt to start a personal server, depending on the
connection parameters.
Notes
● For local connections, locating a server is simple. For connections over a network, you can use the
CommLinks (LINKS) connection parameter to tune the search in many ways by supplying network
protocol options.
● You can specify a set of network protocol options for each network protocol in the argument to the
CommLinks (LINKS) connection parameter.
● Each attempt to locate a server involves two steps. First, SQL Anywhere looks in the server name cache
to see if a server of that name is available (this step is skipped if the value of DoBroadcast is none).
Second, it uses the available connection parameters to attempt a connection.
● If the server is autostarted, information from the START, DBF, DBKEY, DBS, DBN, ENG, and
AUTOSTOP connection parameters are used to construct the options for the autostarted server.
● If the server has an alternate server name, you can only use the alternate server name to connect to the
database that specified the alternate server name. You cannot use the alternate server name to connect
to any other databases running on that database server. See “-sn database option” on page 243.
Any number of DBNS processes can communicate with each other. Each DBNS process connects to every
other DBNS that it knows about, and the different DBNS processes share their lists of DBNS processes. For
example, suppose you start two DBNS processes, A and B. If you start a third DBNS process, C, in a third
subnet, passing the address of B to C, then B tells C about A, and C then connects to A.
Running more than one DBNS process in a single subnet is not necessary, and is not recommended.
See also
● “Broadcast Repeater utility (dbns11)” on page 677
[Server name]
LINKS=protocol_name
Address=address_string
Note
It is very important that each server has a unique name. Giving different servers the same name can lead to
identification problems.
Examples
The following command line tests to see if a server named Waterloo is available over a TCP/IP connection:
dbping -c "ENG=Waterloo;CommLinks=tcpip"
The following command tests to see if a default server is available on the current computer.
dbping
See also
● “Ping utility (dbping)” on page 736
Statistic Description
DBLib connect and disconnect The time to perform one DBLib connect and disconnect. Note that
the performance of connecting and disconnecting using other inter-
faces, such as ODBC, is typically slower than DBLib because more
requests are required to complete the connection.
Round trip simple request The time it takes to send a request from the client to the server plus
the time it takes to send a response from the server back to the client.
The round trip time is twice the average latency.
Send throughput The throughput based on transferring 100 KB of data for each iter-
ation from dbping to the database server.
Receive throughput The throughput based on transferring 100 KB of data for each iter-
ation from the database server to dbping.
If your network has both high round trip times and high throughput, the reported throughput will be lower
than your actual network throughput because of the high round trip times. Using dbping -s can be useful to
give an indication of whether communication compression may improve performance. The performance
statistics are approximate, and are more accurate when both the client and server computers are fairly idle.
The transferred data can be compressed to approximately 25% of its original size if communication
compression is used.
The following is an example of the output from dbping -s for the dbping command dbping -s -c
"UID=DBA;PWD=sql;ENG=sampleserver;LINKS=TCPIP":
SQL Anywhere Server Ping Utility Version 11.0.0.1658
Connected to SQL Anywhere 11.0.0.1657 server "sampleserver" and database
"sample" at address 10.25.107.108.
Performance statistic Number Total Time Average
---------------------------- -------------- ---------- ------------
DBLib connect and disconnect 175 times 1024 msec 5 msec
Round trip simple request 2050 requests 1024 msec <1 msec
Send throughput 7600 KB 1024 msec 7421 KB/sec
Receive throughput 10100 KB 1024 msec 9863 KB/sec
Ping database successful.
See also
● “Ping utility (dbping)” on page 736
Caution
Integrated logins offer the convenience of a single security system, but there are important security
implications that database administrators should be familiar with. See “Security concerns: Unrestricted
database access” on page 120 and “Security concerns: Copied database files” on page 130.
3. Create an integrated login mapping between a Windows user or group profile and an existing database
user. This can be done using a SQL statement or a wizard in Sybase Central. In Sybase Central, all users
with integrated login permission appear in the Login Mappings folder. This step requires DBA authority.
4. Connect from a client application in such a way that the integrated login facility is triggered.
Caution
Setting the login_mode database option to not allow Standard logins restricts connections to only those users
or groups who have been granted an integrated or Kerberos login mapping. Attempting to connect with a
user ID and password generates an error unless you are a user with DBA authority.
To allow more than one type of login, specify multiple values for the login_mode option. For example, the
following SQL statement sets the value of the login_mode database option to allow both standard and
integrated logins:
SET OPTION PUBLIC.login_mode = 'Standard,Integrated';
If a database file can be copied, the temporary public login_mode option should be used (both for integrated
and Kerberos logins). This way, integrated and Kerberos logins are not supported by default if the file is
copied.
An integrated login mapping is made either using a wizard in Sybase Central or a SQL statement.
To map an integrated login (Sybase Central)
1. Connect to the database as a user with DBA authority.
2. Select the Login Mappings folder in the left pane.
3. From the File menu, choose New » Login Mapping.
4. On the second page of the wizard, specify the name of the system (computer) user or group profile for
whom the integrated login is to be created.
Also, select the database user ID this user maps to. The wizard displays the available database users.
You must select one of these. You can not add a new database user ID.
5. Follow the remaining instructions in the wizard.
Example
The following SQL statement allows Windows users fran_whitney and matthew_cobb to log in to the
database as the user DBA, without having to know or provide the DBA user ID or password.
See “Creating integrated logins for Windows user groups” on page 116.
Example
The following SQL statement removes integrated login permission from the Windows user pchin.
REVOKE INTEGRATED LOGIN
FROM pchin;
If Integrated=YES is specified in the connection string, an integrated login is attempted. If the connection
attempt fails and the login_mode database option is set to Standard,Integrated, then the server attempts a
standard login. See “login_mode option [database]” on page 481.
If an attempt to connect to a database is made without providing a user ID or password, an integrated login
is attempted. The attempt succeeds or fails depending on whether the current user profile name matches an
integrated login mapping in the database.
The Interactive SQL statement CONNECT can connect to a database if all of the following are true:
● A server is currently running.
● The default database has the login_mode database option set to accept integrated login connections.
● An integrated login mapping has been created that matches the current user's user profile name or for a
Windows user group to which the user belongs.
● If the user is prompted with a window by the server for more connection information (such as occurs
when using Interactive SQL), the user clicks OK without providing more information.
In addition to creating integrated logins for individual Windows users, you can create integrated logins for
Windows user groups.
When a Windows user logs in, if they do not have an explicit integrated login mapping, but belong to a
Windows user group for which there is an integrated login mapping, the user connects to the database as the
database user or group specified in the Windows user group's integrated login mapping.
Caution
Creating an integrated login for a Windows user group allows any user that is a member of the group to
connect to the database without knowing a user ID or password.
See “Preventing members of Windows user groups from connecting to a database” on page 118.
You can use either of these methods to prevent members of Windows user groups from connecting to a
database.
The following example creates a procedure named login_check that is called by the login_procedure option.
The login_check procedure checks the supplied user name against a list of users that are not allowed to
connect to the database. If the supplied user name is found in the list, the connection fails. In this example,
users named Joe, Harry, or Martha are not allowed to connect. If the user is not found in the list, the database
connection proceeds as usual and calls the sp_login_environment procedure.
CREATE PROCEDURE DBA.user_login_check()
BEGIN
DECLARE INVALID_LOGON EXCEPTION FOR SQLSTATE '28000';
// Disallow certain users
IF( CURRENT USER IN ('Joe','Harry','Martha') ) THEN
SIGNAL INVALID_LOGON;
ELSE
CALL sp_login_environment;
END IF;
END
go
GRANT EXECUTE ON DBA.user_login_check TO PUBLIC
go
SET OPTION PUBLIC.login_procedure='DBA.user_login_check'
go
Caution
The default integrated login user permits anyone attempting an integrated login to connect to a database
successfully if the database contains a user ID named Guest. The authorities granted to the Guest user ID
determine the permissions and authorities granted to the newly-connected user.
Caution
Leaving the user profile Guest enabled can permit unrestricted access to a database that is hosted by that
server.
If the Guest user profile is enabled and has a blank password, any attempt to log in to the server will be
successful. It is not required that a user profile exist on the server, or that the login ID provided has domain
login permissions. Literally any user can log in to the server using any login ID and any password: they are
logged in by default to the Guest user profile.
This has important implications for connecting to a database with the integrated login feature enabled.
Consider the following scenario, which assumes the Windows server hosting a database has a Guest user
profile that is enabled with a blank password.
● An integrated login mapping exists between the user fran_whitney and the database user ID DBA. When
the user fran_whitney connects to the server with her correct login ID and password, she connects to the
database as DBA, a user with full administrative rights.
But anyone else attempting to connect to the server as fran_whitney will successfully log in to the server
regardless of the password they provide because Windows will default that connection attempt to the
Guest user profile. Having successfully logged in to the server using the fran_whitney login ID, the
unauthorized user successfully connects to the database as DBA using the integrated login mapping.
Caution
Kerberos logins offer the convenience of a single security system, but there are important security
implications that database administrators should be familiar with. See “Security concerns: Copied database
files” on page 130.
SQL Anywhere does not come equipped with Kerberos software. You must obtain Kerberos software
separately. Kerberos software includes the following components:
● Kerberos libraries These are referred to as the Kerberos Client or GSS (Generic Security Services)-
API runtime library. These Kerberos libraries implement the well-defined GSS-API. The libraries are
required on each client and server computer that intends to use Kerberos. The built-in Windows SSPI
interface can be used instead of a third-party Kerberos client library if you are using Active Directory
as your KDC.
● A Kerberos Key Distribution Center (KDC) server The KDC functions as a storehouse for users
and servers. It also verifies the identification of users and servers. The KDC is typically installed on a
server computer not intended for applications or user logins.
SQL Anywhere supports Kerberos authentication from DBLib, ODBC, OLE DB, and ADO.NET clients, as
well as Sybase Open Client and jConnect clients. Kerberos authentication can be used with SQL Anywhere
transport layer security encryption, but SQL Anywhere does not support Kerberos encryption for network
communications.
Windows uses Kerberos for Windows domains and domain accounts. Active Directory Windows Domain
Controllers implement a Kerberos KDC. A third-party Kerberos client or runtime is still required on the
database server computer for authentication in this environment, but the Windows client computers can use
the built-in Windows SSPI interface instead of a third-party Kerberos client or runtime. See “Using SSPI
for Kerberos logins on Windows” on page 126.
Kerberos clients
Kerberos authentication is available on 32-bit Windows and Linux. For a list of tested Kerberos clients, see
SQL Anywhere Supported Platforms and Engineering Support Status.
The following table lists the default names and locations of the keytab and GSS-API files used by the
supported Kerberos clients.
1 These file names may vary depending on your operating system and Kerberos client version.
Once you have installed and configured Kerberos, you must enable Kerberos logins for your SQL Anywhere
database. The login_mode database option determines whether Kerberos logins are allowed. As database
options apply only to the database in which they are found, different databases can have a different Kerberos
login setting, even if they are loaded and running on the same server.
The login_mode database option accepts one or more of the following values:
● Standard Standard logins are permitted. This value is the default. Standard connection logins must
supply both a user ID and password, and do not use the Integrated or Kerberos connection parameters.
● Integrated Integrated logins are permitted.
● Kerberos Kerberos logins are permitted.
Caution
Setting the login_mode database option to Kerberos restricts connections to only those users who have been
granted a Kerberos login mapping. Attempting to connect using a user ID and password generates an error
unless you are a user with DBA authority.
The following steps assume you already performed the steps in the previous procedure to set up Kerberos.
To configure SQL Anywhere to use Kerberos
1. Start the SQL Anywhere server with the -krb or -kr option to enable Kerberos authentication
(alternatively, the -kl option can be used to specify the location of the GSS-API library and enable
Kerberos).
See:
● “-kl server option” on page 191
● “-kr server option” on page 192
● “-krb server option” on page 192
The following command starts the database server for the Kerberos principal
[email protected].
If you want to connect when a Kerberos principal is used that does not have a mapping, ensure the Guest
database user ID exists and has a password. See “Creating a default integrated login
user” on page 119.
5. Ensure the client user has already logged on (has a valid Kerberos ticket-granting ticket) using their
Kerberos principal and that the client's Kerberos ticket has not expired. A Windows user logged in to a
domain account already has a ticket-granting ticket, which allows them to authenticate to servers,
providing their principal has sufficient permissions.
A ticket-granting ticket is a Kerberos ticket encrypted with the user's password that is used by the Ticket
Granting Service to verify the user's identity.
6. Connect from the client, specifying the KERBEROS connection parameter (KERBEROS=YES in many
cases, but KERBEROS=SSPI or KERBEROS=GSS-API-library-file can also be used). If the user ID or
password connection parameters are specified, they are ignored. For example:
dbisql -c "KERBEROS=YES;ENG=my_server_princ"
The Interactive SQL statement CONNECT can connect to a database if all the following are true:
● A server is currently running.
● The default database on the current server is enabled to accept Kerberos authenticated connections.
● A Kerberos login mapping has been created for the user's current Kerberos principal.
● If the user is prompted with a window by the server for more connection information (such as occurs
when using Interactive SQL), the user clicks OK without providing more information.
To connect from an Open Client or jConnect application, follow the previous steps (in the procedure To
configure SQL Anywhere to use Kerberos), and set up Open Client/jConnect as you would for Kerberos
authentication with Adaptive Server Enterprise. The server name must be the SQL Anywhere server's name
and is case significant. Note you cannot connect using an alternate server name from Open Client or jConnect.
For information about setting up the Kerberos principals and extracting the keytab, see http://
www.sybase.com/detail?id=1029260.
See also
● “-krb server option” on page 192
● “-kr server option” on page 192
● “-kl server option” on page 191
● “login_mode option [database]” on page 481
● “GRANT statement” [SQL Anywhere Server - SQL Reference]
● “CREATE USER statement” [SQL Anywhere Server - SQL Reference]
● “Kerberos connection parameter [KRB]” on page 270
● “Troubleshooting Kerberos connections” on page 127
Example
The following SQL statement grants KERBEROS login permission to the Windows user pchin.
GRANT KERBEROS LOGIN TO "[email protected]"
AS USER "kerberos-user";
Example
The following SQL statement removes KERBEROS login permission from the Windows user pchin.
REVOKE KERBEROS LOGIN
FROM "[email protected]";
with them. For example, account pchin in the myrealm.com Windows domain is typically already associated
with the [email protected] Kerberos principal. Clients authenticating this way must set the
Kerberos (KRB) connection parameter to SSPI.
When Kerberos=SSPI is specified in the connection string, a Kerberos login is attempted.
The following procedure assumes you have already set up Kerberos authentication. See “Setting up Kerberos
authentication” on page 123.
To connect using SSPI
1. Start the SQL Anywhere server with the -krb option to enable Kerberos authentication.
dbisql -c "KERBEROS=SSPI;ENG=my_server_princ"
A connection attempt using the following Interactive SQL statement will also succeed, providing the
user has logged on with a user profile name that matches a Kerberos login mapping in a default database
of a server:
"Unable to ● Ensure a Kerberos client is installed on the database server computer, including the
load Ker- GSS-API library
beros GSS- ● The database server -z output lists the name of the library that it is attempting to load.
API library" Verify that the library name is correct, and use the -kl option to specify the correct
message library name, if necessary.
● Ensure that the directory including any supporting libraries is listed in the library path
(%PATH% on Windows).
● If the database server -z output states the GSS-API library was missing entry points,
then the library is not a supported Kerberos Version 5 GSS-API library.
"Unable to ● Ensure there is a principal for server-name@REALM in the KDC. Principals are case
acquire Ker- sensitive, so ensure the database server name is in the same case as the user portion of
beros cre- the principal name.
dentials for ● Ensure the name of the SQL Anywhere server is the primary/user portion of the prin-
server name cipal.
"server-
name"" mes- ● Ensure that the server's principal has been extracted to a keytab file and the keytab file
sage is in the correct location for the Kerberos client. See “Kerberos clients” on page 122.
● If the default realm for the Kerberos client on the database server computer is different
from the realm in the server principal, use the -kr option to specify the realm in the
server principal.
"Kerberos ● Check the database server diagnostic messages. Some problems with the keytab file
login failed" used by the server are not detected until a client attempts to authenticate.
client error
"Kerberos logins are not supported" error ● Ensure a Kerberos client is installed on the client com-
and the LogFile includes the message "Failed puter, including the GSS-API library.
to load the Kerberos GSS-API library" ● The file specified by LogFile lists the name of the li-
brary that it is attempting to load. Verify that the
library name is correct, and use the Kerberos connec-
tion parameter to specify the correct library name, if
necessary.
● Ensure that the directory including any supporting li-
braries is listed in the library path (%PATH% on
Windows).
● If the LogFile output states the GSS-API library was
missing entry points, then the library is not a supported
Kerberos Version 5 GSS-API library.
"Kerberos logins are not supported" error ● Ensure the database server has enabled Kerberos log-
ins by specifying one or more of the -krb, -kl, or -kr
server options.
● Ensure Kerberos logins are supported by SQL Any-
where on both the client and server platforms.
"Kerberos login failed" error ● Ensure the user is logged into Kerberos and has a valid
ticket-granting ticket that has not expired.
● Ensure the client computer and server computer both
have their time synchronized to within less than 5 mi-
nutes.
"Login mode 'Kerberos' not permitted by ● The public or temporary public database option setting
login_mode setting" error for the login_mode option must include the value Ker-
beros to allow Kerberos logins.
"The login ID 'client-Kerberos-principal' has ● The Kerberos principal must be mapped to a database
not been mapped to any database user ID" user ID using the GRANT KERBEROS LOGIN state-
ment. Note the full client principal including the realm
must be provided to the GRANT KERBEROS LOGIN
statement, and principals which differ only in the in-
stance or realm are treated as different.
● Alternatively, if you want any valid Kerberos principal
which has not be explicitly mapped to be able to con-
nect, create the guest database user ID with a password
using GRANT CONNECT.
If the database is shut down and restarted, the option value remains the same and integrated logins are still
enabled.
Setting the login_mode option using SET TEMPORARY OPTION still allows user access via integrated
logins, but only until the database is shut down. The following statement changes the option value
temporarily:
SET TEMPORARY OPTION PUBLIC.login_mode = 'Standard,Integrated';
If the permanent option value is Standard, the database will revert to that value when it is shut down.
Setting temporary public options can be considered an additional security measure for database access, since
enabling integrated or Kerberos logins means that the database is relying on the security of the operating
system on which it is running. If the database is shut down and copied to another computer (such as a user's
computer) access to the database reverts to the SQL Anywhere security model and not the security model
of the operating system of the computer where the database has been copied.
See also
● “Security concerns: Copied database files” on page 130
● “SET OPTION statement” [SQL Anywhere Server - SQL Reference]
● You should strongly encrypt the database file using the AES encryption algorithm. The encryption key
should be complex and difficult to guess.
Client/server communications
Contents
Supported network protocols ..................................................................................... 134
Using the TCP/IP protocol ......................................................................................... 135
Adjusting communication compression settings to improve performance ................. 141
Troubleshooting network communications ................................................................ 143
The client library for each platform supports the same protocols as the corresponding server. In order for
SQL Anywhere to run properly, the network protocol (TCP/IP) must be installed and configured properly
on both the client and server computers.
Similarly, if a client application needs to specify the IP address of a server, the connection string or DSN
can contain the address, in the following format:
...;LINKS=tcpip(HOST=fe80::5445:5245:444f);...
Each interface is given an interface identifier, which appears at the end of an IPv6 address. For example, if
ipconfig.exe lists the address fe80::5445:5245:444f%7, the interface identifier is 7. When specifying
an IPv6 address on a Windows platform, the interface identifier should be used. On Unix, you can specify
either an interface identifier or interface name (the interface name is the name of the interface reported by
ifconfig). For example, the interface name is eth1 in the following IPv6 address:
fe80::5445:5245:444f%eth1. An interface identifier is required when specifying IPv6 addresses on
Linux (kernel 2.6.13 and later). This requirement affects values specified by the following protocol options:
● Broadcast
● Host
● MyIP
For example, suppose ipconfig.exe lists two interfaces, one with the identifier 1 and the other 2. If you are
looking for a database server that is on the network used by interface number 2, you can tell the client library
to broadcast only on that interface:
LINKS=tcpip(BROADCAST=ff02::1%2)
See also
● “Broadcast protocol option [BCAST]” on page 287
● “Host protocol option [IP]” on page 291
● “MyIP protocol option [ME]” on page 301
See also
● “-p server option” on page 200
● “CommBufferSize connection parameter [CBSIZE]” on page 253
The firewall must be configured to allow TCP/IP traffic between the SQL Anywhere server's address and
all the SQL Anywhere clients' addresses. The SQL Anywhere server's address is the IP address of the
computer running the SQL Anywhere server (the HOST parameter) and the SQL Anywhere server's IP port
number (the ServerPort protocol option, default 2638). Each SQL Anywhere client's address consists of the
IP address of the client computer, and the range of the client IP ports (the ClientPort protocol option). For
the simplest configuration, all client ports can be allowed. If only specific client ports are allowed, specify
a range with more ports than the maximum number of concurrent connections from each client computer,
since there is a several minute timeout before a client port can be reused.
See “ClientPort protocol option [CPORT]” on page 289.
Example
The following connection string fragment restricts the client application to ports 5050 through 5060, and
connects to a server named myeng running on the computer at address myhost using the server port 2020.
No UDP broadcast is performed because of the DoBroadcast option.
ENG=myeng;LINKS=tcpip(ClientPort=5050-5060;HOST=myhost;PORT=2020;DoBroadcast=
NONE)
See also
● “CommLinks connection parameter [LINKS]” on page 254
● “ClientPort protocol option [CPORT]” on page 289
● “ServerPort protocol option [PORT]” on page 302
● “Host protocol option [IP]” on page 291
● “DoBroadcast protocol option [DOBROAD]” on page 290
[LDAP]
server=computer-running-LDAP-server
port=port-number-of-LDAP-server
basedn=Base-DN
authdn=Authentication-DN
password=password-for-authdn
search_timeout=age-of-timestamps-to-be-ignored
update_timeout=frequency-of-timestamp-updates
read_authdn=read-only-authentication-domain-name
read_password=password-for-authdn
You can add simple encryption to obfuscate the contents of the saldap.ini file using the File Hiding utility
(dbfhide). See “File Hiding utility (dbfhide)” on page 698.
If the name of the file is not ldap.ini, then you must use the LDAP parameter to specify the file name.
server The name or IP address of the computer running the LDAP server. This value is required on Unix.
If this entry is missing on Windows, Windows looks for an LDAP server running on the local domain
controller.
port The port number used by the LDAP server. The default is 389.
basedn The domain name of the subtree where the SQL Anywhere entries are stored. This value defaults
to the root of the tree.
authdn The authentication domain name. The domain name must be an existing user object in the LDAP
directory that has write access to the basedn. This parameter is required for the database server, and ignored
on the client.
password The password for authdn. This parameter is required for the database server, and ignored on
the client.
search_timeout The age of timestamps at which they are ignored by the client and/or the Server
Enumeration utility (dblocate). A value of 0 disables this option so that all entries are assumed to be current.
The default is 600 seconds (10 minutes).
update_timeout The frequency of timestamp updates in the LDAP directory. A value of 0 disables this
option so that the database server never updates the timestamp. The default is 120 seconds (2 minutes).
read_authdn The read-only authentication domain name. The domain name must be an existing user
object in the LDAP directory that has read access to the basedn. This parameter is only required if the LDAP
server requires a non-anonymous binding before searching can be done. For example, this field is normally
required if Active Directory is used as the LDAP server. If this parameter is missing, the bind is anonymous.
read_password The password for authdn. This parameter is only required on the client if the read_authdn
parameter is specified.
Example
The following is a sample saldap.ini file:
[LDAP]
server=ldapserver
basedn=dc=iAnywhere,dc=com
authdn=cn=SAServer,ou=iAnywhereASA,dc=iAnywhere,dc=com
password=secret
The entries are stored in a subtree of the basedn called iAnywhereASA. This entry must be created before
SQL Anywhere can use LDAP. To create the subtree, you can use the LDAPADD utility, supplying the
following information:
dn: ou=iAnywhereASA,basedn
objectClass: organizationalUnit
objectClass: top
ou: iAnywhereASA
When the server starts, it checks for an existing entry with the same name in the LDAP file. If one is found,
it is replaced if either the location entries in LDAP match the database server attempting to start, or the
timestamp field in the LDAP entry is more than 10 minutes old (the timeout value is configurable).
If neither of these is true, then there is another database server running with the same name as the one
attempting to start, and startup fails.
To ensure that entries in LDAP are up-to-date, the database server updates a timestamp field in the LDAP
entry every 2 minutes. If an entry's timestamp is older than 10 minutes, clients ignore the LDAP entry. Both
of these settings are configurable.
On the client, the LDAP directory is searched before doing any broadcasting, so if the database server is
found, no broadcasts are sent. The LDAP search is very fast, so if it fails, there is no discernible delay.
The Server Enumeration utility (dblocate) also uses LDAP—all database servers listed in LDAP are added
to the list of database servers returned. This allows the Server Enumeration utility (dblocate) to list database
servers that wouldn't be returned normally, for example, those which broadcasts wouldn't reach. Entries with
timestamps older than 10 minutes are not included.
Enabling compression
Enabling compression for a connection (or all connections) can significantly improve SQL Anywhere
performance under some circumstances, including:
● When used over slow networks such as some wireless networks, some modems, serial links and some
WANs.
● When used in conjunction with SQL Anywhere encryption over a slow network with built-in
compression, since packets are compressed before they are encrypted.
Enabling compression, however, can sometimes also cause slower performance. For instance:
● Communication compression uses more memory and more CPU. It may cause slower performance,
especially for LANs and other fast networks.
● Most modems and some slow networks already have built-in compression. In these cases, SQL Anywhere
communication compression will not likely provide additional performance benefits unless you are also
encrypting the data.
For more information about compression, see “Compress connection parameter [COMP]” on page 255 and
“-pc server option” on page 201.
When compression is enabled, individual packets may or may not be compressed, depending on their size.
For example, SQL Anywhere does not compress packets smaller than the compression threshold, even if
communication compression is enabled. As well, small packets (less than about 100 bytes) usually do not
compress at all. Since CPU time is required to compress packets, attempting to compress small packets could
actually decrease performance.
Generally speaking, lowering the compression threshold value may improve performance on very slow
networks, while raising the compression threshold may improve performance by reducing CPU usage.
However, since lowering the compression threshold value will increase CPU usage on both the client and
server, a performance analysis should be done to determine whether or not changing the compression
threshold is beneficial.
See “CompressionThreshold connection parameter [COMPTH]” on page 257 and “-pt server
option” on page 201.
To adjust SQL Anywhere compression settings
1. Enable communication compression.
Large data transfers with highly compressible data and larger packet sizes tend to get the best compression
rates.
For more information about enabling compression, see “Compress connection parameter
[COMP]” on page 255 and “-pc server option” on page 201.
2. Adjust the CompressionThreshold setting.
Lowering the compression threshold value may improve performance on very slow networks, while
raising the compression threshold may improve performance by reducing CPU usage.
For more information about adjusting the CompressionThreshold (COMPTH) connection parameter, see
“CompressionThreshold connection parameter [COMPTH]” on page 257 and “-pt server
option” on page 201.
Use logging
Specifying the -z database server option displays diagnostic communication messages, and other messages
to the database server messages window for troubleshooting purposes. These messages can help you diagnose
how a connection is failing and what connection parameters are used for the connection attempt, as well as
identify what communication links are being used.
See also
● “-x server option” on page 222
● “CommLinks connection parameter [LINKS]” on page 254
Each IP layer has an associated address—for IPv4, this address is a four-integer, dot-separated number (such
as 191.72.109.12). Ping takes an IP address as an argument and attempts to send a single packet to the address.
First, determine if your own computer is configured correctly by using the ping utility to detect your
computer. If your IP-address is 191.72.109.12, you would run the following command and wait to see if the
packets are routed at all:
ping 191.72.109.12
This means that the computer is able to route packets to itself. This is reasonable assurance that the IP layer
is set up correctly. You could also ask someone else running TCP/IP for their IP address and try using the
ping utility to detect their computer.
You should ensure that you can ping the computer running the database server from the client computer
before proceeding.
If you are attempting to connect to a host on an IPv6 network, you must first ensure that IPv6 is installed on
the client computer. On Windows XP, run the command ipv6 install to install IPv6. IPv6 is installed
by default on Windows Vista. Installing IPv6 is different on each Unix operating system; consult the
operating system documentation for instructions on enabling IPv6.
Once IPv6 is installed and enabled, you can use the ping6 command to do the same thing as the ping
command described above. For example:
ping6 fe80::213:ceff:fe24:ca6
Pinging fe80::213:ceff:fe24:ca6
from fe80::213:ceff:fe24:ca6%6 with 32 bytes of data:
For more information about network protocol options, see “Network protocol options” on page 286.
See also
● “LivenessTimeout connection parameter [LTO]” on page 273
● “-tl server option” on page 214
● “Idle connection parameter” on page 269
● “-ti server option” on page 213
Contents
The SQL Anywhere database server ........................................................................ 148
Database server options ............................................................................................ 156
Database options ....................................................................................................... 235
Syntax
{ dbeng11 | dbsrv11 }
[ server-options ] [ database-file [ database-options ] ...]
Server options
Server option Description
-b Runs in bulk operations mode. See “-b server option” on page 157.
-c size Sets initial cache size. See “-c server option” on page 158.
-ca 0 Disables dynamic cache sizing [Windows, Unix, Mac OS X]. See “-ca server
option” on page 159.
-cc { + | - } Collects information about database pages to be used for cache warming. See
“-cc server option” on page 160.
-ch size Sets the cache size upper limit [Windows, Unix, Mac OS X]. See “-ch server
option” on page 161.
-cl size Sets the cache size lower limit [Windows, Unix, Mac OS X]. See “-cl server
option” on page 162.
-cm size Specifies the amount of address space allocated for an Address Windowing
Extensions (AWE) cache [Windows]. See “-cm server option” on page 163.
-cr { + | - } Warms the cache with database pages. See “-cr server option” on page 164.
-cs Displays cache usage in the database server messages window. See “-cs server
option” on page 165.
-cv { + | - } Controls the appearance of messages about cache warming in the database
server messages window. See “-cv server option” on page 165.
-cw Enables use of Address Windowing Extensions for setting the size of the da-
tabase server cache [Windows]. See “-cw server option” on page 166.
-dt temp-file-dir Specifies the directory where temporary files are stored. See “-dt server op-
tion” on page 170.
-ec encryption-options Enables packet encryption [network server]. See “-ec server op-
tion” on page 170.
-ep Prompts for encryption key. See “-ep server option” on page 173.
-es Allows unencrypted connections over shared memory. See “-es server op-
tion” on page 174.
-f Forces the database to start without a transaction log. See “-f recovery op-
tion” on page 174.
-fc filename Specifies the file name of a DLL containing the file system full callback func-
tion. See “-fc server option” on page 175.
-fips Requires the use of FIPS-approved algorithms for strong database and com-
munication encryption [Windows]. See “-fips server option” on page 176.
-ga Automatically unloads the database after the last non-HTTP client connection
is closed. In addition, shut down after the last database is closed. See “-ga
server option” on page 178.
-gb level Sets database process priority class to level [Windows, Unix, Mac OS X]. See
“-gb server option” on page 178.
-gc num Sets maximum checkpoint timeout period to num minutes. See “-gc server
option” on page 179.
-gd level Sets database starting permission. See “-gd server option” on page 179.
-ge size Sets the stack size for threads that run external functions. See “-ge server
option” on page 180.
-gf Disables firing of triggers. See “-gf server option” on page 181.
-gk level Sets the permission required to stop the server. See “-gk server op-
tion” on page 181.
-gl level Sets the permission required to load or unload data. See “-gl server op-
tion” on page 182.
-gm num Sets the maximum number of connections. See “-gm server op-
tion” on page 182.
-gn num Sets the maximum number of tasks that the database server can execute con-
currently. See “-gn server option” on page 183.
-gp size Sets the maximum page size to size bytes. See “-gp server op-
tion” on page 184.
-gr minutes Sets the maximum recovery time. See “-gr server option” on page 184.
-gss size Sets the thread stack size to size bytes. See “-gss server op-
tion” on page 185.
-gt num Sets the maximum number of physical processors that can be used (up to the
licensed maximum). This option is only useful on multiprocessor systems.
See “-gt server option” on page 186.
-gtc logical-processors-to- Controls the maximum processor concurrency that the database server allows.
use See “-gtc server option” on page 187.
-gu level Sets the permission level for utility commands: utility_db, all, none, or DBA.
See “-gu server option” on page 188.
-im submode Runs the database server in memory, reducing or eliminating writes to disk.
See “-im server option” on page 189.
-k Controls the collection of Performance Monitor statistics. See “-k server op-
tion” on page 190.
-kl GSS-API-library-file Specifies the file name of the Kerberos GSS-API library (or shared object on
Unix) and enable Kerberos authenticated connections to the database server.
See “-kl server option” on page 191.
-kr server-realm Specifies the realm of the Kerberos server principal and enables Kerberos
authenticated connections to the database server. See “-kr server op-
tion” on page 192.
-ks Disables the creation of shared memory that the Performance Monitor uses to
collect counter values from the database server [Windows]. See “-ks server
option” on page 193.
-ksc Specifies the maximum number of connections that the Performance Monitor
can monitor [Windows]. See “-ksc server option” on page 194.
-ksd Specifies the maximum number of databases that the Performance Monitor
can monitor [Windows]. See “-ksd server option” on page 194.
-m Truncates the transaction log after each checkpoint for all databases. See “-m
server option” on page 195.
-n name Uses name as the name of the database server. Note that the -n option is po-
sitional. See “-n server option” on page 196.
-o filename Outputs messages to the specified file. See “-o server option” on page 197.
-oe filename Specifies file to log startup errors, fatal errors and assertions to. See “-oe server
option” on page 197.
-on size Specifies a maximum size for the database server message log file, after which
the file is renamed with the extension .old and a new file is started. See “-on
server option” on page 198.
-os size Limits the size of the log file for messages. See “-os server op-
tion” on page 199.
-ot filename Truncates the database server message log file and appends output messages
to it. See “-ot server option” on page 200.
-p packet-size Sets the maximum network packet size [network server]. See “-p server op-
tion” on page 200.
-pt size_in_bytes Sets the minimum network packet size to compress. See “-pt server op-
tion” on page 201.
-qi Does not display the database server system tray icon or database server mes-
sages window [Windows]. See “-qi server option” on page 202.
-qn Does not minimize the database server messages window on startup [Win-
dows and Linux]. See “-qn server option” on page 202.
-qs Suppresses startup error windows. See “-qs server option” on page 204.
-qw Does not display the database server message window. See “-qw server op-
tion” on page 204.
-r Opens database in read-only mode. See “-r server option” on page 205.
-s facility-ID Sets the Syslog facility ID [Unix, Mac OS X]. See “-s server op-
tion” on page 206.
-sb { 0 | 1 } Specifies how the server reacts to broadcasts. See “-sb server op-
tion” on page 207.
-sf feature-list Secures features for databases running on this database server. See “-sf server
option” on page 207.
-sk key Specifies a key that can be used to enable features that are disabled for the
database server. See “-sk server option” on page 211.
-su password Sets the password for the DBA user of the utility database (utility_db), or
disable connections to the utility database. See “-su server op-
tion” on page 212.
-ti minutes Sets the client idle time before shutdown—default 240 minutes. See “-ti server
option” on page 213.
-tl seconds Sets the default liveness timeout for clients in seconds—default 120 seconds.
See “-tl server option” on page 214.
-tmt milliseconds Sets the reenlistment timeout for distributed transactions [Windows]. See “-
tmt server option” on page 215.
-tq time Sets quitting time [network server]. See “-tq server option” on page 215.
-u Uses buffered disk I/O [Windows, Unix, Mac OS X]. See “-u server op-
tion” on page 216.
-ua Turns off use of asynchronous I/O [Linux]. See “-ua server op-
tion” on page 216.
-uc Starts the database server in shell mode [Unix and Mac OS X]. See “-uc server
option” on page 217.
-ud Runs as a daemon [Unix, Mac OS X]. See “-ud server option” on page 217.
-uf Specifies the action to take when a fatal error occurs [Unix, Mac OS X]. See
“-uf server option” on page 218.
-ui Opens the Server Startup Options window and displays the database server
messages window, or starts the database server in shell mode if a usable dis-
play isn't available [Linux and Mac OS X]. See “-ui server op-
tion” on page 218.
-um Opens the Server Startup Options window and displays the database server
messages window [Mac OS X]. See “-um server option” on page 219.
-ut minutes Touches temporary files every min minutes [Unix, Mac OS X]. See “-ut server
option” on page 220.
-ux Displays the database server messages window and Server Startup Op-
tions window [Linux]. See “-ux server option” on page 220.
-v Displays database server version and stop. See “-v server op-
tion” on page 221.
-vss Enables and disables the Volume Shadow Copy Service (VSS). See “-vss
server option” on page 221.
-x list Specifies a comma-separated list of communication links to use. See “-x server
option” on page 222.
-xa authentication-info Specifies a list of database names and authentication strings for an arbiter
server. See “-xa server option” on page 224.
-xf state-file Specifies the location of the file used for maintaining state information about
your database mirroring system. See “-xf server option” on page 224.
-xs Specifies server side web services communications protocols. See “-xs server
option” on page 225.
-ze Displays database server environment variables in the database server mes-
sages window. See “-ze server option” on page 227.
-zl Turns on capturing of the most recently-prepared SQL statement for each
connection. See “-zl server option” on page 228.
-zn integer Specifies the number of request log file copies to retain. See “-zn server op-
tion” on page 229.
-zo filename Redirects request logging information to a separate file. See “-zo server op-
tion” on page 230.
-zoc Redirects web service client information to a file. See “-zoc server op-
tion” on page 230.
-zp Turns on capturing of the plan most recently used by the query optimizer. See
“-zp server option” on page 231.
-zr { all | SQL | none } Turns on logging of SQL operations. The default is NONE. See “-zr server
option” on page 231.
-zs size Limits the size of the log file used for request logging. See “-zs server op-
tion” on page 233.
-zt Turns on logging of request timing information. See “-zt server op-
tion” on page 234.
Database options
The following options can only be specified after a database file name in the database server command.
-a filename Applies the named transaction log file. See “-a database op-
tion” on page 235.
-ad log-directory Specifies the directory containing log files to be applied to the database. See
“-ad database option” on page 235.
-ar Applies any log files located in the same directory as the transaction log to
the database. See “-ar database option” on page 236.
-as Continues running the database after transaction logs have been applied (used
in conjunction with -ad or -ar). See “-as database option” on page 237.
-ds Specifies the location of all of the dbspaces for the database. See “-ds database
option” on page 238.
-dh Does not display the database when dblocate is used against this server. See
“-dh database option” on page 238.
-ek key Specifies encryption key. See “-ek database option” on page 239.
-m Truncates (delete) the transaction log after each checkpoint for the specified
database. See “-m database option” on page 239.
-n name Names the database. See “-n database option” on page 240.
-sm Provides a database server name that can be used to access the read-only mirror
database. See “-sm database option” on page 242.
-sn alternate-server-name Provides an alternate server name for a single database running on a database
server. See “-sn database option” on page 243.
-xp mirroring-options Provides information to an operational server that allows it to connect to its
partner and to the arbiter when database mirroring is being used. See “-xp
database option” on page 245.
Remarks
The dbeng11 command starts a personal database server. The dbsrv11 command starts a network database
server.
The database-file specifies the database file name. If database-file is specified without a file extension, SQL
Anywhere looks for database-file with extension .db. If you use a relative path, it is read relative to the current
working directory. You can supply a full path.
If you want to start a database server from a batch file, you must use the dbspawn utility. See “Start Server
in Background utility (dbspawn)” on page 760.
The personal database server has a maximum of ten concurrent connections, uses at most one CPU for request
processing, and doesn't support network client/server connections.
In addition, there are other minor differences, such as the default permission level that is required to start
new databases, or the permissions required to execute the CHECKPOINT statement.
Both personal and network database servers are supplied for each supported operating system, with one
exception. On Windows Mobile, only the network server is supplied. The support for TCP/IP in the network
server enables you to perform tasks from your desktop computer, including database management, with
Sybase Central.
Syntax
{ dbsrv11 | dbeng11 } @data ...
Applies to
All operating systems and database servers, except Windows Mobile. It is supported for all database utilities
except the Language Selection utility (dblang), the Rebuild utility (rebuild), the Certificate Creation utility
(createcert), the Certificate Viewer utility (viewcert), the ActiveSync provider install utility (mlasinst), and
the File Hiding utility (dbfhide).
Remarks
Use this option to read in command line options from the specified environment variable or configuration
file. If both exist with the same name that is specified, the environment variable is used.
Configuration files can contain line breaks, and can contain any set of options. See “Using configuration
files” on page 669.
If you want to protect the information in a configuration file (for example, because it contains passwords)
you can use the File Hiding (dbfhide) utility to obfuscate the contents of configuration files. See “File Hiding
utility (dbfhide)” on page 698.
The @data parameter can occur at any point in the command line, and parameters contained in the file are
inserted at that point. Multiple files can be specified, and the file specifier can be used with command line
options.
See also
● “Using configuration files” on page 669
Example
The following configuration file holds a set of options for a server named myserver that starts with a cache
size of 4 MB and loads the sample database:
-c 4096
-n myserver
"c:\mydatabase.db"
dbsrv11 @c:\config.txt
The following statement sets an environment variable that holds options for a database server that starts with
a cache size of 4 MB and loads the sample database.
SET envvar=-c 4096 "c:\mydatabase.db";
This command starts the database server using an environment variable named envvar.
dbsrv11 @envvar
-? server option
Displays usage information.
Syntax
{ dbsrv11 | dbeng11 } -?
Applies to
All operating systems and database servers, except Windows Mobile.
Remarks
Displays a short description of each server option. The database doesn't perform any other task.
-b server option
Uses bulk operation mode.
Syntax
{ dbsrv11 | dbeng11 } -b ...
Applies to
All operating systems and database servers.
Remarks
This is useful for using the Interactive SQL INPUT command to load large quantities of data into a database.
The -b option should not be used if you are using LOAD TABLE to bulk load data.
When you use this option, the database server allows only one connection by one application. It keeps a
rollback log, but it doesn't keep a transaction log. The multi-user locking mechanism is turned off.
When you first start the database server after loading data with the -b option, you should use a new log file.
Bulk operation mode doesn't disable the firing of triggers.
See also
● “Data recovery issues for bulk operations” [SQL Anywhere Server - SQL Usage]
● “Performance aspects of bulk operations” [SQL Anywhere Server - SQL Usage]
-c server option
Sets the initial memory reserved for caching database pages and other server information.
Syntax
{ dbsrv11 | dbeng11 } -c { size[ k | m | g | p ] } ...
Applies to
All operating systems and database servers.
Remarks
The amount of memory available for use as a database server cache is one of the key factors controlling
performance. You can set the initial amount of cache memory using the -c server option. The more cache
memory that can be given the server, the better its performance.
The size is the amount of memory, in bytes. Use k, m, or g to specify units of kilobytes, megabytes, or
gigabytes, respectively.
The unit p is a percentage either of the physical system memory, or of the maximum non-AWE cache size,
whichever is lower. The maximum non-AWE cache size depends on the operating system. For example:
● 2.8 GB for Windows 32-bit Advanced Server, Enterprise Server, Datacenter Server, and Vista
● 3.8 GB for the 32-bit database server running on Windows x64 Edition
● 1.8 GB on all other 32-bit systems
● On Windows Mobile, the p option specifies a percentage of available physical memory
If you use p, the argument is a percentage. You can use % as an alternative to p, but as most non-Unix
operating systems use % as an environment variable escape character, you must escape the % character. To
set the minimum cache size to 50 percent of the physical system memory, you would use the following:
On Unix operating systems, the cache size is set to the lesser of:
● the value specified after -c
● 95% of (available memory - 5 MB)
On Windows Mobile, the cache size will be set to the lesser of:
● the value specified after -c
● 95% of (available memory - 2 MB)
If no -c option is provided, the database server computes the initial cache allocation as follows:
If your database is encrypted, you may want to increase the cache size. As well, if you are using dynamic
cache resizing (-ca option), then the cache size that is used may be restricted by the amount of memory that
is available.
See “Increase the cache size” [SQL Anywhere Server - SQL Usage].
The database server messages window displays the size of the cache at startup, and you can use the following
statement to obtain the current size of the cache:
SELECT PROPERTY( 'CacheSize' );
See also
● “-ca server option” on page 159
● “-cc server option” on page 160
● “-ch server option” on page 161
● “-cl server option” on page 162
● “-cm server option” on page 163
● “-cr server option” on page 164
● “-cs server option” on page 165
● “-cv server option” on page 165
● “-cw server option” on page 166
● “Limiting the memory used by the cache” [SQL Anywhere Server - SQL Usage]
● “Increase the cache size” [SQL Anywhere Server - SQL Usage]
● “Use the cache to improve performance” [SQL Anywhere Server - SQL Usage]
Example
The following example, entered all on one line, starts a server named myserver that starts with a cache size
of 3 MB and loads the sample database:
dbeng11 -c 3m -n myserver "samples-dir\demo.db"
Syntax
{ dbsrv11 | dbeng11 } -ca 0 ...
Applies to
Windows, Unix, Mac OS X
Remarks
You can disable automatic cache increase because of high server load by specifying -ca 0 on the command
line. If you do not include the -ca 0 option, the database server automatically increases the cache size. The
cache size still increases if the database server would otherwise run into the error Fatal Error:
dynamic memory exhausted.
This server option must only be used in the form -ca 0.
This option is ignored if you are using an AWE cache. You can use the -cw option to create a larger cache
using AWE. See “-cw server option” on page 166.
See also
● “-c server option” on page 158
● “-cc server option” on page 160
● “-ch server option” on page 161
● “-cl server option” on page 162
● “-cm server option” on page 163
● “-cr server option” on page 164
● “-cs server option” on page 165
● “-cv server option” on page 165
● “-cw server option” on page 166
● “Limiting the memory used by the cache” [SQL Anywhere Server - SQL Usage]
Example
The following example starts a server named myserver that has a static cache that is 40% of the available
physical memory and loads the sample database:
dbsrv11 -c 40P -ca 0 -n myserver "samples-dir\demo.db"
Syntax
{ dbsrv11 | dbeng11 } -cc { + | - } ...
Applies to
All operating systems and database servers.
Remarks
By default, page collection is turned on. When collection is turned on, the database server keeps track of
each database page that is requested. Collection stops when the maximum number of pages has been
collected, the database is shut down, or the collection rate falls below the minimum value. Note that you
cannot configure the maximum number of pages collected or specify the value for the collection rate (the
value is based on cache size and database size). Once collection stops, information about the requested pages
is recorded in the database so those pages can be used to warm the cache the next time the database is started
with the -cr option. Collection of referenced pages is turned on by default.
See also
● “-c server option” on page 158
● “-ca server option” on page 159
● “-ch server option” on page 161
● “-cl server option” on page 162
● “-cm server option” on page 163
● “-cr server option” on page 164
● “-cs server option” on page 165
● “-cv server option” on page 165
● “-cw server option” on page 166
● “Using cache warming” [SQL Anywhere Server - SQL Usage]
Syntax
{ dbsrv11 | dbeng11 } -ch { size[ k | m | g | p ] } ...
Applies to
Windows, Unix, Mac OS X
Remarks
This option limits the size of the database server cache during automatic cache growth. By default the upper
limit is approximately the lower of the maximum non-AWE cache size and 90% of the physical memory of
the computer.
The size is the amount of memory, in bytes. Use k, m, or g to specify units of kilobytes, megabytes, or
gigabytes, respectively.
The unit p is a percentage either of the physical system memory, or of the maximum non-AWE cache size,
whichever is lower. The maximum non-AWE cache size depends on the operating system. For example:
● 2.8 GB for Windows 32-bit Advanced Server, Enterprise Server and Datacenter Server
● 3.8 GB for the 32-bit database server running on Windows x64 Edition
If you use p, the argument is a percentage. You can use % as an alternative to P, but as most non-Unix
operating systems use % as an environment variable escape character, you must escape the % character. To
set the minimum cache size to 50 percent of the physical system memory, you would use the following:
This option is ignored if you are using an AWE cache. You can use the -cw option to create a larger cache
using AWE. See “-cw server option” on page 166.
dbeng11 -ch 50%% ...
See also
● “-c server option” on page 158
● “-ca server option” on page 159
● “-cc server option” on page 160
● “-cl server option” on page 162
● “-cm server option” on page 163
● “-cr server option” on page 164
● “-cs server option” on page 165
● “-cv server option” on page 165
● “Limiting the memory used by the cache” [SQL Anywhere Server - SQL Usage]
Example
The following example starts a server named silver that has a maximum cache size of 2 MB and loads the
sample database:
dbeng11 -ch 2m -n silver "samples-dir\demo.db"
Syntax
{ dbsrv11 | dbeng11 } -cl { size[ k | m | g | p ] } ...
Applies to
Windows, Unix, Mac OS X
Remarks
This option sets a lower limit to the cache. If you specify an initial cache size with the -c option, then the
minimum cache size is the same as the initial cache size. If the initial cache size is not specified, then the
default initial cache size is 2 MB on Windows and 8 MB on Unix.
The size is the amount of memory, in bytes. Use k, m, or g to specify units of kilobytes, megabytes, or
gigabytes, respectively.
The unit p is a percentage either of the physical system memory, or of the maximum non-AWE cache size,
whichever is lower. The maximum non-AWE cache size depends on the operating system. For example:
● 2.8 GB for Windows 32-bit Advanced Server, Enterprise Server and Datacenter Server
● 3.8 GB for the 32-bit database server running on Windows x64 Edition
● 1.8 GB on all other 32-bit systems
● On Windows Mobile, the p option specifies a percentage of available physical memory
If you use p, the argument is a percentage. You can use % as an alternative to P, but as most non-Unix
operating systems use % as an environment variable escape character, you must escape the % character. To
set the minimum cache size to 50 percent of the physical system memory, you would use the following:
dbeng11 -cl 50%% ...
This option is ignored if you are using an AWE cache. You can use the -cw option to create a larger cache
using AWE. See “-cw server option” on page 166.
See also
● “-c server option” on page 158
● “-ca server option” on page 159
● “-cc server option” on page 160
● “-ch server option” on page 161
● “-cm server option” on page 163
● “-cr server option” on page 164
● “-cs server option” on page 165
● “-cv server option” on page 165
● “-cw server option” on page 166
● “Limiting the memory used by the cache” [SQL Anywhere Server - SQL Usage]
Example
The following example starts a server named silver that has a minimum cache size of 5 MB and loads the
database file example.db:
dbeng11 -cl 5m -n silver "c:\example.db"
Syntax
{ dbsrv11 | dbeng11 } -cm { size[ k | m | g | p ] } ...
Applies to
Windows
Remarks
When using an AWE cache on any of the supported platforms, the database server uses its entire address
space except for 512 MB to access the cache memory. The 512 MB address space is left available for other
purposes, such as DLLs that the server must load and for non-cache memory allocations. On most systems,
the default setting is sufficient. If you need to increase or decrease the amount of reserved address space,
you can do so by specifying the -cm option. The database server displays the amount of address space it is
using in the database server messages window at startup.
The size is the amount of memory, in bytes. Use k, m, or g to specify units of kilobytes, megabytes, or
gigabytes, respectively.
The unit p is a percentage of the maximum non-AWE cache size. If you use p, the argument is a percentage.
You can use % as an alternative to P, but as most non-Unix operating systems use % as an environment
variable escape character, you must escape the % character. To set the minimum cache size to 50 percent of
the address space, you would use the following:
dbeng11 -cm 50%% ...
See also
● “-c server option” on page 158
● “-ca server option” on page 159
● “-cc server option” on page 160
● “-ch server option” on page 161
● “-cl server option” on page 162
● “-cr server option” on page 164
● “-cs server option” on page 165
● “-cv server option” on page 165
● “-cw server option” on page 166
● “Limiting the memory used by the cache” [SQL Anywhere Server - SQL Usage]
Syntax
{ dbsrv11 | dbeng11 } -cr { + | - } ...
Applies to
All operating systems and database servers.
Remarks
You can instruct the database server to warm the cache using pages that were referenced the last time the
database was started (page collection is turned on using the -cc option). Cache warming is turned on by
default. When a database is started, the server checks the database to see if it contains a collection of pages
requested the last time the database was started. If the database contains this information, the previously-
referenced pages are then loaded into the cache.
Warming the cache with pages that were referenced the last time the database was started can improve
performance when the same query or similar queries are executed against a database each time it is started.
See also
● “-cc server option” on page 160
● “-cl server option” on page 162
● “-cm server option” on page 163
● “-cs server option” on page 165
● “-cv server option” on page 165
● “-cw server option” on page 166
● “Using cache warming” [SQL Anywhere Server - SQL Usage]
Syntax
{ dbsrv11 | dbeng11 } -cs ...
Applies to
Windows, Unix
Remarks
For troubleshooting purposes, display cache information in the database server messages window whenever
the cache size changes.
See also
● “-c server option” on page 158
● “-ca server option” on page 159
● “-cc server option” on page 160
● “-ch server option” on page 161
● “-cl server option” on page 162
● “-cm server option” on page 163
● “-cr server option” on page 164
● “-cv server option” on page 165
● “-cw server option” on page 166
● “Using cache warming” [SQL Anywhere Server - SQL Usage]
Syntax
{ dbsrv11 | dbeng11 } -cv { + | - } ...
Applies to
All operating systems and database servers.
Remarks
When -cv+ is specified, a message appears in the database server messages window when any of the
following cache warming activities occur:
● collection of requested pages starts or stops (controlled by the -cc server option)
● page reloading starts or stops (controlled by the -cr server option)
See also
● “-c server option” on page 158
● “-ca server option” on page 159
● “-cc server option” on page 160
● “-ch server option” on page 161
● “-cl server option” on page 162
● “-cm server option” on page 163
● “-cr server option” on page 164
● “-cs server option” on page 165
● “-cw server option” on page 166
● “Using cache warming” [SQL Anywhere Server - SQL Usage]
Example
The following command starts the database mydatabase.db with database page collection and page loading
turned on, and logs messages about these activities to the database server messages window:
Syntax
{ dbsrv11 | dbeng11 } -cw ...
Applies to
Windows
Remarks
The amount of memory available for use as a database server cache is one of the key factors controlling
performance. Because Windows supports Address Windowing Extensions, you can use the -cw option to
take advantage of large cache sizes based on the maximum amount of physical memory in the system.
AWE caches are not supported on 64-bit SQL Anywhere database servers.
1 On Windows XP/200x, you must start the operating system using the /3GB option to use a cache of this
size.
2On Windows Vista, you must restart the operating system after running the following command as an
administrator to use a cache of this size:
bcdedit /set increaseuserva 3072
When using an AWE cache, almost all of the available physical memory in the system can be allocated for
the cache.
If you can set a cache of the required size using a non-AWE cache, this is recommended because AWE
caches allocate memory that can only be used by the database server. This means that while the database
server is running, the operating system and other applications cannot use the memory allocated for the
database server cache. AWE caches do not support dynamic cache sizing. Therefore, if an AWE cache is
used and you specify the -ch or -cl options to set the upper and lower cache size, they are ignored.
By default, 512 MB of address space is reserved for purposes other than the SQL Anywhere AWE cache
(address space is the amount of memory that can be accessed by a program at any given time). While this
amount is sufficient in most cases, you can change the amount of reserved address space using the -cm
option.
On Windows Vista, only elevated database servers can use AWE memory. If you are autostarting a database
server on Windows Vista, you must specify ELEVATE=YES in your connection string so that autostarted
database server executables are elevated. See “Elevate connection parameter” on page 264.
To start a database server with an AWE cache, you must do the following:
● On Windows Vista, you must run the database server as an administrator.
● Have at least 130 MB of memory available on your system.
● On Windows XP/200x, if your system has between 2 GB and 16 GB of memory, add the /3GB option
to the Windows boot line in the "[operating systems]" section of the boot.ini file.
On Windows Vista, if your system has between 2 GB and 16 GB of memory, you must run the following
command as an administrator:
bcdedit /set increaseuserva 3072
On Windows XP/200x, if your system has more than 16 GB of memory, do not add the /3GB option to
the Windows boot line in the [operating systems] section of the boot.ini file because Windows won't be
able to address memory beyond 16 GB.
● On Windows XP/200x, if your system has more than 4 GB of memory, add the /PAE option to the
Windows boot line in the [operating systems] section of the boot.ini file.
On Windows Vista if your system has more than 4 GB of memory, run the following command as an
administrator:
bcdedit /set pae ForceEnable
● Grant the Lock Pages in Memory privilege to the user ID under which the server is run. The following
steps explain how to do this on Windows XP.
1. Log on to Windows as an administrator.
2. Open the Control Panel.
3. Double-click Administrative Tools.
4. Double-click Local Security Policy.
5. Open Local Policies in the left pane.
6. Double-click User Rights Assignment.
7. Double-click the Lock Pages In Memory policy in the right pane.
8. Click Add User Or Group.
If you specify the -cw option and the -c option on the command line, the database server attempts the initial
cache allocation as follows:
1. The AWE cache is no larger than the cache size specified by the -c option. If the value specified by the
-c option is less than 2 MB, AWE isn't used.
2. The AWE cache is no larger than all available physical memory less 128 MB.
3. The AWE cache is no smaller than 2 MB. If this minimum amount of physical memory isn't available,
an AWE cache isn't used.
When you specify the -cw option and do not specify the -c option, the database server attempts the initial
cache allocation as follows:
1. The AWE cache uses 100% of all available memory except for 128 MB that is left free for the operating
system.
2. The AWE cache is no larger than the sum of the sizes of the main database files specified on the command
line. Additional dbspaces apart from the main database files aren't included in the calculation. If no files
are specified, this value is zero.
3. The AWE cache is no smaller than 2 MB. If this minimum amount of physical memory isn't available,
an AWE cache isn't used.
When the server uses an AWE cache, the cache page size will be no smaller than 4 KB and dynamic cache
sizing is disabled.
See “Use the cache to improve performance” [SQL Anywhere Server - SQL Usage].
See also
● “-c server option” on page 158
● “-ca server option” on page 159
● “-cc server option” on page 160
● “-ch server option” on page 161
● “-cl server option” on page 162
● “-cm server option” on page 163
● “-cr server option” on page 164
● “-cs server option” on page 165
● “-cv server option” on page 165
Example
The following example starts a server named myserver that starts with a cache size of 12 GB and loads the
database c:\test\mydemo.db:
dbeng11 -n myserver -c 12G -cw c:\test\mydemo.db
Syntax
{ dbsrv11 | dbeng11 } -dt temp-file-dir ...
Applies to
All servers and operating systems, except shared memory connections on Unix.
Remarks
SQL Anywhere creates two types of temporary files: database server-related temporary files (created on all
platforms), and communications-related temporary files (created only on Unix for both the client and the
server).
You can use the -dt option to specify a directory for database server-related temporary files. If you do not
specify this option when starting the database server, SQL Anywhere examines the following environment
variables, in the order shown, to determine the directory in which to place the temporary file.
● SATMP
● TMP
● TMPDIR
● TEMP
If none of the environment variables are defined, SQL Anywhere places its temporary file in the current
directory on Windows, and in the /tmp directory on Unix.
Temporary files for communications on Unix are not placed in the directory specified by -dt. Instead, the
environment variables are examined, and /tmp is used if none of the environment variables are defined.
See also
● “Overview of database files” on page 12
● “SATMP environment variable” on page 325
● “Place different files on different devices” [SQL Anywhere Server - SQL Usage]
● “sa_disk_free_space system procedure” [SQL Anywhere Server - SQL Reference]
● “temp_space_limit_check option [database]” on page 524
Syntax
{ dbsrv11 | dbeng11 } -ec encryption-options ...
encryption-options :
{ NONE |
SIMPLE |
TLS ( TLS_TYPE=cipher;
[ FIPS={ Y | N }; ]
IDENTITY=server-identity-filename;
IDENTITY_PASSWORD=password ) }, ...
Applies to
NONE and SIMPLE apply to all servers and operating systems.
TLS applies to all servers and operating systems, except Windows Mobile.
For information about FIPS support, see SQL Anywhere Supported Platforms and Engineering Support
Status.
Remarks
You can use this option to secure communication packets between client applications and the database server
using transport-layer security. See “Transport-layer security” on page 977.
The -ec option instructs the database server to accept only connections that are encrypted using one of the
specified types. Connections over the TDS protocol, which include Java applications using jConnect, are
always accepted regardless of the usage of the -ec option, and are never encrypted. Setting the TDS protocol
option to NO disallows these unencrypted TDS connections. See “TDS protocol option” on page 305.
By default, communication packets aren't encrypted, which poses a potential security risk. If you are
concerned about the security of network packets, use the -ec option. Encryption affects performance only
marginally. The -ec option controls the server's encryption settings and requires at least one of the following
parameters in a comma-separated list:
● NONE accepts connections that aren't encrypted.
● SIMPLE accepts connections that are encrypted with simple encryption. This type of encryption is
supported on all platforms, as well as on previous versions of SQL Anywhere. Simple encryption doesn't
provide server authentication, strong elliptic-curve or RSA encryption, or other features of transport-
layer security.
● TLS accepts connections that are encrypted. The TLS parameter accepts the following required
arguments:
○ cipher can be RSA or ECC for RSA and ECC encryption, respectively. For FIPS-approved RSA
encryption, specify TLS_TYPE=RSA;FIPS=Y. RSA FIPS uses a separate approved library, but is
compatible with clients specifying RSA with SQL Anywhere 9.0.2 or later.
For a list of supported platforms for FIPS, see SQL Anywhere Supported Platforms and Engineering
Support Status.
The cipher must match the encryption (ECC or RSA) used to create your certificates.
For information about enforcing the FIPS-approved algorithm, see “-fips server
option” on page 176.
Note
Version 10 clients cannot connect to version 9.0.2 or earlier database servers using the ECC
algorithm. If you require strong encryption for this configuration, use the RSA algorithm.
○ server-identity-filename is the path and file name of the server identity certificate. If you are using
FIPS-approved RSA encryption, you must generate your certificates using the RSA cipher.
For more information about creating the server certificate, which can be self-signed, or signed by a
Certificate Authority or enterprise root certificate, see “Creating digital certificates” on page 983.
○ password is the password for the server private key. You specify this password when you create
the server certificate.
If the database server accepts simple encryption, but does not accept unencrypted connections, then any non-
TDS connection attempts using no encryption automatically use simple encryption.
Starting the database server with -ec SIMPLE tells the database server to only accept connections using
simple encryption. TLS connections (ECC, RSA, and RSA FIPS) fail, and connections requesting no
encryption use simple encryption.
Starting the server with -ec SIMPLE,TLS(TLS_TYPE=ECC) tells the database server to only accept
connections with ECC encryption or simple encryption. Both RSA and RSA FIPS connections fail, and
connections requesting no encryption use simple encryption.
If you want the database server to accept encrypted connections over TCP/IP, but also want to be able to
connect to the database from the local computer over shared memory, you can specify the -es option along
with the -ec option when starting the database server. See “-es server option” on page 174.
The dbecc11.dll and dbrsa11.dll files contain the ECC and RSA code used for encryption and decryption.
The file dbfips11.dll contains the code for the FIPS-approved RSA algorithm. When you connect to the
database server, if the appropriate file cannot be found, or if an error occurs, a message appears on the
database server messages window. The server doesn't start if the specified types of encryption cannot be
initiated.
The client's and the server's encryption settings must match or the connection will fail except in the following
cases:
● if -ec SIMPLE is specified on the database server, but -ec NONE is not, then connections that do not
request encryption can connect and automatically use simple encryption
● if the database server specifies RSA and the client specifies FIPS, or vice versa, the connection succeeds.
In this case, the Encryption connection property returns the value specified by the database server.
See also
● “Starting the database server with transport-layer security” on page 989
● “Encryption connection parameter [ENC]” on page 266
● “-ek database option” on page 239
Example
The following example specifies that connections with no encryption and simple encryption are allowed.
The following example specifies starts a database server that uses the elliptic-curve server certificate
eccserver.id.
The following example starts a database server that uses the RSA server certificate rsaserver.id.
The following example starts a database server that uses the FIPS-approved RSA server certificate
rsaserver.id.
dbsrv11 -ec
TLS(TLS_TYPE=RSA;FIPS=Y;IDENTITY=rsaserver.id;IDENTITY_PASSWORD=test) -x
tcpip c:\mydemo.db
Syntax
{ dbsrv11 | dbeng11 } -ep ...
Applies to
All operating systems and database servers.
Remarks
The -ep option instructs the database server to make a window appear for the user to enter the encryption
key for database started on the command line that require an encryption key. This server option provides an
extra measure of security by never allowing the encryption key to be seen in clear text.
When used with the server, the user is prompted for the encryption key only if all of the following are true:
● the -ep option is specified
● the server is a Windows personal server, or the server is just starting up
● a key is required to start a database
● the server is either not a Windows service, or it is a Windows service with the interact with desktop
option turned ON
If you want to secure communication packets between client applications and the database server use the -
ec server option and transport-layer security. See “Transport-layer security” on page 977.
See also
● “Starting the database server with transport-layer security” on page 989
● “-ec server option” on page 170
● “-ek database option” on page 239
● “Encryption connection parameter [ENC]” on page 266
● “DatabaseKey connection parameter [DBKEY]” on page 260
Example
The user is prompted for the encryption key when the myencrypted.db database is started:
Syntax
{ dbsrv11 | dbeng11 } -ec encryption-options -es ...
Applies to
All servers and operating systems, except Windows Mobile.
Remarks
This option is only effective when specified with the -ec option. The -es option instructs the database server
to allow unencrypted connections over shared memory. Connections over TCP/IP must use an encryption
type specified by the -ec option. This option is useful in situations where you want remote clients to use
encrypted connections, but for performance reasons you also want to access the database from the local
computer with an unencrypted connection.
See also
● “-ec server option” on page 170
● “Starting the database server with transport-layer security” on page 989
Example
The following example specifies that connections with simple encryption are allowed, as well as unencrypted
connections over shared memory.
-f recovery option
Forces the database server to start after the transaction log has been lost.
Syntax
{ dbsrv11 | dbeng11 } -f ...
Applies to
All operating systems and database servers.
Remarks
Caution
This option is for use in recovery situations only.
If there is no transaction log, the database server performs a checkpoint recovery of the database and then
shuts down—it doesn't continue to run. You can then restart the database server without the -f option for
normal operation.
If there is a transaction log in the same directory as the database, the database server performs a checkpoint
recovery, and a recovery using the transaction log, and then shuts down—it doesn't continue to run. You can
then restart the database server without the -f option for normal operation.
Specifying a cache size when starting the server can reduce recovery time.
See also
● “Running in special modes” on page 40
● “Introduction to backup and recovery” on page 848
Example
The following command forces the database server to start and perform a recovery of the database
mydatabase.db:
dbeng11 mydatabase.db -f
Syntax
{ dbsrv11 | dbeng11 } -fc filename ...
Applies to
All operating systems and database servers.
Remarks
This option can be used to notify users, and possibly take corrective action, when a file system full condition
is encountered. If you use the -fc option, the database server attempts to load the specified DLL and resolve
the entry point of the callback function during startup. If the SQL Anywhere database server cannot find
both the DLL and the entry point, the database server returns an error and shuts down. The DLL is user-
supplied and can use the callback to, among other things, invoke a batch file (or shell script on Unix) you
have supplied to take diagnostic or corrective action. Alternatively, the callback function itself can perform
such an action.
A sample disk full callback function is located in samples-dir\SQLAnywhere\DiskFull.
For information about samples-dir, see “Samples directory” on page 336.
SQL Anywhere searches for the callback function DLL in the same locations as it searches for other DLLs
and files.
For more information about where SQL Anywhere searches for files, see “How SQL Anywhere locates
files” on page 338.
When the database server detects a disk full condition, it invokes the callback function (if one has been
provided), passing it the following information:
● the name of the dbspace where the condition was triggered
● the operating system-specific error code from the failed operation
The return code from the call to xp_out_of_disk indicates whether the operation that caused the condition
should be aborted or retried. If a non-zero value is returned, the operation is aborted, otherwise it is retried.
The callback function is invoked repeatedly as long as it returns zero and the file system operation fails.
On Windows platforms, if the database server has been started with a database server messages window
(neither -qi nor -qw have been specified), and a callback DLL has not been provided, a window appears
when a disk full condition occurs. This window contains the dbspace name and error code, and allows the
user to choose whether the operation that caused the disk full condition should be retried or aborted.
On all other operating systems, when -fc isn't specified and a disk full condition is encountered, a fatal error
occurs.
You can create system events to track the available disk space of devices holding the database file, the log
file, or the temporary file and alert administrators in case of a disk space shortage.
See “CREATE EVENT statement” [SQL Anywhere Server - SQL Reference].
See also
● “Using callback functions” [SQL Anywhere Server - Programming]
● “Understanding system events” on page 902
● “max_temp_space option [database]” on page 492
● “temp_space_limit_check option [database]” on page 524
Example
When the database server starts, it attempts to load the diskfull.dll DLL.
dbeng11 -fc diskfull.dll
Requires that only FIPS-approved algorithms should be used for strong database and communication
encryption.
Syntax
{ dbsrv11 | dbeng11 } -fips ...
Applies to
Windows
Remarks
Specifying this option forces all server encryption to use FIPS-approved algorithms. This option applies to
strong database encryption, client/server transport-layer security, and web services transport-layer security.
You can still use unencrypted connections and databases when the -fips option is specified, but you cannot
use simple encryption.
For strong database encryption, the -fips option causes new databases to use the AES_FIPS type, even if
AES is specified in the ALGORITHM clause of the CREATE DATABASE statement.
When the database server is started with -fips, you can run databases encrypted with AES, AES256,
AES_FIPS, or AES256_FIPS strong encryption, but not databases encrypted with simple encryption.
Unencrypted databases can also be started on the server when -fips is specified.
The SQL Anywhere security option must be installed on any computer used to run a database encrypted
with AES_FIPS or AES256_FIPS.
For SQL Anywhere transport-layer security, the -fips option causes the server to use the FIPS-approved
RSA encryption cipher, even if RSA is specified. If ECC is specified, an error occurs because a FIPS-
approved elliptic-curve algorithm is not available.
For transport-layer security for web services, the -fips option causes the server to use HTTPS FIPS, even if
HTTPS is specified.
When you specify -fips, the ENCRYPT and HASH functions use the FIPS-approved RSA encryption cipher,
and password hashing uses the SHA-256 FIPS algorithm rather than the SHA-256 algorithm.
See also
● “Strong encryption” on page 965
● “Transport-layer security” on page 977
● “Encrypting SQL Anywhere web services” on page 994
● “-ec server option” on page 170
● “ENCRYPT function [String]” [SQL Anywhere Server - SQL Reference]
● “HASH function [String]” [SQL Anywhere Server - SQL Reference]
Syntax
{ dbsrv11 | dbeng11 } -ga ...
Applies to
All operating systems.
Remarks
Specifying this option on the network server causes each database to be unloaded after the last non-HTTP
client connection disconnects. In addition to unloading each database after the last non-HTTP connection
disconnects, the database server shuts down when the last database is stopped.
If the only connection to a database is an HTTP connection, and the database is configured to stop
automatically, when the HTTP connection disconnects, the database is not unloaded. As well, if you specify
the -ga option, and the database has an HTTP connection and a command sequence or TDS connection,
when the last command sequence or TDS connection disconnects, the database autostops, and any HTTP
connections are dropped.
See also
● “Rebuilding databases” [SQL Anywhere Server - SQL Usage]
● “AutoStop connection parameter [ASTOP]” on page 251
Windows syntax
{ dbsrv11 | dbeng11 } -gb { idle | normal | high | maximum } ...
Unix syntax
{ dbsrv11 | dbeng11 } -gb level ...
Applies to
Windows, Unix, Mac OS X
Remarks
This option sets the server process priority class.
On Windows, normal and high are the commonly-used settings. The value idle is provided for completeness,
and maximum may interfere with the running of your computer.
On Unix, the level is an integer from -20 to 19. The default value on Unix is the same as the nice value of
the parent process. Lower level values represent a more favorable scheduling priority. All restrictions placed
on setting a nice value apply to the -gb option. For example, on most Unix platforms, only the root user can
lower the priority level of a process (for example, changing it from 0 to -1).
Syntax
{ dbsrv11 | dbeng11 } -gc minutes ...
Applies to
All operating systems and database servers.
Remarks
Set the maximum length of time in minutes that the database server runs without doing a checkpoint on each
database.
The default value is the setting of the checkpoint_time database option, which defaults to 60 minutes. If a
value of 0 is entered, the default value of 60 minutes is used.
Checkpoints generally occur more frequently than the specified time.
See “How the database server decides when to checkpoint” on page 872.
See also
● “checkpoint_time option [database]” on page 457
● “Checkpoints and the checkpoint log” on page 869
● “How the database server decides when to checkpoint” on page 872
Syntax
{ dbsrv11 | dbeng11 } -gd { DBA | all | none } ...
Applies to
All operating systems and database servers.
Remarks
This is the permission required for a user to cause a new database file to be loaded by the server, or to stop
a database on a running database server. The level can be one of the following:
● DBA Only users with DBA authority can start or stop databases.
● all All users can start or stop databases.
● none Starting and stopping databases isn't allowed apart from when the database server itself is started
and stopped.
The default setting is all for the personal database server, and DBA for the network database server. Both
uppercase and lowercase syntax is acceptable.
Note that when this option is set to DBA, the client application must already have a connection to the server
to start or stop a database. Providing a DBA user ID and password on a new connection isn't sufficient.
You can obtain the setting of the -gd option using the StartDBPermission server property:
SELECT PROPERTY ( 'StartDBPermission' );
See also
● “Permissions overview” on page 398
Example
The following steps illustrates how to use the -gd option for the network database server.
1. Start the network database server:
dbsrv11 -x tcpip -su mypwd -n myserver -gd DBA
2. Connect to the utility database from Interactive SQL:
dbisql -c "UID=DBA;PWD=mypwd;ENG=myserver;DBN=utility_db"
3. Start a database:
START DATABASE demo
ON myserver;
4. Connect to the database you have started:
CONNECT
TO myserver
DATABASE demo
USER DBA IDENTIFIED BY sql;
Syntax
{ dbsrv11 | dbeng11 } -ge integer ...
Applies to
Windows
Remarks
Sets the stack size for threads running external functions, in bytes. The default is 32 KB.
See also
● “Controlling threading behavior” on page 43
Syntax
{ dbsrv11 | dbeng11 } -gf ...
Applies to
All operating systems and database servers.
Remarks
The -gf server option instructs the server to disable the firing of triggers.
See also
● “fire_triggers option [compatibility]” on page 474
● “Introduction to triggers” [SQL Anywhere Server - SQL Usage]
Syntax
{ dbsrv11 | dbeng11 } -gk { DBA | all | none } ...
Applies to
All operating systems and database servers.
Remarks
The allowed values include:
● DBA Only users with DBA authority can use dbstop to stop the server. This is the default for the
network server.
● all All users can use dbstop to stop the server. This is the default for the personal server.
● none The server cannot be stopped using dbstop.
See also
● “Stop Server utility (dbstop)” on page 762
Syntax
{ dbsrv11 | dbeng11 } -gl { DBA | all | none } ...
Applies to
All operating systems and database servers.
Remarks
Using the UNLOAD TABLE or UNLOAD statement places data in files on the database server computer,
and the LOAD TABLE statement reads files from the database server computer.
To control access to the file system using these statements, the -gl server option allows you to control the
level of database permission that is required to use these statements.
The allowed values are as follows:
● DBA Only users with DBA authority can load or unload data from the database.
● all All users can load or unload data from the database.
● none Data cannot be unloaded or loaded.
See also
● “LOAD TABLE statement” [SQL Anywhere Server - SQL Reference]
● “UNLOAD statement” [SQL Anywhere Server - SQL Reference]
Syntax
{ dbsrv11 | dbeng11 } -gm integer ...
Applies to
All operating systems and database servers.
Remarks
Defines the connection limit for the server. If this number is greater than the number that is allowed under
licensing and memory constraints, it has no effect.
The database server allows one extra DBA connection above the connection limit to allow a user with DBA
authority to connect to the server and drop other connections in an emergency.
Syntax
{ dbsrv11 | dbeng11 } -gn integer ...
Applies to
All operating systems and database servers.
Remarks
This option sets the maximum multiprogramming level of the database server. It limits the number of tasks
(both user and system requests) that the database server can execute concurrently. If the database server
receives an additional request while at this limit, the new request must wait until an executing task completes.
The maximum number of combined unscheduled and active requests is limited by the -gm server option,
which limits the number of connections to the server.
Setting the -gn value too high can result in errors because the system resources for the database server are
consumed by the large -gn value.
The default value is 20 active tasks for both the network database server and the personal database server,
except on Windows Mobile where the default is 3, and the number of active tasks that can execute
simultaneously depends on the number of database server threads and the number of logical processors in
use.
The database server's kernel uses tasks as the scheduling unit. The execution of any user request requires at
least one task. However, a request may cause the scheduling of additional tasks on its behalf. One example
of this is if the request involves the execution of a Java stored procedure or function that in turn makes
database requests back into the database server.
When intra-query parallelism is involved, each access plan component executed in parallel is a task.
Consequently, these tasks count toward the -gn limit as if they were actually separate requests. However,
tasks created for intra-query parallelism are not reflected in the database properties that track the number of
active and inactive requests.
Caution
A stack of the size specified by -gss is allocated for each database server task, and the maximum number of
tasks is specified by the -gn option. If you set both -gss and -gn to a high value, then the database server may
not be able to start, or the size of the cache can be limited significantly. For example if you specified -gss
16M and -gn 100 when starting the database server, then 1.6 GB of memory would be reserved just for
stacks.
See also
● “Threading in SQL Anywhere” on page 41
● “Setting the database server's multiprogramming level” on page 44
● “max_query_tasks option [database]” on page 489
● “-gm server option” on page 182
● “-gm server option” on page 182
● “-gtc server option” on page 187
Syntax
{ dbsrv11 | dbeng11 } -gp { 2048 | 4096 | 8192 | 16384 | 32768 } ...
Applies to
All operating systems and database servers.
Remarks
Database files with a page size larger than the page size of the server cannot be loaded. This option explicitly
sets the page size of the server, in bytes.
If you do not use this option, then the page size of the first database on the command line is used.
On all platforms, if you do not use this option and start a server with no databases loaded, the default value
is 4096.
See also
● “Table and page sizes” [SQL Anywhere Server - SQL Usage]
● “Setting a maximum page size” on page 40
Syntax
{ dbsrv11 | dbeng11 } -gr minutes ...
Applies to
All operating systems and database servers.
Remarks
When a database server is running with multiple databases, the recovery time that is specified by the first
database started is used unless overridden by this option.
The value specified by the -gr option instructs the database server how often to perform a checkpoint. For
example, if you set -gr to 5, then the database sever tries to perform checkpoints often enough so that recovery
takes no longer than 5 minutes. However, if recovery is necessary, it runs to completion, even if it takes
longer than the length of time specified by -gr. The default value is the setting of the recovery_time database
option, which defaults to 2 minutes.
The recovery time includes both the estimated recovery time and the estimated checkpoint time for the
database.
See also
● “recovery_time option [database]” on page 509
● “How the database server decides when to checkpoint” on page 872
Syntax
{ dbsrv11 | dbeng11 } -gss { integer[ k | m ] } ...
Applies to
All operating systems and servers. For Windows, this option is supported on Windows XP and later.
Remarks
The number of internal execution threads is controlled by the -gn option and has a default value of 20. The
-gss option allows you to lower the memory usage of the database server in environments with limited
memory.
The size is the amount of memory to use, in bytes. Use k or m to specify units of kilobytes or megabytes,
respectively.
Caution
A stack of the size specified by -gss is allocated for each database server task, and the maximum number of
tasks is specified by the -gn option. If you set both -gss and -gn to a high value, then the database server may
not be able to start, or the size of the cache can be limited significantly. For example if you specified -gss
16M and -gn 100 when starting the database server, then 1.6 GB of memory would be reserved just for
stacks.
On Windows XP and later, the default stack size used by the database server is 1 MB on 32-bit operating
systems, and 4 MB on 64-bit operating systems. The maximum stack size used by the database server is 16
MB on 32-bit operating systems, and 256 MB on 64-bit operating systems. This option is ignored on
Windows 2000.
On Unix, the default and minimum stack size per internal execution thread is 500 KB, and the maximum
stack size is 4 MB.
This option is supported on PocketPC 2003 and later. On supported Windows Mobile platforms, the default
and minimum stack size is 64 KB and the maximum stack size is 512 KB. On earlier Windows Mobile
platforms, 1MB per thread of address space is reserved.
See also
● “Threading in SQL Anywhere” on page 41
Syntax
{ dbsrv11 | dbeng11 } -gt integer ...
Applies to
Windows (except Windows Mobile), Linux, and Solaris.
Remarks
With per-seat licensing, the network database server uses all CPUs available on the computer (the default).
With CPU-based licensing, the network database server uses only the number of processors you are licensed
for. In addition, the personal database server and runtime database server are both limited to a single
processor.
When you specify a value for the -gt option, the database server adjusts its affinity mask (if supported on
that hardware platform) to restrict the database server to run on only that number of physical processors. If
the database server is licensed for n processors, the server will, by default, run on all logical processors
(hyperthreads and cores) of n physical processors. This can be further restricted with the -gtc option.
Valid values for the -gt option are between 1 and the minimum of:
● the number of physical processors on the computer
● the maximum number of CPUs that the server is licensed for if CPU-licensing is in effect
If the -gt value specified lies outside this range, the lower or upper limit is imposed. For the personal database
server (dbeng11) the server uses a -gt value of 1.
See also
● “-gn server option” on page 183
● “-gtc server option” on page 187
Syntax
{ dbsrv11 | dbeng11 } -gtc logical-processors-to-use ...
Applies to
Linux, Solaris, and Windows operating systems executing on Intel-compatible x86 and x64 platforms,
excluding Windows Mobile.
Remarks
When you start the database server, the number of physical and logical processors detected by the database
server appears in the database server messages window.
Physical processors are sometimes referred to as packages or dies, and are the CPUs of the computer.
Additional logical processors exist when the physical processors support hyperthreading or are themselves
configured as multiprocessors (usually referred to as multi-core processors). The operating system
schedules threads on logical processors.
The -gtc option allows you to specify the number of logical processors that can be used by the database
server. Its effect is to limit the number of database server threads that are created at server startup. This limits
the number of active database server tasks that can execute concurrently at any one time. By default, the
number of threads created is 1 + the number of logical processors on all licensed physical processors.
By default, the database server allows concurrent use of all logical processors (cores or hyperthreads) on
each licensed physical processor. For example, on a single-CPU system that supports hyperthreading, by
default the database server permits two threads to run concurrently on one physical processor. If the -gtc
option is specified, and the number of logical processors to be used is less than the total available for the
number of physical processors that are licensed, then the database server allocates logical processors based
on round-robin assignment. Specifying 1 for the -gtc option implicitly disables intra-query parallelism
(parallel processing of individual queries). Intra-query parallelism can also be explicitly limited or disabled
outright using the max_query_tasks option. See “max_query_tasks option [database]” on page 489.
See also
● “-gn server option” on page 183
● “-gt server option” on page 186
● “Parallelism during query execution” [SQL Anywhere Server - SQL Usage]
● “Threading in SQL Anywhere” on page 41
Example
Consider the following examples for a Windows-based SMP computer. In each case, assume a 4-processor
system with 2 cores on each physical processor (hence 8 logical processors). The physical processors are
identified with letters and the logical processors (cores in this case) are identified with numbers. This 4-
processor system therefore has processing units A0, A1, B0, B1, C0, C1, D0, and D1.
Syntax
{ dbsrv11 | dbeng11 } -gu { all | none | DBA | utility_db } ...
Applies to
All operating systems and database servers.
Remarks
Sets permission levels for utility commands such as CREATE DATABASE and DROP DATABASE. The
level can be set to one of the following: utility_db, all, none, or DBA. The default is DBA.
The utility_db level restricts the use of these commands to only those users who can connect to the utility
database. The all, none, and DBA levels permit all users, no users, or users with DBA authority, respectively,
to execute utility commands.
See also
● “Specifying the permissions required to execute file administration statements” on page 24
Syntax
{ dbsrv11 | dbeng11 } -im { c | nw } ...
Applies to
All operating systems and database servers.
Remarks
This feature is most useful on systems with a large amount of available memory, typically enough to hold
all of the database files within the cache. There are two in-memory modes available:
● Checkpoint only (-im c) When running in checkpoint-only mode, the database server does not use
a transaction log, so you cannot recover to the most recent committed transaction. However, because the
checkpoint log is enabled, the database can be recovered to the most recent checkpoint. Normally when
you run a database without a transaction log, the database server still performs a checkpoint on a commit,
which affects performance. However, when you run the database server in checkpoint only mode, the
database server does not perform a checkpoint after each commit.
This mode is useful in applications where increased performance is desirable, and the loss of committed
transactions after the most recent checkpoint is acceptable.
The following restrictions apply when running in checkpoint-only mode:
1. There is no transaction log.
2. There is no temporary file.
3. Checkpoints are allowed both on demand and at the database server's normal checkpoint frequency.
4. Dirty pages are flushed to disk only on checkpoint.
● Never write (-im nw) When running in never write mode, committed transactions are not be written
to the database file on disk. All changes are lost if the database is shut down or crashes, so database files
are always left in their original state. Requests to extend or create new dbspaces are allowed, but the
changes are not reflected in the database files. You can create and use new dbspaces, but they are not
written to disk, and if you back up the database, the backup does not contain these dbspaces.
The following restrictions apply when running in never write mode:
1. There is no transaction log.
2. There is no checkpoint log.
3. There is no temporary file.
4. Dirty database pages are never flushed to disk.
Because changes are never written to the original database files, if a persistent copy of current database
contents is required, you must use the dbunload utility or the UNLOAD TABLE statement. You can also
use SQL queries to retrieve the changes, but you must then manually write these changes to the database
file.
The performance benefits gained from in-memory mode depend on the application workload and the speed
of the I/O subsystem. The largest performance gains will be seen in applications that insert or update large
amounts of data, as well as applications that commit and checkpoint frequently.
In many cases, performance of the in-memory modes is on par with, or better than the performance of using
transactional global temporary tables. The smallest performance improvement may be seen with applications
that predominately query the database. In general, when using in-memory mode, the best performance can
be achieved by pre-growing the cache to an amount large enough to hold the full expected contents of the
database files. This eliminates much of the overhead involved in growing the cache in increments while the
application is running.
Caution
Since pages are not flushed from cache in never write mode, it is possible to exhaust the available cache if
the amount of data in the database grows too large. When this happens, SQL Anywhere issues an error and
stops processing requests. For this reason, never write mode should be used with caution, and always with
a cache large enough to hold the expected complete working set of pages that an application may use. Since
checkpoints continue to occur in the “checkpoint only” mode, there is a reduced risk of the server running
out of available cache as compared to the “never write” mode.
See also
● “Separately licensed components” [SQL Anywhere 11 - Introduction]
● “-c server option” on page 158
-k server option
Controls the collection of Performance Monitor statistics.
Syntax
{ dbsrv11 | dbeng11 } -k ...
Applies to
All operating systems and database servers.
Remarks
The database server collects Performance Monitor statistics by default.
If you specify -k when you start the database server, then the server does not collect Performance Monitor
statistics. The -k option does not affect the collection of column statistics used by the query optimizer.
This option should only be used in situations where the database server is running on a multi-processor
computer where it can be shown by testing to improve performance. For most workloads, the benefit will
be negligible, so use of this option is not recommended. When you disable the performance counters, this
information is not available for analyzing performance problems.
You can also change the setting for the collection of Performance Monitor statistics using the
sa_server_option system procedure. See “sa_server_option system procedure” [SQL Anywhere Server - SQL
Reference].
See also
● “-ks server option” on page 193
● “-ksc server option” on page 194
● “-ksd server option” on page 194
● “Monitoring statistics using Sybase Central Performance Monitor” [SQL Anywhere Server - SQL
Usage]
Syntax
{ dbsrv11 | dbeng11 } -kl GSS-API-library-file ...
Applies to
All operating systems except Windows Mobile.
Remarks
This option specifies the location and name of the Kerberos GSS-API. This option is only required if the
Kerberos client uses a different file name for the Kerberos GSS-API library than the default, or if there are
multiple GSS-API libraries installed on the computer running the database server. A Kerberos client must
already be installed and configured, and SSPI cannot be used by the database server.
Specifying this option enables Kerberos authentication to the database server.
See also
● “-kr server option” on page 192
● “-krb server option” on page 192
● “Kerberos connection parameter [KRB]” on page 270
● “Using Kerberos authentication” on page 121
● “GRANT statement” [SQL Anywhere Server - SQL Reference]
Example
The following command starts a database server that uses the libgssapi_krb5.so shared object for Kerberos
authentication.
dbsrv11 -kl libgssapi_krb5.so -n my_server_princ /opt/myapp/kerberos.db
Syntax
{ dbsrv11 | dbeng11 } -kr server-realm ...
Applies to
All operating systems except Windows Mobile.
Remarks
This option specifies the realm of the Kerberos server principal. Normally, the principal used by the database
server for Kerberos authentication is server-name@default-realm, where default-realm is the default realm
configured for the Kerberos client. Use this option if you want the server principal to use a different realm
than the default realm, in which case the server principal used is server-name@server-realm.
Specifying this option enables Kerberos authentication to the database server.
See also
● “-kl server option” on page 191
● “-krb server option” on page 192
● “Kerberos connection parameter [KRB]” on page 270
● “Using Kerberos authentication” on page 121
● “GRANT statement” [SQL Anywhere Server - SQL Reference]
Example
The following command starts a database server that accepts Kerberos logins and uses the principal
my_server_princ@MYREALM for authentication.
dbeng11 -kr MYREALM -n my_server_princ C:\kerberos.db
Syntax
{ dbsrv11 | dbeng11 } -krb ...
Applies to
All operating systems except Windows Mobile.
Remarks
This option enables Kerberos authentication to the database server. You must specify one or more of the -
krb, -kl, and -kr options for the database server to be able to authenticate clients using Kerberos.
Before you can use Kerberos authentication, a Kerberos client must already be installed and configured on
both the client and database server computers. Additionally, the principal server-name@REALM must already
exist in the Kerberos KDC, and the keytab for the principal server-name@REALM must already have been
securely extracted to the keytab file on the database server computer. The database server will not start if
the -krb option is specified, but this setup has not been performed.
Note
The database server name cannot contain any of the following characters: /, \, or @, and database server
names with multibyte characters cannot be used with Kerberos.
The login_mode database option must be set to allow Kerberos logins, and Kerberos client principals must
be mapped to database user IDs using the GRANT KERBEROS LOGIN statement.
See also
● “-kl server option” on page 191
● “-kr server option” on page 192
● “Kerberos connection parameter [KRB]” on page 270
● “Using Kerberos authentication” on page 121
● “GRANT statement” [SQL Anywhere Server - SQL Reference]
Example
For a Kerberos principal for the database server named my_server_princ@MYREALM, the following
command starts a database server named my_server_princ.
dbsrv11 -krb -n my_server_princ C:\kerberos.db
Syntax
{ dbsrv11 | dbeng11 } -ks 0 ...
Applies to
Windows
Remarks
When you specify this option, the Performance Monitor does not show any server, database, or connection
statistics for the current database server.
See also
● “Monitoring statistics using Sybase Central Performance Monitor” [SQL Anywhere Server - SQL
Usage]
● “-k server option” on page 190
Syntax
{ dbsrv11 | dbeng11 } -ksc integer ...
Applies to
Windows
Remarks
By default, the Performance Monitor monitors 10 connections.
See also
● “Monitoring statistics using Sybase Central Performance Monitor” [SQL Anywhere Server - SQL
Usage]
● “-k server option” on page 190
● “-ks server option” on page 193
● “-ksd server option” on page 194
Syntax
{ dbsrv11 | dbeng11 } -ksd integer ...
Applies to
Windows
Remarks
By default, the Performance Monitor monitors two databases.
See also
● “Monitoring statistics using Sybase Central Performance Monitor” [SQL Anywhere Server - SQL
Usage]
● “-k server option” on page 190
● “-ks server option” on page 193
● “-ksc server option” on page 194
-m server option
Truncates the transaction log when a checkpoint is done.
Syntax
{ dbsrv11 | dbeng11 } -m ...
Applies to
All operating systems and database servers.
Remarks
This option truncates the transaction log when a checkpoint is done, either at shutdown or as a result of a
checkpoint scheduled by the server.
Caution
When this option is selected, there is no protection against media failure on the device that contains the
database files.
This option provides a way to automatically limit the growth of the transaction log. Checkpoint frequency
is still controlled by the checkpoint_time and recovery_time options (which you can also set on the command
line).
The -m option is useful for limiting the size of the transaction log in situations where high volume transactions
requiring fast response times are being processed, and the contents of the transaction log aren't being relied
upon for recovery or replication. The -m option provides an alternative to operating without a transaction
log at all, in which case a checkpoint would be required following each COMMIT and performance would
suffer as a result. When the -m option is specified, there is no protection against media failure on the device
that contains the database files. Other alternatives for managing the transaction log (for example, using the
BACKUP statement and events) should be considered before using the -m option.
To avoid database file fragmentation, it is recommended that where this option is used, the transaction log
be placed on a separate device or partition from the database itself.
When this option is used, no operations can proceed while a checkpoint is in progress.
Caution
Do not use the -m option with databases that are being replicated or synchronized. Replication and
synchronization, used by SQL Remote and MobiLink, inherently rely on transaction log information.
See also
● “-m database option” on page 239
● “The transaction log” on page 852
● “Transaction Log utility (dblog)” on page 773
● “checkpoint_time option [database]” on page 457
● “recovery_time option [database]” on page 509
-n server option
Sets the name of the database server.
Syntax
{ dbsrv11 | dbeng11 } -n server-name database-filename...
Applies to
All operating systems and database servers.
Remarks
By default, the database server receives the name of the first database file with the path and extension
removed. For example, if the server is started on the file samples-dir\demo.db and no -n option is specified,
the name of the server is demo.
There is no character set conversion performed on the server name. If the client character set and the database
server character set are different, using extended characters in the server name can cause the server to not
be found. If your clients and servers are running on different operating systems or locales, you should use
7-bit ASCII characters in the server name. See “Connection strings and character sets” on page 356.
Database server names must be valid identifiers. Long database server names are truncated to different
lengths depending on the protocol. Database server names cannot:
● begin with white space, single quotes, or double quotes
● end with white space
● contain semicolons
● be longer than 250 bytes
Note
On Windows and Unix, version 9.0.2 and earlier clients cannot connect to version 10.0.0 and later database
servers with names longer than the following lengths:
● 40 bytes for Windows shared memory
● 31 bytes for Unix shared memory
● 40 bytes for TCP/IP
The server name specifies the name to be used in the ServerName (ENG) connection parameter of client
application connection strings or profiles. With shared memory, there is a default database server that is used
if no server name is specified, provided that at least one database server is running on the computer.
Running multiple database servers with the same name is not recommended.
See also
● “Identifiers” [SQL Anywhere Server - SQL Reference]
● “ServerName connection parameter [ENG]” on page 281
● “Naming the server and the databases” on page 37
-o server option
Prints all database server messages to the database server message log file.
Syntax
{ dbsrv11 | dbeng11 } -o filename ...
Applies to
All operating systems and database servers.
Remarks
Print all database server messages, including informational messages, errors, warnings, and MESSAGE
statement output, to the specified file, as well as to the database server messages window. If you specify the
-qi option with -o, all messages appear only in the database server message log file.
It is recommended that you do not end the file name with .log because this can create problems for utilities
that perform operations using the transaction log.
You can obtain the name of the database server message log file by executing the following command:
SELECT PROPERTY ( 'ConsoleLogFile' );
See also
● “Logging database server actions” on page 34
● “-oe server option” on page 197
● “-on server option” on page 198
● “-os server option” on page 199
● “-ot server option” on page 200
● “-qi server option” on page 202
Specifies a file name to log startup errors, fatal errors, and assertions.
Syntax
{ dbsrv11 | dbeng11 } -oe filename ...
Applies to
All operating systems and database servers.
Remarks
Each line in the output log file is prefixed with the date and time. Startup errors include such errors as:
● Couldn't open/read database file: database file
● A database server with that name has already started
Fatal errors and assertions are logged to the Windows Application Event Log (except on Windows Mobile)
or the Unix system log regardless of whether -oe is specified.
It is recommended that you do not end the file name with .log because this can create problems for utilities
that perform operations using the transaction log.
See also
● “-o server option” on page 197
● “-on server option” on page 198
● “-os server option” on page 199
● “-ot server option” on page 200
● “-qi server option” on page 202
Syntax
{ dbsrv11 | dbeng11 } -on { size[ k | m | g ] } ...
Applies to
All operating systems and database servers.
Remarks
The size is the maximum file size for the database server message log, in bytes. Use k, m, or g to specify
units of kilobytes, megabytes, or gigabytes respectively. The minimum size limit is 10 KB. By default, there
is no maximum size limit.
When the database server message log reaches the specified size, the database server renames the file with
the extension .old, and starts a new file with the original name.
Note
If the .old database server message log file already exists, it is overwritten. To avoid losing old database
server message log files, use the -os option instead.
See also
● “Logging database server actions” on page 34
● “-o server option” on page 197
● “-oe server option” on page 197
● “-os server option” on page 199
● “-ot server option” on page 200
Syntax
{ dbsrv11 | dbeng11 } -os { size[ k | m | g ] } ...
Applies to
All operating systems and database servers.
Remarks
The size is the maximum file size for logging database server messages, in bytes. Use k, m, or g to specify
units of kilobytes, megabytes, or gigabytes respectively. The minimum size limit is 10 KB. By default, there
is no maximum size limit.
Before the database server logs output messages to the database server message log file, it checks the current
file size. If the log message will make the file size exceed the specified size, the database server renames
the database server message log file to yymmddxx.slg, where yymmdd represents the year, month, and day
the file was created, and xx is a number that starts at 00 and continues incrementing.
This option allows you to identify old database server message log files that can be deleted to free up disk
space.
This option cannot be used with the -on option.
It is recommended that you do not end the database server message log file name with .log because this can
create problems for utilities that perform operations using the transaction log.
See also
● “Logging database server actions” on page 34
● “-o server option” on page 197
Syntax
{ dbsrv11 | dbeng11 } -ot logfile ...
Applies to
All operating systems and database servers.
Remarks
The functionality is the same as the -o option except the database server message log file is truncated before
any messages are written to it. You can obtain the name of the database server message log file using the
following command:
SELECT PROPERTY ( 'ConsoleLogFile' );
It is recommended that you do not end the database server message log file name with .log because this can
create problems for utilities that perform operations using the transaction log.
See also
● “Logging database server actions” on page 34
● “-o server option” on page 197
● “-oe server option” on page 197
● “-on server option” on page 198
● “-os server option” on page 199
-p server option
Sets the maximum size of communication packets.
Syntax
{ dbsrv11 | dbeng11 } -p integer ...
Applies to
All operating systems and database servers.
Remarks
The default is 7300 bytes on all operating systems except Windows Mobile. On Windows Mobile, the default
is 1460 bytes. The minimum value is 500 bytes and the maximum value is 16000.
You can change the communication buffer size for a connection by setting the CommBufferSize (CBSIZE)
connection parameter.
See also
● “-pc server option” on page 201
● “-pt server option” on page 201
● “CommBufferSize connection parameter [CBSIZE]” on page 253
Syntax
dbsrv11 -pc ...
Applies to
All operating systems and network servers, except web servers.
Remarks
The packets sent between a SQL Anywhere client and server can be compressed using the -pc option.
Compressing a connection may improve performance under some circumstances. Large data transfers with
highly compressible data tend to get the best compression rates. This option can be overridden for a particular
client by specifying COMPRESS=NO in the client's connection parameters.
By default, connections are not compressed. Specifying the -pc option compresses all connections except
same-computer connections, web services connections, and TDS connections. TDS connections (including
jConnect) do not support SQL Anywhere communication compression.
Same-computer connections over any communication link are not compressed, even if the -pc option or
COMPRESS=YES connection parameter is used.
See also
● “-p server option” on page 200
● “-pt server option” on page 201
● “Adjusting communication compression settings to improve performance” on page 141
● “Compress connection parameter [COMP]” on page 255
● “Use the compression features” [SQL Anywhere Server - SQL Usage]
Syntax
dbsrv11 -pt size ...
Applies to
All operating systems and network servers.
Remarks
This parameter takes an integer value representing the minimum byte-size of packets to be compressed.
Values less than 80 are not recommended. The default is 120 bytes.
Under some circumstances, changing the compression threshold can help performance of a compressed
connection by allowing you to compress packets only when compression will increase the speed at which
the packets are transferred. The default setting should be appropriate for most cases.
If both client and server specify different compression threshold settings, the client setting applies.
See also
● “-p server option” on page 200
● “-pc server option” on page 201
● “Adjusting communication compression settings to improve performance” on page 141
● “CompressionThreshold connection parameter [COMPTH]” on page 257
● “Use the compression features” [SQL Anywhere Server - SQL Usage]
Syntax
{ dbsrv11 | dbeng11 } -qi ...
Applies to
Windows
Remarks
This option leaves no visual indication that the server is running, other than possible startup error windows.
You can use either (or both) the -o or -oe log files to diagnose errors.
See also
● “-qn server option” on page 202
● “-qp server option” on page 203
● “-qs server option” on page 204
● “-qw server option” on page 204
● “-o server option” on page 197
● “-oe server option” on page 197
Syntax
{ dbsrv11 | dbeng11 } -qn ...
Applies to
Windows
Linux (if X window server is used)
Remarks
By default, the database server messages window automatically minimizes once database server startup
completes. When this option is specified, the database server messages window does not minimize after the
database server starts.
The database server messages window may appear in the background if an application autostarting the
database server it is not active and -qn is specified.
On Linux, you must specify the -ux option (use X window server) with the -qn option.
See also
● “-ux server option” on page 220
● “-qi server option” on page 202
● “-qp server option” on page 203
● “-qs server option” on page 204
● “-qw server option” on page 204
Example
The following command starts the database server on Linux or Solaris, displays the database server messages
window, and does not minimize the database server messages window once the database server is started:
dbeng11 -ux -qn sample.db
Syntax
{ dbsrv11 | dbeng11 } -qp ...
Applies to
All operating systems and database servers.
Remarks
Do not display messages about performance in the database server messages window. Messages that are
suppressed include the following:
● No unique index or primary key for table 'table-name'
● Database file "mydatabase.db" consists of nnn fragments
See also
● “-qi server option” on page 202
● “-qn server option” on page 202
● “-qs server option” on page 204
● “-qw server option” on page 204
Syntax
{ dbsrv11 | dbeng11 } -qs ...
Applies to
Windows
Remarks
This option suppresses startup error windows. Startup errors include errors such as:
● Couldn't open/read database file: database-file
● A database server with that name has already started
On Windows platforms, if the server isn't being autostarted, these errors appear in a window and must be
cleared before the server stops. These windows do not appear if the -qs option is used.
If there is an error loading the language DLL, no window appears if -qs was specified on the command line
and not in @data. This error isn't logged to the -o or -oe logs, but rather to the Windows Application Event
Log (except on Windows Mobile).
Usage errors are suppressed if -qs is on the command line, but not in @data expansion.
See also
● “-qi server option” on page 202
● “-qn server option” on page 202
● “-qp server option” on page 203
● “-qw server option” on page 204
● “-o server option” on page 197
● “-oe server option” on page 197
Syntax
{ dbsrv11 | dbeng11 } -qw ...
Applies to
All operating systems and database servers.
Remarks
This option suppresses the database server messages window. On Windows platforms, the database server
system tray icon is still visible. You can use either (or both) the -o or -oe log files to diagnose errors.
See also
● “-qi server option” on page 202
● “-qn server option” on page 202
● “-qp server option” on page 203
● “-qs server option” on page 204
-r server option
Forces all databases that start on the server to be read-only. No changes to the database(s) are allowed: the
server doesn't modify the database file(s) and transaction log files.
Syntax
{ dbsrv11 | dbeng11 } -r ...
Applies to
All operating systems and database servers.
Remarks
Opens all database files as read-only with the exception of the temporary file when the option is specified
before any database names on the command line. If the -r server option is specified after a database name,
only that specific database is read-only. You can make changes on temporary tables, but ROLLBACK has
no effect, since the transaction and rollback logs are disabled.
A database distributed on a CD-ROM device is an example of a database file that cannot be modified. You
can use read-only mode to access this sort of database.
If you attempt to modify the database, for example with an INSERT or DELETE statement, a
SQLSTATE_READ_ONLY_DATABASE error is returned.
Databases that require recovery cannot be started in read-only mode. For example, database files created
using an online backup cannot be started in read-only mode if there were any open transactions when the
backup was started, since these transactions would require recovery when the backup copy is started.
Databases with auditing turned on cannot be started in read-only mode.
If you are checking the validity of a backup copy, you should run the database in read-only mode so that it
is not modified in any way. See “Validating a database” on page 876.
See also
● “-r database option” on page 241
Example
To open two databases in read-only mode
-s server option
Sets the user ID for Syslog messages.
Syntax
{ dbsrv11 | dbeng11 } -s { none | user | daemon | localn } ...
Applies to
Unix, Mac OS X
Remarks
Sets the system user ID used in messages to the Syslog facility. The default is user for database servers that
are started in the foreground, and daemon for those that are run in the background (for example, started by
dbspawn, autostarted by a client, or started with the -ud database server option).
A value of none prevents any Syslog messages from being logged. The localn argument allows you to use
a facility identifier to redirect messages to a file. You can specify a number between 0 and 7, inclusive, for
n. Refer to the Unix Syslog(3) man page for more information.
The following steps illustrate how to redirect messages on Solaris, but you can also do this on Linux, AIX,
and Mac OS X. Note that on other platforms, such as HP-UX, the syslog.conf file is found in a different
location. You can place the /var/adm/sqlanywhere file in whatever location you want.
To redirect messages to a file using a facility identifier
1. Choose a unique facility identifier that isn't already being used by another application that is running on
your system.
You can do this by looking in the /etc/syslog.conf file to see of any of the localn facilities are referenced.
2. Edit the /etc/syslog.conf file and add the following line, where localn is the facility identifier you chose
in step 1:
localn.err;localn.info;localn.notice /var/adm/sqlanywhere
3. Create the /var/adm/sqlanywhere file:
touch /var/adm/sqlanywhere
4. Tell the syslogd process that you have modified the syslog.conf file by finding the process ID of syslogd:
ps -ef | grep syslogd
and then executing the following command where pid is the process ID of syslogd:
kill -HUP pid
5. Start your SQL Anywhere database server with the following command, where localn is the facility
identifier you chose in step 1:
dbeng11 -s localn ...
Now any messages that the SQL Anywhere database server reports to Syslog are redirected to the /var/
adm/sqlanywhere file.
See also
● “MESSAGE statement” [SQL Anywhere Server - SQL Reference]
Syntax
{ dbsrv11 | dbeng11 } -sb { 0 | 1 } ...
Applies to
TCP/IP
Remarks
Using -sb 0 causes the server not to start up any UDP broadcast listeners. In addition to forcing clients to
use the DoBroadcast=NONE and HOST= options to connect to the server, this option causes the server to
be unlisted when using dblocate.
Using -sb 1 causes the server to not respond to broadcasts from dblocate, while leaving connection logic
unaffected. You can connect to the server by specifying LINKS=tcpip and ENG=name.
See also
● “BroadcastListener protocol option [BLISTENER]” on page 288
Syntax
{ dbsrv11 | dbeng11 } -sf feature-list ...
Applies to
All operating systems and database servers.
Remarks
This option allows you to enable and disable features for a database server. These settings affect all databases
running on the database server. You can enable all disabled (secured) features for a connection by setting
the secure_feature_key option to the key specified by the -sk option. Any connection that sets the
secure_feature_key option to the key specified by -sk can also change the set of secured features for a database
server using the SecureFeatures property of the sa_server_option system procedure.
The feature-list is a comma-separated list of feature names or feature sets to secure for the database server.
Use feature-name to indicate that the feature should be disabled, and -feature-name to indicate that the feature
should be removed from the disabled features list. For example, the following command indicates that only
dbspace features are enabled:
dbeng11 -n secure_server -sf all,-dbspace
The following feature-name values are supported (values enclosed in parentheses are the short forms of feature
names that can also be specified):
● none Specifies that no features are disabled.
● all Disables all features that can be disabled including the following groups.
○ client Disables all features that allow access to client-related input/output. This includes access
to the client computing environment. This set consists of the following features.
● read_client_file Disables the use of statements that can cause a client file to be read. For
example, the READ_CLIENT_FILE function and the LOAD TABLE statement. See “Accessing
data on client computers” [SQL Anywhere Server - SQL Usage].
● write_client_file Disables the use of all statements that can cause a client file to be written
to. For example, the UNLOAD statement and the WRITE_CLIENT_FILE function. See
“Accessing data on client computers” [SQL Anywhere Server - SQL Usage].
○ local Disables all local-related features. This includes access to the server computing environment.
This set consists of the local_call, local_db, local_io, and local_log feature subsets described below.
● local_call Disables all features that provide the ability to execute code that is not directly part
of the server and is not controlled by the server. This set consists of the following features.
○ cmdshell Disables the use of the xp_cmdshell procedure. See “xp_cmdshell system
procedure” [SQL Anywhere Server - SQL Reference].
○ external_procedure Disables the use of external stored procedures. This setting does
not disable the use of the xp_* system procedures (such as xp_cmdshell, xp_readfile, and so
on) that are built into the database server. Separate feature control options are provided for
these system procedures. See “Calling external libraries from procedures” [SQL Anywhere
Server - Programming].
○ java Disables the use of Java-related features, such as Java procedures. See “Tutorial:
Using Java in the database” [SQL Anywhere Server - Programming].
● local_db Disables all features related to database files. This set consists of the following
features.
○ backup Disables the use of the BACKUP statement, and therefore, the ability to run server-
side backups. You can still perform client-side backups using dbbackup. See “BACKUP
statement” [SQL Anywhere Server - SQL Reference].
○ restore Disables the use of the RESTORE DATABASE statement. See “RESTORE
DATABASE statement” [SQL Anywhere Server - SQL Reference].
○ database Disables the use of the CREATE DATABASE, ALTER DATABASE, DROP
DATABASE, CREATE ENCRYPTED FILE, and CREATE DECRYPTED FILE
statements.
○ dbspace Disables the use of the CREATE DBSPACE, ALTER DBSPACE, and DROP
DBSPACE statements.
● local_io Disables all features that allow direct access to files and their contents. This set
consists of the following features.
○ read_file Disables the use of statements that can cause a local file to be read. For example,
the xp_read_file system procedure, the LOAD TABLE statement, and the use of
OPENSTRING( FILE ... ). The alternate names load_table and xp_read_file are deprecated.
○ write_file Disables the use of all statements that can cause a local file to be written to. For
example, the UNLOAD statement and the xp_write_file system procedure. The alternate
names unload_table and xp_write_file are deprecated.
○ delete_file Disables the use of all statements that can cause a local file to be deleted. For
example, it disables the use of the db_delete_file DBLib function, which deletes database
files. The db_delete_file function is used by the dbbackup -x and -xo options, so securing
db_delete_file causes dbbackup to fail if the -x or -xo options are specified. See
“db_delete_file function” [SQL Anywhere Server - Programming].
○ directory Disables the use of directory class proxy tables. This feature is also disabled
when remote_data_access is disabled.
● local_log Disables all logging features that result in creating or writing data directly to a file
on disk. This set consists of the following features.
○ request_log Disables the ability to change the request log file name and also disables the
ability to increase the limits of the request log file size or number of files. You can specify
the request log file, as well as limits on this file, in the command to start the database server;
however, they cannot be changed once the server is started. When request log features are
disabled, you can still turn request logging on and off, and reduce the maximum file size and
number of request logging files. See “Request logging” [SQL Anywhere Server - SQL
Usage].
○ console_log Disables the ability to change the database server message log file name
using the ConsoleLogFile option of the sa_server_option system procedure . It also disables
the ability to increase the maximum size of the log file using the ConsoleLogMaxSize option
of the sa_server_option system procedure . You can specify a server log file and its size when
starting the database server.
○ webclient_log Disables the ability to change the web service client log file name using
the WebClientLogFile option of the sa_server_option system procedure. You can specify a
web service client log file when starting the database server. See “-zoc server
option” on page 230.
○ remote Disables all features that allow remote access or communication with remote processes.
This set consists of the following features.
● remote_data_access Disables the use of any remote data access services, such as proxy
tables.
● send_udp Disables the ability to send UDP packets to a specified address using the
sa_send_udp system procedure.
● web_service_client Disables the use of web service client stored procedure calls (that is,
stored procedures that issue HTTP requests).
See also
● “-sk server option” on page 211
● “secure_feature_key [database]” on page 515
● “sa_server_option system procedure” [SQL Anywhere Server - SQL Reference]
● “Specifying secured features” on page 956
Example
The following command starts a database server named secure_server with access to the request log and
with all remote data access features disabled. The key specified by the -sk option can be used later with the
secure_feature_key database option to enable these features for a specific connection.
If a user connected to a database running on the secure_server database server sets the secure_feature_key
option to the value specified by -sk, that connection has access to the request log and remote data access
features:
The following command disables all features, with the exception of local database features:
Syntax
{ dbsrv11 | dbeng11 } -sk key ...
Applies to
All operating systems and database servers.
Remarks
When you secure features for a database server using the -sf option, you can also include the -sk option,
which specifies a key that can be used with the secure_feature_key database option to enable secured features
for a connection. That connection can also use the sa_server_option system procedure to modify the features
or feature sets that are secured for all databases running on the database server.
If the secure_feature_key option is set to any value other than the one specified by -sk, no error is given, and
the features specified by -sf remain secured for the connection.
See also
● “-sf server option” on page 207
● “secure_feature_key [database]” on page 515
● “sa_server_option system procedure” [SQL Anywhere Server - SQL Reference]
● “Specifying secured features” on page 956
Example
The following command starts a database server named secure_server with access to the backup features
disabled. The key specified by the -sk option can be used later to enable these features for a specific
connection.
Setting the secure_feature_key option to the value specified by -sk for a connection to a database running
on the secure_server database server allows that connection to perform backups or change the features that
are disabled on the secure_server database server:
The user could then disable the use of all secured features for databases running on secure_server by
executing the following command:
Syntax
{ dbsrv11 | dbeng11 } -su password ...
Applies to
All operating systems and database servers.
Remarks
This option specifies the initial password for the DBA user of the utility database. The password is case
sensitive. You can specify none for the password to disable all connections to the utility database. To avoid
having the utility database password in clear text on the command line, you can use dbfhide to obfuscate a
file containing the password, and then reference the obfuscated file on the command line.
If you are using a personal database server and do not specify the -su option, connections to the utility
database are allowed with the DBA user ID and any password. If you are using the network database server
and do not specify the -su option, connections to the utility database are not allowed unless the util_db.ini
file exists and the user ID is DBA with a password that matches the password in the util_db.ini file. On a
network server, if both -su and util_db.ini are used, util_db.ini is ignored. Note that the util_db.ini file is
deprecated.
You can execute a CREATE USER DBA IDENTIFIED BY new-password statement while connected to
utility_db to change the password for the DBA user of the utility database. The REVOKE CONNECT FROM
DBA statement can be used to disable connections to the utility_db database.
See also
● “Connecting to the utility database” on page 22
Example
The following command disables all connections to the utility database:
dbeng11 -su none c:\inventory.db
In the following example, the file named util_db_pwd.cfg that contains the utility database password is
obfuscated using dbfhide and renamed util_db_pwd_hide.cfg:
dbfhide util_db_pwd.cfg util_db_pwd_hide.cfg
The util_db_pwd_hide.cfg file can then be used to specify the utility database password:
dbsrv11 -su @util_db_pwd_hide.cfg -n my_server c:\inventory.db
Syntax
{ dbsrv11 | dbeng11 } -ti minutes ...
Applies to
All operating systems and database servers.
Remarks
Disconnect connections that haven't submitted a request for the specified number of minutes. The default is
240 (4 hours). The maximum value is 32767. A client computer in the middle of a database transaction holds
locks until the transaction is ended or the connection is disconnected. The -ti option is provided to disconnect
inactive connections, freeing their locks.
The -ti option is very useful when used in conjunction with dbsrv11 since most connections will be over
network links (TCP).
The -ti option is useful with dbeng11 only for local TCP/IP connections. Using -ti has no effect on
connections to a local server using shared memory.
Setting the value to zero disables checking of inactive connections, so that no connections are disconnected.
See also
● “-tl server option” on page 214
● “sa_server_option system procedure” [SQL Anywhere Server - SQL Reference]
● “Adjusting timeout values” on page 145
Syntax
{ dbsrv11 | dbeng11 } -tl seconds ...
Applies to
All database servers using TCP/IP.
Remarks
A liveness packet is sent periodically across a client/server TCP/IP communications protocol to confirm that
a connection is intact. If the server runs for a LivenessTimeout period (default 2 minutes) without detecting
a liveness packet on a connection, the communication is severed, and the server drops the connection
associated with that client. Unix non-threaded clients and TDS connections do not do liveness checking.
The -tl option on the server sets the LivenessTimeout value for all clients that do not specify a liveness
period.
Liveness packets are sent when a connection hasn't sent any packets for between one third and two thirds of
the LivenessTimeout value.
When there are more than 200 connections, the server automatically calculates a higher LivenessTimeout
value based on the stated LivenessTimeout value, so the server can handle a large number of connections
more efficiently. Liveness packets are sent between one third and two thirds of the LivenessTimeout on each
idle connection. Large numbers of liveness packets aren't sent at the same time. If liveness packets take a
long time to send (depending on the network, the computer's hardware, and the CPU and network load on
the computer), it is possible that liveness packets will sent after two thirds of the LivenessTimeout. A warning
appears in the database server message log if the liveness sends take a long time. If this warning occurs,
consider increasing the LivenessTimeout value.
Although it isn't generally recommended, you can disable liveness by specifying the following:
dbsrv11 -tl 0
Rather than disabling the LivenessTimeout option, consider increasing the value to 1 hour as follows:
dbsrv11 -tl 3600
See also
● “-ti server option” on page 213
● “sa_server_option system procedure” [SQL Anywhere Server - SQL Reference]
● “Adjusting timeout values” on page 145
Syntax
{ dbsrv11 | dbeng11 } -tmf ...
Applies to
Windows
Remarks
Used during recovery of distributed transactions when the distributed transaction coordinator isn't available.
It could also be used if starting a database with distributed transactions in the transaction log, on a platform
where the distributed transaction coordinator isn't available.
Caution
If you use this option, distributed transactions are not recovered properly. It is not intended for routine use.
See also
● “-tmt server option” on page 215
● “Recovery from distributed transactions” [SQL Anywhere Server - Programming]
Syntax
{ dbsrv11 | dbeng11 } -tmt milliseconds ...
Applies to
Windows
Remarks
Used during recovery of distributed transactions. The value specifies how long the database server should
wait to be reenlisted. By default there is no timeout (the database server waits indefinitely).
See also
● “-tmf server option” on page 214
● “Recovery from distributed transactions” [SQL Anywhere Server - Programming]
Syntax
{ dbsrv11 | dbeng11 } -tq { datetime | time } ...
Applies to
All operating systems and database servers.
Remarks
This option is useful for setting up automatic off-line backup procedures. See “Backup and data
recovery” on page 847.
The format for the time is in hh:mm (24 hour clock), and can be preceded by an optional date. If a date is
specified, the date and time must be enclosed in double quotes and be in the format YYYY/MM/DD HH:MM.
See also
● “sa_server_option system procedure” [SQL Anywhere Server - SQL Reference]
-u server option
Opens files using the operating system disk cache.
Syntax
{ dbsrv11 | dbeng11 } -u ...
Applies to
Windows, Unix
Remarks
Files are opened using the operating system disk cache in addition to the database cache.
While the operating system disk cache may improve performance in some cases, in general better
performance is obtained without this option, using the database cache only.
If the server is running on a dedicated computer, you shouldn't use the -u option, as the database cache itself
is generally more efficient. You may want to use the -u option if the server is running on a computer with
several other applications (so that a large database cache may interfere with other applications) and yet IO-
intensive tasks are run intermittently on the server (so that a large cache will improve performance).
Syntax
{ dbsrv11 | dbeng11 } -ua ...
Applies to
Linux
Remarks
By default, the database server uses asynchronous I/O on Linux when possible. To use asynchronous I/O,
the following conditions must be met:
1. The library libaio.so can be loaded at run time.
2. The kernel has asynchronous I/O support.
If you want to turn off the use of asynchronous I/O, specify the -ua option on the database server command
line.
Syntax
{ dbsrv11 | dbeng11 } -uc ...
Applies to
Unix, Mac OS X
Remarks
Starts the database server in shell mode. You should only specify one of -uc, -ui, -um, or -ux. When you
specify -uc, this starts the database server in the same manner as previous releases of the software.
For more information about starting the database server as a daemon, see “-ud server
option” on page 217.
See also
● “-ui server option” on page 218
● “-um server option” on page 219
● “-ux server option” on page 220
Syntax
{ dbsrv11 | dbeng11 } -ud ...
Applies to
Unix, Mac OS X
Remarks
Using this option lets you run the server so that it continues running after the current operating system session
ends.
When you start the daemon directly using the -ud option, the dbeng11 and dbsrv11 commands create the
daemon process and return immediately (exiting and allowing the next command to be executed) before the
daemon initializes itself or attempts to open any of the databases specified in the command.
One advantage of using dbspawn instead of the -ud option is that the dbspawn process does not shut down
until it has confirmed that the daemon has started and is ready to accept requests. If for any reason the daemon
fails to start, the exit code for dbspawn is non-zero.
See also
● “Start Server in Background utility (dbspawn)” on page 760
● “Software component exit codes” [SQL Anywhere Server - Programming]
● “Running the server outside the current session” on page 52
● “Security tips” on page 950
Syntax
{ dbsrv11 | dbeng11 } -uf action ...
Applies to
Unix, Mac OS X
Remarks
Use this option to specify which of the following actions is taken when a fatal error occurs:
● abort the Unix abort function is called, and a core file is generated.
● default the database server behaves in the same manner as abort in all cases, except when a device-
full fatal error occurs. In this case, it behaves in the same manner as defunct. This action prevents the
system from trying to write a core file on a full device. This is the default behavior.
● defunct the database server continues running and does not call abort. Any new connection attempts
made to the database server receive the SQL error of the original fatal error.
See also
● “-oe server option” on page 197
● “Support utility (dbsupport)” on page 764
● “Error reporting in SQL Anywhere” on page 71
● “Logging database server actions” on page 34
database server messages in a new window and starts the database server in shell mode if a usable display
isn't available.
Syntax
{ dbsrv11 | dbeng11 } -ui ...
Applies to
Linux with X window server support, Mac OS X
Remarks
On Linux the -ui option allows you to use the Server Startup Options window to specify server options
when starting the database server, and to display the database server messages window once the database
server has started. On Mac OS X, server messages are redirected to a new window within
DBLauncher.app.
On Linux, when the -ui option is the only option specified on the server command line, the Server Startup
Options window appears where you can enter options for starting the database server. On Mac OS X you
must use the -ui option with the other options required to start the database server.
The database server attempts to find a usable display when -ui is specified. If it cannot find one, for example
because the DISPLAY environment variable isn't set or because X window server isn't running, then the
database server starts in shell mode. If you do not want the database server to start when it cannot locate a
usable display, specify the -ux option rather than -ui. You should only specify one of -uc, -ui, -um, or -ux.
For information about starting the database server as a daemon, see “-ud server option” on page 217.
See also
● “-uc server option” on page 217
● “-um server option” on page 219
● “-ux server option” on page 220
Syntax
{ dbsrv11 | dbeng11 } -um ...
Applies to
Mac OS X
Remarks
The -um option allows you to connect to the DBLauncher.app instance, if it is running, and displays messages
in a new window within DBLauncher.app. The -um option must be used with the other options required to
start the database server. Server messages appear in this window instead of in the shell. Closing this window
shuts down the database server. If a connection to the DBLauncher.app instance cannot be established, the
database server does not start.
For the database server to connect to a DBLauncher.app instance, both must be running in the same Mac
OS X security context. For example, a database server started from an ssh session cannot find a
DBLauncher.app instance that was started by Launch Services.
For information about starting the database server as a daemon, see “-ud server option” on page 217.
See also
● “-uc server option” on page 217
● “-ui server option” on page 218
Syntax
{ dbsrv11 | dbeng11 } -ut minutes ...
Applies to
Unix, Mac OS X
Remarks
This option causes the server to touch temporary files at specified intervals.
Syntax
{ dbsrv11 | dbeng11 } -ux...
Applies to
Linux with X window server support
Remarks
The -ux option allows you to do two things when starting the database server: use the Server Startup
Options window to specify server options when starting the database server and display the database server
messages window once the server has started.
When the -ux option is the only option specified on the server command line, the Server Startup
Options window appears where you can enter options for starting the database server.
The server must be able to find a usable display when -ux is specified. If it cannot find one, for example
because the DISPLAY environment variable isn't set or because X window server isn't running, then the
database server fails to start. If you want the database server to start, even if it cannot find a usable display,
use the -ui option instead of -ux.
If you specify other server options in addition to -ux, then the database server messages window appears
once the database server is started. You should only specify one of -uc, -ui, or -ux.
For more information about starting the database server as a daemon, see “-ud server option” on page 217.
See also
● “-uc server option” on page 217
● “-ui server option” on page 218
● “-qn server option” on page 202
Example
The following command displays the Server Startup Options window where you can enter options for
starting the database server:
dbeng11 -ux
The following command starts the database server and displays the database server messages window:
dbeng11 -ux sample.db
-v server option
Displays the software version.
Syntax
{ dbsrv11 | dbeng11 } -v ...
Applies to
All operating systems and database servers.
Remarks
Supplies the database server version in a window, and then stops. You can also obtain the software version
by right-clicking the title bar of the database server messages window and choosing About.
Syntax
{ dbsrv11 | dbeng11 } -vss { + | - } ...
Applies to
32-bit Microsoft Windows XP and 32-bit and 64-bit editions of Microsoft Windows 2003 and later operating
systems.
Remarks
By default, all SQL Anywhere databases can use the VSS service for backups if the SQL Anywhere VSS
writer (dbvss11.exe) is running. You can use VSS without the SQL Anywhere VSS writer to back up
databases. However, you might need to use the full SQL Anywhere recovery procedures to restore those
databases. To prevent a database server from participating in the VSS service, include -vss- when starting
the database server.
See also
● “SQL Anywhere Volume Shadow Copy Service (VSS)” on page 873
● “Service utility (dbsvc) for Windows” on page 748
● “Recovering from media failure on the database file” on page 885
Example
The following command starts the mydatabase.db database and instructs the database server not to participate
in VSS operations even if the (dbvss11.exe) writer is running:
dbsrv11 -vss- mydatabase.db
-x server option
Specifies server side network communications protocols.
Syntax 1
dbsrv11 -x { all | none | srv-protocols } ...
srv-protocols:
{ tcpip parmlist },...
parmlist:
( parm=value;...)
Syntax 2
dbeng11 -x { all | none | eng-protocols } ...
eng-protocols:
{ tcpip [ parmlist ] },...
parmlist:
( parm=value;...)
Applies to
All operating systems and database servers.
Remarks
Use the -x option to specify which communications protocols, in addition to shared memory, you want to
use to listen for client connection broadcasts.
If you do not specify the -x option, the server attempts to listen for client connection broadcasts using all
protocols supported by the database server running on your operating system, including shared memory.
If you specify the -x option with one or more protocols, the server attempts to listen for client connection
broadcasts using the specified protocol(s) and also using a shared memory protocol.
For information about securing shared memory connections on Unix, see “Security tips” on page 950.
Note
If you are running Windows Mobile and specify the -x option, the server only attempts to listen for client
connection broadcasts using the TCP/IP protocol unless you explicitly request otherwise.
Regardless of which settings you choose for the -x option, the server always listens for connection broadcasts
using the shared memory protocol. In addition to the shared memory protocol, you can also specify the
following:
● ALL Listen for connection attempts by the client using all communications protocols that are supported
by the server on this platform, including shared memory. This is the default.
● NONE Listen for connection attempts by the client using only the shared memory protocol.
● TCPIP (TCP) Attempt to connect to the client using the TCP/IP protocol. The TCP/IP protocol is
supported by the network server on all operating systems, and by the personal database server for same-
computer communications.
By default, the database server listens for broadcasts on port 2638, and redirects them to the appropriate
port. This ensures a connection in most cases.
You can override this default and cause the server not to listen on port 2638 by setting the option -sb 0,
or by turning off the BroadcastListener option (BroadcastListener=0). Additionally, if the client and
server are communicating through a firewall, the client must send the packet to the exact port the server
is listening on by specifying DoBroadcast=None and Host=.
For more information about available parameters, see “Network protocol options” on page 286.
For Unix, quotation marks are required if more than one parameter is supplied:
-x "tcpip(PARM1=value1;PARM2=value2;...)"
See also
● “-xa server option” on page 224
● “-xf server option” on page 224
● “-xp database option” on page 245
● “-xs server option” on page 225
● “CommLinks connection parameter [LINKS]” on page 254
● “Supported network protocols” on page 134
Example
Allow only shared memory and TCP/IP communications:
-x tcpip
Syntax
dbsrv11 -xa auth=auth-strings;DBN=database-names
Applies to
All operating systems, network server only.
Remarks
This option is only specified when starting the arbiter server in a database mirroring system.
The authentication string must match the authentication string specified for the primary and mirror servers.
If the lists of authentication strings and database names each contain only one entry, the server will act as
the arbiter for only one database mirroring system; otherwise, each list must contain the same number of
entries.
See also
● “DatabaseName connection parameter [DBN]” on page 261
● “-sn database option” on page 243
● “-x server option” on page 222
● “-xf server option” on page 224
● “-xp database option” on page 245
● “-xs server option” on page 225
Example
The following command starts an arbiter database server named arbiter.
dbsrv11 -x tcpip -n arbiter -xa AUTH=abc;DBN=demo -xf c:\arbiterstate.txt
Syntax
dbsrv11 -xf state-file ...
Applies to
All operating systems, network server only.
Remarks
The -xf option specifies the location of the file used for maintaining state information about the mirroring
system. This option is required for database mirroring. By default, the state information file is named server-
name.mirror_state.
For more information about the database mirroring state information file, see “State information
files” on page 920.
See also
● “-sn database option” on page 243
● “-x server option” on page 222
● “-xa server option” on page 224
● “-xp database option” on page 245
● “-xs server option” on page 225
Example
The following command (entered all on one line) starts a database server named server1, that uses the state
information file c:\server1state.txt.
dbsrv11.exe -n server1 -x tcpip{DOBROADCAST=no}
-xf c:\server1state.txt mydemo.db -sn mirrordemo
-xp "partner=(ENG=server2;LINKS=tcpip(TIMEOUT=1));
AUTH=abc;arbiter=(ENG=arbsrv;LINKS=tcpip(TIMEOUT=1));
MODE=sync"
Syntax
{ dbeng11 | dbsrv11 } -xs { NONE | protocol } ...
Applies to
All operating systems and database servers.
Remarks
Use the -xs option to specify which web protocols you want to use to listen for requests.
If you do not specify the -xs option, the database server doesn't attempt to listen for web requests.
If you specify the -xs option with one or more protocols, the server attempts to listen for web requests using
the specified protocol(s).
Note
If you want to start multiple web servers at the same time, then you must change the port for one of them
since they both have the same default port.
You can use the HTTPS or the FIPS-approved HTTPS protocols for transport-layer security. See “Encrypting
SQL Anywhere web services” on page 994.
Regardless of which settings you specify with the -xs option, the server always listens for connection attempts
using the shared memory protocol. You can specify any of the following:
● option For a list of supported option values for each protocol, see “Network protocol
options” on page 286.
● HTTP Listen for web requests by the client using the HTTP protocol. The default port on which to
listen is 80.
● HTTPS Listen for web requests by the client using the HTTPS protocol. The default port on which to
listen is 443. You must specify the server's certificate and password to use HTTPS. The password must
be an RSA certificate because HTTPS uses RSA encryption.
The SQL Anywhere HTTP server supports HTTPS connections using SSL version 3.0 and TLS version
1.0.
You can specify HTTPS, or HTTPS with FIPS=Y for FIPS-approved RSA encryption. FIPS-approved
HTTPS uses a separate approved library, but is compatible with HTTPS.
Note
The Mozilla Firefox browser can connect when FIPS-approved HTTPS is used. However, the cipher
suite used by FIPS-approved HTTPS is not supported by most versions of the Internet Explorer, Opera,
or Safari browsers—if you are using FIPS-approved HTTPS, these browsers may not be able to connect.
For information about enforcing the FIPS-approved algorithm, see “-fips server option” on page 176.
○ server-identity-filename The path and file name of the server identity. For HTTPS, you must use
an RSA certificate.
○ password The password for the server private key. You specify this password when you create
the server certificate.
● NONE Do not listen for web requests. This is the default.
For more information about available parameters, see “Network protocol options” on page 286.
On Unix, quotation marks are required if more than one parameter is supplied:
-xs "HTTP(OPTION1=value1;OPTION2=value2;...)"
See also
● “-sn database option” on page 243
● “-x server option” on page 222
● “-xa server option” on page 224
● “-xf server option” on page 224
● “-xp database option” on page 245
● “SQL Anywhere web services” [SQL Anywhere Server - Programming]
Example
Listen for HTTP web requests on port 80:
-z server option
Displays diagnostic communication messages, and other messages, for troubleshooting purposes.
Syntax
{ dbsrv11 | dbeng11 } -z ...
Applies to
All operating systems and database servers.
Remarks
This should only be used when tracking problems. The information appears in the database server messages
window.
See also
● “-ze server option” on page 227
Syntax
{ dbsrv11 | dbeng11 } -ze ...
Applies to
All operating systems and database servers except Windows Mobile.
Remarks
When you specify the -ze option, environment variables are listed in the database server messages window
on startup. You can log the contents of the database server messages window to a file by specifying the -o
option when starting the database server.
See also
● “SQL Anywhere environment variables” on page 311
● “-o server option” on page 197
● “-z server option” on page 227
Example
The following command starts a database server named myserver, and outputs the environment variables
set for the server to the database server messages window and the file server-log.txt.
dbeng11 -n myserver -ze -o server-log.txt
Syntax
{ dbsrv11 | dbeng11 } -zl ...
Applies to
All operating systems and database servers.
Remarks
This feature can also be turned on using the RememberLastStatement server setting. You can obtain the most
recently-prepared SQL statement for a connection using the LastStatement value of the
CONNECTION_PROPERTY function. The sa_conn_activity stored procedure allows you to obtain the
most recently-prepared SQL statement for all current connections to databases on the server.
The LastStatement value is set when a statement is prepared, and is cleared when a statement is dropped.
Only one statement string is remembered for each connection.
If sa_conn_activity reports a non-empty value for a connection, it is most likely the statement that the
connection is currently executing. If the statement had completed, it would likely have been dropped and
the property value would have been cleared. If an application prepares multiple statements and retains their
statement handles, the LastStatement value does not reflect what a connection is currently doing.
For stored procedure calls, only the outermost procedure call appears, not the statements within the
procedure.
Caution
When -zl is specified or when the RememberLastStatement server setting is turned on, any user can call the
sa_conn_activity system procedure or obtain the value of the LastStatement connection property to find out
the most recently-prepared SQL statement for any other user. This option should be used with caution and
turned off when it isn't required.
See also
● LastStatement property: “Connection-level properties” on page 538
● “sa_conn_activity system procedure” [SQL Anywhere Server - SQL Reference]
● “sa_server_option system procedure” [SQL Anywhere Server - SQL Reference]
Syntax
{ dbsrv11 | dbeng11 } -zn integer
Applies to
All operating systems and database servers.
Remarks
If request logging is enabled over a long period of time, the request log file can become large. The -zn option
allows you to specify the number of request log file copies to retain. It only takes effect if -zs is also specified.
The -zs option allows you to create a new log file and rename the original log file when the original log file
reaches a specified size. See “-zs server option” on page 233.
For example, if you redirect request logging information to the file req.out, and specify five request log file
copies using the -zn option, the server creates files in the following order: req.out.1, req.out.2, req.out.3,
req.out.4, and req.out.5. When these files exist and the active request log fills again, the following happens:
● req.out.1 is deleted
● the files req.out.2 to req.out.5 are renamed req.out.1 to req.out.4
● the copy of the active log is renamed req.out.5
Request logging is turned on using the -zr option and redirected to a separate file using the -zo option. You
can also set the number of request logs using the sa_server_option system procedure where nn specifies the
number of request log file copies:
CALL sa_server_option('RequestLogNumFiles',nn);
See also
● “-zo server option” on page 230
● “-zr server option” on page 231
● “-zs server option” on page 233
● “sa_server_option system procedure” [SQL Anywhere Server - SQL Reference]
Example
In the following example, entered all on one line, request logging information is output to a request log file
named mydatabase.log, which has a maximum size of 10 KB, and three copies of the request log are kept:
dbeng11 "c:\my data\mydatabase.db" -zr all -zn 3
-zs 10 -zo mydatabase.log
Syntax
{ dbsrv11 | dbeng11 } -zo filename...
Applies to
All operating systems and database servers.
Remarks
Request logging is turned on using the -zr option. You can direct the output from this file to a different file
that is not the regular log file by specifying the -zo option.
This option also prevents request logging from appearing in the database server messages window.
See also
● “-zn server option” on page 229
● “-zr server option” on page 231
● “-zs server option” on page 233
● “Request logging” [SQL Anywhere Server - SQL Usage]
Syntax
{ dbsrv11 | dbeng11 } -zoc filename...
Applies to
All operating systems and database servers.
Remarks
The web service client log file contains HTTP requests and transport data recorded for outbound web service
client calls. Logging is enabled automatically when you specify the -zoc server option. You can enable and
disable logging to this file using the sa_server_option system procedure:
See also
● WebClientLogging property: “Server-level properties” on page 561
● WebClientLogFile property: “Server-level properties” on page 561
● “sa_server_option system procedure” [SQL Anywhere Server - SQL Reference]
● “SQL Anywhere web services” [SQL Anywhere Server - Programming]
● “CREATE FUNCTION statement” [SQL Anywhere Server - SQL Reference]
● “CREATE PROCEDURE statement” [SQL Anywhere Server - SQL Reference]
Example
The following command starts the database server so that it listens for HTTP web requests on port 80, and
logs outbound web service client information to the file clientinfo.txt:
dbeng11 web.db -xs HTTP(PORT=80) -zoc clientinfo.txt
Syntax
{ dbsrv11 | dbeng11 } -zp ...
Applies to
All operating systems and database servers.
Remarks
Include this option if you want the database server to store the query execution plan that was used most
recently by each connection. This feature can also be turned on using the RememberLastPlan server setting
with the sa_server_option system procedure. You can view the text of the most recently-used plan by using
the LastPlanText connection property.
See also
● LastPlanText property: “Connection-level properties” on page 538
● “sa_conn_activity system procedure” [SQL Anywhere Server - SQL Reference]
● “sa_server_option system procedure” [SQL Anywhere Server - SQL Reference]
Syntax
{ dbsrv11 | dbeng11 } -zr { SQL | HOSTVARS | PLAN | PROCEDURES | TRIGGERS | OTHER |
BLOCKS | REPLACE | ALL | YES | NONE | NO } ...
Applies to
All operating systems and database servers.
Remarks
This option should only be used when tracking problems. The information appears in the database server
messages window or is sent to the request log.
The values for -zr return the following types of information:
● SQL enables logging of the following:
○ START DATABASE statements
○ STOP DATABASE statements
○ STOP ENGINE statements
○ Statement preparation and execution
○ EXECUTE IMMEDIATE statement
○ Option settings
○ COMMIT statements
○ ROLLBACK statements
○ PREPARE TO COMMIT operations
○ Connects and disconnects
○ Beginnings of transactions
○ DROP STATEMENT statements
○ Cursor explanations
○ Cursor open, close, and resume
○ Errors
● PLAN enables logging of execution plans (short form). Execution plans for procedures are also
recorded if logging of procedures (PROCEDURES) is enabled.
● HOSTVARS enables logging of host variable values. If you specify HOSTVARS, the information
listed for SQL is also logged.
● PROCEDURES enables logging of statements executed from within procedures.
● TRIGGERS enables logging of statements executed from within triggers.
● OTHER enables logging of additional request types not included by SQL, such as FETCH and
PREFETCH. However, if you specify OTHER but do not specify SQL, it is the equivalent of specifying
SQL+OTHER. Including OTHER can cause the log file to grow rapidly and could negatively impact
server performance.
● BLOCKS enables logging of details showing when a connection is blocked and unblocked on another
connection.
● REPLACE at the start of logging, the existing request log is replaced with a new (empty) one of the
same name. Otherwise, the existing request log is opened and new entries are appended to the end of the
file.
● ALL logs all supported information. This setting is equivalent to specifying SQL+PLAN
+HOSTVARS+PROCEDURES+TRIGGERS+OTHER+BLOCKS. This setting can cause the log file
to grow rapidly and could negatively impact server performance.
● NO or NONE turns off logging to the request log.
Once the database server is started, you can change the request log settings to log more or less information
using the sa_server_option system procedure. See “sa_server_option system procedure” [SQL Anywhere
Server - SQL Reference].
You can find the current value of the RequestLogging setting using the following query:
SELECT PROPERTY( 'RequestLogging' );
See also
● “-zn server option” on page 229
● “-zo server option” on page 230
● “Request logging” [SQL Anywhere Server - SQL Usage]
Syntax
{ dbsrv11 | dbeng11 } -zs { size[ k | m | g } ...
Applies to
All operating systems and database servers.
Remarks
Request logging is turned on using the -zr option, and redirected to a separate file using the -zo option. You
can limit the size of the file using the -zs option.
The size is the maximum file size for the request log, in bytes. Use k, m, or g to specify units of kilobytes,
megabytes, or gigabytes respectively.
If you specify -zs 0, then there is no maximum size for the request logging file, and the file is never renamed.
This is the default value.
When the request log file reaches the size specified by either the -zs option or the sa_server_option system
procedure, the file is renamed with the extension .old appended (replacing an existing file with the same
name if one exists). The request log file is then restarted.
See also
● “-zn server option” on page 229
● “-zo server option” on page 230
● “-zr server option” on page 231
● “sa_server_option system procedure” [SQL Anywhere Server - SQL Reference]
● “Request logging” [SQL Anywhere Server - SQL Usage]
Example
The following example shows how the -zs option is used to control log file size. Suppose you start a database
server with the following command line:
dbeng11 -zr all -zs 10k -zo mydatabase.log
A new log file mydatabase.log is created. When this file reaches 10 KB in size, any existing
mydatabase.old files are deleted, mydatabase.log is renamed to mydatabase.old, and a new
mydatabase.log file is started. This process is repeated each time the mydatabase.log file reaches the specified
size (in this case 10 KB).
Syntax
{ dbsrv11 | dbeng11 } -zt ...
Applies to
All operating systems and database servers.
Remarks
Once the database server is started, you can change the status for logging of request timing information using
the sa_server_option system procedure. See “sa_server_option system procedure” [SQL Anywhere Server -
SQL Reference].
You can find the current value of the RequestTiming setting using the following query:
SELECT PROPERTY( 'RequestTiming' );
See also
● “sa_performance_diagnostics system procedure” [SQL Anywhere Server - SQL Reference]
● “sa_performance_statistics system procedure” [SQL Anywhere Server - SQL Reference]
● “Request logging” [SQL Anywhere Server - SQL Usage]
Database options
These options are specified after the database file, and apply only to that database.
-a database option
Applies the named transaction log. The -a database option must be specified after the database-file, and applies
only to that database.
Syntax
{ dbsrv11 | dbeng11 } [ server-options ] database-file -a log-filename ...
Applies to
All operating systems and database servers.
Remarks
This option is used to recover from media failure on the database file. When this option is specified, the
database server applies the log and then shuts down—it doesn't continue to run. If you need to apply multiple
transaction logs, you must know the correct order in which to apply them when using -a. The database server
automatically applies multiple transaction logs in the correct order if you use the -ad or -ar option instead
of -a.
Specifying a cache size when starting the server can reduce recovery time.
See “Backup and data recovery” on page 847.
See also
● “Recovering from media failure on the database file” on page 885
● “Recovering from multiple transaction logs” on page 890
● “-ad database option” on page 235
● “-ar database option” on page 236
● “-as database option” on page 237
Example
The following example, entered all on one line, applies the log file demo.log to a backup copy of the sample
database.
dbeng11 "c:\backup\demo.db" -a "c:\backup\demo.log"
Syntax
{ dbsrv11 | dbeng11 } [ server-options ] database-file -ad log-directory ...
Applies to
All operating systems and database servers.
Remarks
When you include the -ad option, the specified directory is scanned for log files associated with the database.
Log files with starting log offsets greater than or equal to the start log offset stored in the database file are
applied, in log offset order. Once all the log files have been applied, the database is stopped. You must also
specify the -as option if you want the database to continue running once the log files have been applied.
See also
● “Recovering from media failure on the database file” on page 885
● “Recovering from multiple transaction logs” on page 890
● “-a database option” on page 235
● “-ar database option” on page 236
● “-as database option” on page 237
Example
The database server applies the log files in the backup directory to the mysample.db database and then stops
the database once the log files have been applied.
dbeng11 "c:\mysample.db" -ad "c:\backup"
The database server applies the log files in the backup directory to the mysample.db database and the database
continues running once the log files have been applied.
dbeng11 "c:\mysample.db" -ad "c:\backup" -as
Syntax
{ dbsrv11 | dbeng11 } [ server-options ] database-file -ar ...
Applies to
All operating systems and database servers.
Remarks
When you include the -ar option, the database server looks for log files associated with the database that are
located in the same directory as the transaction log. The transaction log location is obtained from the database.
Log files with starting log offsets greater than or equal to the start log offset stored in the database are applied,
in log offset order. Once all the log files have been applied, the database is stopped. You must also specify
the -as option if you want the database to continue running once the log files have been applied.
See also
● “Recovering from media failure on the database file” on page 885
● “Recovering from multiple transaction logs” on page 890
● “-a database option” on page 235
● “-ad database option” on page 235
● “-as database option” on page 237
Example
The database server applies the transaction log files (whose location is obtained from the database) to the
mysample.db database. The database continues running after the log files have been applied.
Syntax
{ dbsrv11 | dbeng11 } [ server-options ] database-file { -ad log-dir | -ar } -as ...
Applies to
All operating systems and database servers.
Remarks
The -as option must be specified in conjunction with either the -ad or -ar option. When you include -as, the
database continues running after the transaction logs are applied to it.
See also
● “Recovering from media failure on the database file” on page 885
● “Recovering from multiple transaction logs” on page 890
● “-a database option” on page 235
● “-ad database option” on page 235
● “-ar database option” on page 236
Example
The database server applies the transaction log files to the mysample.db database. In this case, because -ar
is specified, the database server obtains the location of the transaction logs from the database. The database
continues running after the log files have been applied.
The database server applies the log files in the backup directory to the mysample.db database. The database
continues running after the log files have been applied.
Syntax
{ dbsrv11 | dbeng11 } -ds dbspace-directory ...
Applies to
All operating systems and database servers.
Remarks
When a dbspace directory is specified, the database server only searches this directory for dbspaces. The
location of the dbspace appears in the database server messages window.
If your backup includes dbspaces with full path names, you can use this option to start the backed up copy
of the database on the same computer as the original database while the original database is still running.
See also
● “Using additional dbspaces” on page 17
● “START DATABASE statement” [SQL Anywhere Server - SQL Reference]
● “STOP DATABASE statement” [SQL Anywhere Server - SQL Reference]
● “default_dbspace option [database]” on page 469
Example
The following example starts a database server that looks for dbspaces in the directory c:\backup\Nov15:
dbeng11 c:\backup\Nov15\my.db -ds c:\backup\Nov15\
The following example starts a database server that looks for dbspaces in the current directory:
dbeng11 my.db -ds
Syntax
{ dbsrv11 | dbeng11 } [ server-options ] database-file -dh ...
Applies to
All platforms.
Remarks
The -dh option makes a database undetectable when the Server Enumeration utility (dblocate) is run against
the server. Therefore, when dblocate is used with the -d option, the -dn option, or the -dv option, the database
isn't listed.
See also
● “Server Enumeration utility (dblocate)” on page 742
Syntax
{ dbsrv11 | dbeng11 } [ server-options ] database-file -ek key ...
Applies to
All operating systems and servers.
Remarks
You must provide the key value with the -ek option to start an encrypted database. The key is a string,
including mixed cases, numbers, letters, and special characters.
If you want to enter the encryption key in a window so it cannot be seen in clear text, use the -ep server
option. See “-ep server option” on page 173.
If you want to secure communication packets between client applications and the database server use the -
ec server option and transport-layer security. See “Transport-layer security” on page 977.
See also
● “-ec server option” on page 170
● “-ep server option” on page 173
● “DatabaseKey connection parameter [DBKEY]” on page 260
● “Encrypting a database” on page 965
Example
The following example starts a database and specifies the encryption key on the command line.
dbsrv11 -x tcpip mydata.db -ek "Akmm9u70y"
-m database option
Truncates the transaction log when a checkpoint is done. The -m database option must be specified after the
database-file, and applies only to that database.
Syntax
{ dbsrv11 | dbeng11 } [ server-options ] database-file -m ...
Applies to
All operating systems and database servers.
Remarks
Truncates the transaction log when a checkpoint is done, either at shutdown or as a result of a checkpoint
scheduled by the server. This option provides a way to limit the growth of the transaction log automatically.
Checkpoint frequency is still controlled by the checkpoint_time and recovery_time options (or -gc and -gr
database server command line options).
The -m option is useful where high volume transactions requiring fast response times are being processed,
and the contents of the transaction log aren't being relied upon for recovery or replication. When this option
is selected, there is no protection against media failure on the device that contains the database files.
To avoid database file fragmentation, it is recommended that where this option is used, the transaction log
be placed on a separate device or partition from the database itself.
This option is the same as the -m server option, but applies only to the current database or the database
identified by the database-file variable.
Caution
Do not use the -m option with databases that are being replicated or synchronized. Replication and
synchronization, used by SQL Remote and MobiLink, inherently rely on transaction log information.
See also
● “-m server option” on page 195
● “The transaction log” on page 852
● “Transaction Log utility (dblog)” on page 773
Example
The following example starts a database server named silver and loads the database salesdata.db. When a
checkpoint is done, the transaction log contents are deleted.
dbsrv11 -n silver "c:\inventory details\salesdata.db" -m
-n database option
Sets the name of the database. The -n database option must be specified after the database-file, and applies
only to that database.
Syntax
{ dbsrv11 | dbeng11 } [ server-options ] database-file -n string ...
Applies to
All operating systems and database servers.
Remarks
Both database servers and databases can be named. Since a database server can load several databases, the
database name is used to distinguish the different databases.
By default, the database receives the name of the database file with the path and extension removed. For
example, if the database is started on samples-dir\demo.db and no -n option is specified, the name of the
database is demo.
Database names cannot:
● begin with white space, single quotes, or double quotes
● end with white space
● contain semicolons
● be longer than 250 bytes
You can only use the database name utility_db to connect to the SQL Anywhere utility database. See “Using
the utility database” on page 22.
See also
● “Naming the server and the databases” on page 37
● “-n server option” on page 196
Example
The following example starts the database server with a cache size of 3 MB, loads the database, and names
the database test. Since no database server name has been specified, the server takes its name from the first
database, so the server's name is also test.
dbsrv11 -c 3MB "c:\mydata.db" -n "test"
-r database option
Starts the named database as read-only. No changes to the database(s) are allowed: the server does not modify
the database file(s) and transaction log files. The -r database option must be specified after the database-
file, and applies only to that database.
Syntax
{ dbsrv11 | dbeng11 } [ server-options ] database-file -r ...
Applies to
All operating systems and database servers.
Remarks
Opens all database files (the main database file, dbspaces, transaction log, and transaction log mirrors) as
read-only with the exception of the temporary file when the option is specified before any database names
on the command line. If the -r server option is specified after a database name, only that specific database
is read-only. You can make changes on temporary tables, but ROLLBACK has no effect, since the transaction
and rollback logs are disabled.
A database distributed on a CD-ROM device is an example of a database file that cannot be modified. You
can use read-only mode to access this sort of database.
If you attempt to modify the database, for example with an INSERT or DELETE statement, a
SQLSTATE_READ_ONLY_DATABASE error is returned.
Databases that require recovery cannot be started in read-only mode. For example, database files created
using an online backup cannot be started in read-only mode if there were any open transactions when the
backup was started, since these transactions would require recovery when the backup copy is started.
You cannot start a database in read-only mode if auditing is turned on.
See also
● “-r server option” on page 205
● “auditing option [database]” on page 454
Example
To open two databases in read-only mode
dbeng11 -r database1.db database2.db
Syntax
dbsrv11 [ server-options ] database-file -sm alternate-server-name
Applies to
All operating systems, network server only.
Remarks
The alternate-server-name is only active when the database server is acting as mirror for the database. By
using the -sm and -sn command-line options, an application can always connect to the database on the primary
or the mirror server, without knowing which physical server is acting as primary or mirror.
See also
● “Separately licensed components” [SQL Anywhere 11 - Introduction]
● “Configuring read-only access to a database running on the mirror server” on page 932
● “-xa server option” on page 224
● “-xf server option” on page 224
● “-xp database option” on page 245
● “START DATABASE statement” [SQL Anywhere Server - SQL Reference]
● “Introduction to database mirroring” on page 914
● “Server Enumeration utility (dblocate)” on page 742
● ReadOnly property: “Database-level properties” on page 574
Example
The following command starts the databases satest.db and sample.db on a database server named myserver.
The -sn option instructs the database server to use mysampleprimary as an alternate server name when
connecting to sample.db, while the -sm option instructs the database server to use mysamplemirror as an
alternate server name to connect to sample.db, running on the mirror server.
You can connect to sample.db while it is running on the primary server using any of the following connection
parameters:
● ENG=myserver;DBN=sample
● ENG=mysampleprimary
● ENG=mysampleprimary;DBN=sample
Syntax
dbsrv11 [ server-options ] database-file -sn alternate-server-name
Applies to
All operating systems, network server only.
Remarks
The database server can be configured to listen for more than one server name for a particular database
server. Server names other than the real server name are called alternate server names, and are specific to a
particular database running on the database server. Clients using the alternate server name to connect can
only connect to the database that specified the alternate server name.
Alternate server names must be unique on the network; otherwise, the database fails to start. If the database
is started in the server command and the alternate server name is not unique, the server fails to start. You
can also provide an alternate server name using the START DATABASE statement.
Clients that specify an alternate server name can only connect to the database that specified the alternate
server name. They cannot connect to any other database running on that database server. If the DBN or DBF
connection parameter is specified, it must match the database name or database file, respectively. If the DBN
or DBF connection parameter is not specified, then the database acts as the default database for that server.
The Server Enumeration utility (dblocate) detects alternate server names.
See also
● “Separately licensed components” [SQL Anywhere 11 - Introduction]
● “-xa server option” on page 224
● “-xf server option” on page 224
● “-xp database option” on page 245
● “START DATABASE statement” [SQL Anywhere Server - SQL Reference]
● “Introduction to database mirroring” on page 914
● “Server Enumeration utility (dblocate)” on page 742
● AlternateServerName property: “Database-level properties” on page 574
Example
The following command starts the databases satest.db and sample.db on a database server named myserver.
The -sn option instructs the database server to use mysample as an alternate server name when connecting
to sample.db.
dbsrv11 -n myserver satest.db sample.db -sn mysample
You can connect to sample.db using any of the following connection parameters:
● ENG=myserver;DBN=sample
● ENG=mysample
● ENG=mysample;DBN=sample
Syntax
dbsrv11 [ server-options ] database-file
-xp partner=( partner-conn );
auth=auth-str;
[ ;arbiter=( arbiter-conn ) ]
[ ;mode=[ sync | async | page ]
[ ;autofailover=[ YES | NO ] ]
[ ;pagetimeout=n ]
[ ; preferred=[ YES | NO ] ...
Applies to
All operating systems, except Windows Mobile, network server only.
Remarks
When you specify -xp, you must also specify the location of the database mirroring state information file
with the -xf option.
if the connection parameters specified in the -xp option are invalid, and there are multiple databases running
on the server, then the mirrored database fails to start and does not attempt to reconnect. If the mirrored
database is the only database running on the database server, then the database server does not start.
partner-conn Specifies the connection string for the partner server. A user ID and password are not
required. It is recommended that you specify a timeout to reduce failover time.
auth-str Specifies the authentication string used by the arbiter.
arbiter-conn Specifies the connection string for the arbiter server. A user ID and password are not
required. It is recommended that you specify a timeout to reduce failover time.
mode Specifies the synchronization mode used for database mirroring: synchronous (sync), asynchronous
(async), or asyncfullpage (page).
autofailover Specifies whether the mirror server automatically takes over as the primary server when the
original primary server goes down. This option does not apply to synchronous mode.
Note
It is recommended that if you are using asynchronous or asyncfullpage mode, that you set the -xp autofailover
option to yes. Then, if the primary server goes down, the mirror server automatically takes over as the primary
server.
pagetimeout Specifies how often, in seconds, transaction log pages are sent to the mirror server, whether
or not they are full. This option applies only when using asyncfullpage mode.
preferred Specifies whether the server is the preferred server in the mirroring system. The preferred server
assumes the role of primary server whenever possible. See “Specifying a preferred database
server” on page 932.
See also
● “Separately licensed components” [SQL Anywhere 11 - Introduction]
● “Choosing a database mirroring mode” on page 918
● “-sn database option” on page 243
● “-xa server option” on page 224
● “-xf server option” on page 224
● MirrorMode property: “Database-level properties” on page 574
Example
The following command specifies parameters for the partner server named server2 and the arbiter server
named arbsrv.
dbsrv11 -n server1 mydata.db -sn mydata
-xp "partner=(ENG=server2;LINKS=tcpip(TIMEOUT=1));
AUTH=abc;arbiter=(ENG=arbsrv;LINKS=tcpip(TIMEOUT=1))"
Contents
Connection parameters ............................................................................................. 248
Network protocol options ........................................................................................... 286
Connection parameters
Connection parameters are included in connection strings. They can be entered in the following places:
● In an application's connection string. See “Assembling a list of connection parameters” on page 106 and
“Connection parameters passed as connection strings” on page 76.
● In an ODBC data source. See “Working with ODBC data sources” on page 90.
● In the SQL Anywhere Connect window. See “Connecting from SQL Anywhere utilities” on page 88.
The ODBC Configuration For SQL Anywhere 11 window and the SQL Anywhere Connect window for
Windows operating systems share a common format. Some of the parameters correspond to checkboxes and
fields in these windows, while others can be entered in the text box on the Advanced tab.
Notes
● Connection parameters are case insensitive, although their values may not be (for example, file names
on Unix).
● Boolean parameters are turned on with YES, Y, ON, TRUE, T, or 1, and are turned off with any of NO,
N, OFF, FALSE, F, and 0. The parameters are case insensitive.
● The Usage for each connection parameter describes the circumstances under which the parameter is to
be used. Common usage entries include the following:
○ Embedded databases When SQL Anywhere is used as an embedded database, the connection
starts a personal server and loads the database. When the application disconnects from the database,
the database is unloaded and the server stops.
○ Running local databases This refers to the case where a SQL Anywhere personal server is
already running, and the database is already loaded on the server.
○ Network servers When SQL Anywhere is used as a network server, the client application must
locate a server already running somewhere on the network and connect to a database.
● You can use the dbping utility to test connection strings. The -c option is used to specify the connection
parameters. For example, suppose a personal server with the name demo11 is running the sample database
(which can be started with the command dbeng11 samples-dir\demo.db). The following string
returns the message Ping database successful if a database server named demo11 is running
on the local computer and has a database named demo running:
dbping -d -c "ENG=demo11;DBN=demo;UID=DBA;PWD=sql"
The following command, however, returns the message Ping database failed - Database
server not running if no database server named other-server is running on the local computer:
dbping -d -c "ENG=other-server;UID=DBA;PWD=sql"
See also
● “Notes about connection parameters” on page 102
Usage
Anywhere
Values
String
Default
Empty string
Remarks
This connection parameter is sent to the database server from embedded SQL, ODBC, OLE DB, or
ADO.NET clients and from applications using the iAnywhere JDBC driver. It is not available from Open
Client or jConnect applications.
It consists of a generated string that holds information about the client process, such as the IP address of the
client computer, the operating system it is running on, and so on. The string is associated in the database
server with the connection, and you can retrieve it using the following statement:
SELECT CONNECTION_PROPERTY( 'AppInfo' );
Clients can also specify their own string, which is appended to the generated string. The AppInfo property
string is a sequence of semicolon-delimited key=value pairs. The valid keys are as follows:
● API DBLIB, ODBC, OLEDB, ADO.NET, iAnywhereJDBC, PHP, PerlDBD, or DBEXPRESS.
● APPINFO If you specified AppInfo in the connection string, the string entered.
● EXE The name of the client executable (Windows, Linux, and Solaris).
● HOST The host name of the client computer.
● IP The IP address of the client computer.
● OS The operating system name and version number (for example, Windows 2000).
● OSUSER The operating system user name associated with the client process. If the client process is
impersonating another user (or the set ID bit is set on Unix), the impersonated user name is returned. An
empty string is returned for version 10.0.1 and earlier clients, as well as for HTTP and TDS clients.
● PID The process ID of the client (Windows and Unix only).
● THREAD The thread ID of the client (Windows and Unix only).
● TIMEZONEADJUSTMENT The number of minutes that must be added to the Coordinated Universal
Time (UTC) to display time local to the connection.
● VERSION The version of the client library in use, including major and minor values, and a build
number (for example 11.0.0.2023).
If you specify a debug log file in your client connection parameters, the APPINFO string is added to the file.
See also
● “How connection parameters work” on page 76
● “Connection parameter tips” on page 102
● “request_timeout option [database]” on page 512
● AppInfo property: “Connection-level properties” on page 538
Example
Connect to the sample database from Interactive SQL (the iAnywhere JDBC driver is used by default):
dbisql -c "UID=DBA;PWD=sql;DBF=samples-dir\demo.db"
Connect to the sample database from Interactive SQL, appending your own information to the AppInfo
property:
dbisql -c "UID=DBA;PWD=sql;DBF=samples-dir\demo.db;APP=Interactive SQL
connection"
Usage
Anywhere
Values
YES, NO
Default
YES
Remarks
By default, if no server is found during a connection attempt, and a database file, database name, or the
START connection parameter is specified, then a database server is started on the same computer. You can
turn this behavior off by setting the AutoStart (ASTART) connection parameter to NO in the connection
string. The database server is not autostarted if the CommLinks [LINKS] parameter includes TCPIP.
See also
● “How connection parameters work” on page 76
● “Connection parameter tips” on page 102
● “Locating a database server” on page 107
● “CommLinks connection parameter [LINKS]” on page 254
● “Elevate connection parameter” on page 264
Usage
Embedded databases
Values
YES, NO
Default
YES
Remarks
By default, any database server that is started from a connection string is stopped when there are no more
non-HTTP connections to it. As well, any database that is loaded from a connection string is unloaded as
soon as there are no more non-HTTP connections to it. This behavior is equivalent to AutoStop=YES.
If you supply AutoStop=NO, any database that you start in that connection remains running when there are
no more non-HTTP connections to it. As a consequence, the database server remains operational as well.
If the only connection to a database is an HTTP connection, and the database is configured to stop
automatically, when the HTTP connection disconnects, the database does not autostop. As well, if a database
that is configured to stop automatically has an HTTP connection and a command sequence or TDS
connection, when the last command sequence or TDS connection disconnects, the database autostops, and
any HTTP connections are dropped. See “-ga server option” on page 178 and “AutoStop connection
parameter [ASTOP]” on page 251.
The AutoStop (ASTOP) connection parameter is used only if you are connecting to a database that is not
currently running. It is ignored if the database is already started.
In .NET applications, you should be careful when using the AutoStop connection parameter. Closing a
connection will close it as far as the application is concerned, but active connections remain open when
connection pooling is enabled. As a result the server does not shut down, even though you may expect it to
do so.
See also
● “How connection parameters work” on page 76
● “Connection parameter tips” on page 102
● “Connection pooling” [SQL Anywhere Server - Programming]
● “Starting and stopping databases” on page 49
● “START DATABASE statement” [SQL Anywhere Server - SQL Reference]
Usage
Anywhere
Values
String
Default
The local character set.
For more information about how the local character set is determined, see “Determining locale
information” on page 369.
Remarks
If you supply a value for CharSet, the specified character set is used for the current connection. Setting
CharSet=none disables character set conversion for the connection.
When unloading data, you can specify the character set using the CharSet connection parameter. For more
information about valid character set values, see “Recommended character sets and
collations” on page 378.
In order to avoid lossy character set conversions, setting the CHARSET connection parameter is not
recommended when using Unicode client APIs. Unicode client APIs include ADO.NET, OLE DB, and the
iAnywhere JDBC driver. ODBC is also a Unicode client API when the wide (Unicode) functions are used.
See also
● “How connection parameters work” on page 76
● “Connection parameter tips” on page 102
● “SACHARSET environment variable” on page 320
● “Understanding the locale character set” on page 361
Usage
Anywhere
Values
Integer [ k ]
Default
If no CommBufferSize value is set, the CommBufferSize is controlled by the setting on the server, which
defaults to 7300 bytes on all operating systems except Windows Mobile. On Windows Mobile, the default
is 1460 bytes.
Remarks
The CommBufferSize (CBSIZE) connection parameter specifies the size of communication packets, in
bytes. Use k to specify units of kilobytes. The minimum value of CommBufferSize is 500 bytes, and the
maximum is 16000 bytes.
The protocol stack sets the maximum size of a packet on a network. If you set the CommBufferSize to be
larger than that permitted by your network, the communication packets are broken up by the network
software. The default size is a multiple of the standard ethernet TCP/IP maximum packet size (1460 bytes).
A larger packet size may improve performance for multi-row fetches and fetches of larger rows, but it also
increases memory usage for both the client and the server.
If CommBufferSize is not specified on the client, the connection uses the server's buffer size. If
CommBufferSize is specified on the client, the connection uses the CommBufferSize value.
Using the -p database server option to set the CommBufferSize causes all clients that do not specify their
own CommBufferSize to use the size specified by the -p database server option.
See also
● “How connection parameters work” on page 76
● “Connection parameter tips” on page 102
● “Tuning TCP/IP performance” on page 136
● “-p server option” on page 200
Example
To set the buffer size to 1460 bytes:
...
CommBufferSize=1460
...
Alternatively, you can set this parameter by entering its value in the Buffer Size text box on the Network
tab of the ODBC Configuration For SQL Anywhere 11 window.
Usage
Anywhere. The CommLinks (LINKS) connection parameter is optional for connections to a personal server,
and required for connections to a network server.
Values
String
Default
Use only the shared memory communication protocol to connect.
Remarks
If you do not specify a CommLinks (LINKS) connection parameter, the client searches for a server on the
current computer only, and only using a shared memory connection. This is the default behavior, and is
equivalent to CommLinks=ShMem. The shared memory protocol is the fastest communication link between
a client and server running on the same computer, as is typical for applications connecting to a personal
database server.
For information about securing shared memory connections on Unix, see “Security tips” on page 950.
If you specify CommLinks=ALL, the client searches for a server using all available communication
protocols. Since there may be an impact on performance if you specify CommLinks=ALL, use this setting
only when you don't know which protocol to use.
If you specify one or more protocols in the CommLinks (LINKS) connection parameter, the client uses the
named communication protocol(s), in the order specified, to search for a network database server. Note that
if shared memory is specified, an attempt to connect using shared memory is made first, and then the
remaining communication protocols are tried in the order in which they are specified. A connection error
appears and the connection attempt aborts if the connection fails to connect using a specified protocol, even
if there are protocols remaining in the list to try.
CommLinks (LINKS) connection parameter values are case insensitive, and include:
● SharedMemory (ShMem) Start the shared memory protocol for same-computer communication.
This is the default setting. The client tries shared memory first if it is included in a list of protocols,
regardless of the order in which protocols appear.
● ALL Attempt to connect using the shared memory protocol first, followed by all remaining and
available communication protocols. Use this setting if you are unsure of which communication
protocol(s) to use.
● TCPIP (TCP) Start the TCP/IP communication protocol. TCP/IP is supported on all operating systems.
A personal database server is not autostarted if the CommLinks [LINKS] parameter includes TCPIP.
Each of these values can have additional network protocol options supplied.
See “Network protocol options” on page 286.
You may want to use a specific protocol, as opposed to ALL, for the following reasons:
● The network library starts slightly faster if the client uses only necessary network protocols.
● Connecting to the database may be faster.
● You must specify the protocol explicitly if you want to tune the broadcast behavior of a particular protocol
by providing additional network protocol options.
The CommLinks (LINKS) connection parameter corresponds to the database server -x option.
See also
● “Network protocol options” on page 286
● “Client/server communications” on page 133
● “-x server option” on page 222
● “How connection parameters work” on page 76
● “Connection parameter tips” on page 102
● “Server name caching for faster connections” on page 110
● CommLinks property: “Connection-level properties” on page 538
Examples
The following connection string fragment starts the TCP/IP protocol only:
CommLinks=tcpip
The following connection string fragment starts the shared memory protocol and searches for the database
server over shared memory. If the search fails, it then starts the TCP/IP protocol and searches for the server
on the local network.
CommLinks=tcpip,shmem
The following connection string fragment starts the shared memory protocol and searches for the server over
shared memory. If the search fails, it then starts the TCP protocol and searches for the server on the local
network, as well as the host kangaroo. Note that if the server is found over shared memory, the TCP link is
not started.
CommLinks=shmem,tcpip(HOST=kangaroo)
Turns compression on or off for a connection. Compressing a connection may improve performance under
some circumstances.
Usage
Anywhere except with TDS connections. TDS connections (including jConnect) do not support SQL
Anywhere communication compression.
Values
YES, NO
In the case of a difference between client and server settings, the client setting applies.
Default
NO
If a value is not set for the Compress connection parameter, the compression status is controlled by the setting
on the server, which defaults to no compression.
Remarks
The packets sent between a SQL Anywhere client and server can be compressed using the Compress (COMP)
connection parameter. Large data transfers with highly compressible data tend to get the best compression
rates.
Specify YES or NO to turn communication compression on or off for the connection. They are case
insensitive.
It is recommended that you conduct a performance analysis on the particular network and using the particular
application before using communication compression in a production environment.
To enable compression for all remote connections on the server, use the -pc server option.
Note that same-computer connections over any communication link will not enable compression, even if
the -pc option or COMPRESS=YES parameter is used.
See also
● “How connection parameters work” on page 76
● “Connection parameter tips” on page 102
● “-pc server option” on page 201
● “Adjusting communication compression settings to improve performance” on page 141
● “Use the compression features” [SQL Anywhere Server - SQL Usage]
Examples
The following connection string fragment turns packet compression ON:
Compress=YES
Usage
Anywhere except TDS. Only applies to compressed connections.
Values
Integer [ k ]
If both the client and server specify different compression threshold settings, the client setting applies.
Default
120
If no CompressionThreshold value is set, the compression threshold value is controlled by the setting on the
server, which defaults to 120 bytes.
Remarks
When compression is enabled, individual packets may or may not be compressed, depending on their size.
For example, SQL Anywhere does not compress packets smaller than the compression threshold, even if
communication compression is enabled. As well, small packets (less than about 100 bytes) usually do not
compress at all. Since CPU time is required to compress packets, attempting to compress small packets could
actually decrease performance.
This value represents the minimum size, in bytes, of packets to be compressed. Use k to specify units of
kilobytes. The minimum supported value is 1 byte, and the maximum supported value is 32767 bytes. Values
less than 80 bytes are not recommended.
Generally speaking, lowering the compression threshold value may improve performance on very slow
networks, while raising the compression threshold may improve performance by reducing CPU. However,
since lowering the compression threshold value will increase CPU usage on both the client and server, a
performance analysis should be done to determine whether or not changing the compression threshold is
beneficial.
See also
● “-pt server option” on page 201
● “Adjusting communication compression settings to improve performance” on page 141
● “How connection parameters work” on page 76
● “Connection parameter tips” on page 102
Example
Connect, with a compression threshold of 100 bytes.
CompressionThreshold=100
Usage
Anywhere
Values
String
Default
No connection name.
Remarks
An optional parameter, providing a name for the particular connection you are making. You can leave this
unspecified unless you are going to establish more than one connection, and switch between them.
The connection name is not the same as the data source name.
See also
● “How connection parameters work” on page 76
● “Connection parameter tips” on page 102
● “SET CONNECTION statement [Interactive SQL] [ESQL]” [SQL Anywhere Server - SQL Reference]
Example
Connect, naming the connection first-con:
CON=first-con
Usage
Embedded databases
Values
String
Default
There is no default setting.
Remarks
The DatabaseFile (DBF) connection parameter is used to load and connect to a specific database file that is
not already running on a database server.
● If the database you want to connect to is not already running, use the DatabaseFile (DBF) connection
parameter so the database can be started.
● If the file name does not include an extension, SQL Anywhere looks for a file with the .db extension.
● The path of the file is relative to the working directory of the database server. If you start the server from
a command prompt, the working directory is the directory that you are in when entering the command.
If you start the server from an icon or shortcut, it is the working directory that the icon or shortcut specifies.
It is recommended that you supply a complete path and file name.
● If you specify both the database file and the database name, an attempt is made to connect to a running
database with the specified name (the database file is ignored), and if that fails, an attempt is made to
autostart a database using both the database file and database name. The database server is not autostarted
if the CommLinks [LINKS] parameter includes TCPIP.
Caution
The database file must be on the same computer as the database server. Starting a database file that is located
on a network drive can lead to file corruption.
See also
● “-gd server option” on page 179
● “CommLinks connection parameter [LINKS]” on page 254
● “DatabaseName connection parameter [DBN]” on page 261
● “How connection parameters work” on page 76
● “Connection parameter tips” on page 102
● “Connecting to an embedded database” on page 84
Examples
The DatabaseFile (DBF) connection parameter in the following example loads and connects to the sample
database, demo.db:
DBF=samples-dir\demo.db
Specifying DBF=cities.db would fail to connect to the running database named Kitchener.
Usage
Anywhere
Values
String
Default
None
Remarks
You must specify this parameter when you start an encrypted database with a connect request. You do not
need to specify this parameter if you are connecting to an encrypted database that is already running.
The encryption key is a string, including mixed cases, numbers, letters, and special characters. Database
keys cannot include leading spaces, trailing spaces, or semicolons.
If you want to secure communication packets between client applications and the database server use the -
ec server option and transport-layer security. See “Transport-layer security” on page 977.
See also
● “Configuring client applications to use transport-layer security” on page 990
● “-ec server option” on page 170
● “-ek database option” on page 239
● “-ep server option” on page 173
● “-es server option” on page 174
● “How connection parameters work” on page 76
● “Connection parameter tips” on page 102
● “Encryption connection parameter [ENC]” on page 266
Example
The following fragment illustrates the use of the DatabaseKey (DBKEY) connection parameter:
"UID=DBA;PWD=sql;ENG=myeng;DBKEY=V3moj3952B;DBF=samples-dir\demo.db"
Usage
Running local databases or network servers
Values
String
Default
There is no default setting.
Remarks
Whenever a database is started on a server, it is assigned a database name, either by the administrator using
the -n option, or by the server using the base of the file name with the extension and path removed.
You can only use the database name utility_db to connect to the SQL Anywhere utility database. See “Using
the utility database” on page 22.
Note
The DatabaseName (DBN) connection parameter is recommended for naming databases, rather than using
the -n option with the DatabaseSwitches (DBS) connection parameter.
If the database you want to connect to is already running, you should specify the database name rather than
the database file.
A connection will only occur if the name of the running database matches the name that is specified in the
DatabaseName (DBN) parameter.
Note
If you specify both the database file and the database name, an attempt is made to connect to a running
database with the specified name (the database file is ignored), and if that fails, an attempt is made to autostart
a database using both the database file and database name.
See also
● “How connection parameters work” on page 76
● “Connection parameter tips” on page 102
● “DatabaseName protocol option [DBN]” on page 290
Example
To start a database file named cities.db and rename the database Kitchener, you can use the following
command:
Assuming you have run the above command, you can successfully connect to the running database named
Kitchener as follows:
DBN=Kitchener
Alternatively, you could use the following to successfully connect to the running database named Kitchener:
DBN=Kitchener;DBF=cities.db
However, specifying the following would fail to connect to the database named Kitchener:
DBF=cities.db
Usage
Connecting to a server when the database is not loaded. This connection parameter autostarts a server with
the specified database and options if a server is not already running.
Values
String
Default
No options.
Remarks
You should supply DatabaseSwitches only if you are connecting to a database that is not currently running.
When the server starts the database specified by DatabaseFile, the server uses the supplied DatabaseSwitches
to determine startup options for the database.
Only database options can be supplied using this parameter. Server options must be supplied using the
StartLine connection parameter.
See “Database options” on page 235.
Note
The DatabaseName (DBN) connection parameter is recommended for naming databases, rather than using
the -n option with the DatabaseSwitches (DBS) connection parameter.
See also
● “The SQL Anywhere database server” on page 148
● “StartLine connection parameter [START]” on page 282
● “How connection parameters work” on page 76
● “Connection parameter tips” on page 102
Example
The following command, entered on one line at a command prompt, connects to the default database server,
loads the database file demo.db (DatabaseFile (DBF) connection parameter), names it my-db (DatabaseName
(DBN) connection parameter) and starts it in read-only mode (-r option).
dbisql -c "UID=DBA;PWD=sql;DBF=samples-dir\demo.db;DBN=my-db;DBS=-r"
Usage
Anywhere
Values
String
Default
There is no default data source name.
Remarks
It is common practice for ODBC applications to send only a data source name to ODBC. The ODBC driver
manager and ODBC driver locate the data source, which contains the remainder of the connection parameters.
In SQL Anywhere, embedded SQL applications can also use ODBC data sources to store connection
parameters.
See also
● “FileDataSourceName connection parameter [FILEDSN]” on page 268
● “How connection parameters work” on page 76
● “Connection parameter tips” on page 102
● “Using ODBC data sources on Unix” on page 97
● “Working with ODBC data sources” on page 90
Example
The following parameter uses a data source name:
DSN=My Database
Usage
Anywhere
Values
YES, NO
Default
NO
Remarks
By default, when the database server gets a simple fetch request, the application asks for extra rows. You
can disable this behavior by setting this parameter to YES.
See “Using cursors in procedures and triggers” [SQL Anywhere Server - SQL Usage].
Setting the DisableMultiRowFetch (DMRF) connection parameter to YES is equivalent to setting the
prefetch database option to Off.
See “Prefetching rows” [SQL Anywhere Server - Programming].
See also
● “How connection parameters work” on page 76
● “Connection parameter tips” on page 102
● “prefetch option [database]” on page 505
Example
The following connection string fragment prevents prefetching:
DMRF=YES
Usage
Windows Vista only
Values
YES, NO
Default
NO
Remarks
You can specify ELEVATE=YES in your connection string so that autostarted database server executables
are elevated. This allows non-elevated client processes to autostart elevated servers, which is necessary on
Windows Vista because non-elevated servers cannot use AWE memory. This parameter is ignored if the
database server is not autostarted. You must specify the -cw option when starting the database server
command to use an AWE cache.
See also
● “-cm server option” on page 163
● “-cw server option” on page 166
Example
The following connection string fragment causes autostarted database servers to be elevated on Windows
Vista so that they can use an AWE cache:
"Elevate=YES;START=dbeng11 -cw"
Usage
Anywhere
Values
String
Default
None
Remarks
Caution
Data sources are stored on disk as a file or in the registry. Storing passwords in clear text or using an encrypted
password is a significant security risk. It is not recommended if there is any sensitive data stored in the
database. When you enter a password into a data source, it can be stored in an encrypted form to provide
slightly more security than storing it in clear text.
On Unix, this information is stored in the system information file (named .odbc.ini by default).
For more information about how the system information file is located, see “Using ODBC data sources on
Unix” on page 97.
If both the Password (PWD) connection parameter and the EncryptedPassword (ENP) connection parameter
are specified, Password (PWD) takes precedence.
See also
● “How connection parameters work” on page 76
● “Connection parameter tips” on page 102
● “Password connection parameter [PWD]” on page 276
Usage
For TLS, TCP/IP only.
For NONE or SIMPLE, anywhere.
Values
Encryption= { NONE
| SIMPLE
| TLS( TLS_TYPE=cipher;
[ FIPS={ Y | N }; ]
TRUSTED_CERTIFICATES=public-certificate ) }
Default
NONE
Remarks
You can use this parameter if you want to secure communications between client applications and the
database server using transport-layer security or simple encryption. See “Transport-layer
security” on page 977.
Starting the database server with -ec SIMPLE tells the database server to accept only connections
using simple encryption. TLS connections (ECC, RSA, RSA FIPS) fail, and connections requesting no
encryption use simple encryption.
Starting the database server with -ec SIMPLE,TLS( TLS_TYPE=ECC;... ) tells the database
server to accept only connections with ECC TLS encryption or simple encryption. Both RSA and RSA
FIPS connections fail, and connections requesting no encryption use simple encryption.
● cipher can be RSA or ECC for RSA and ECC encryption, respectively. For FIPS-approved RSA
encryption specify TLS_TYPE=RSA;FIPS=Y. RSA FIPS uses a separate approved library, but is
compatible with servers specifying RSA with SQL Anywhere 9.0.2 or later.
The connection fails if the cipher does not match the encryption (RSA or ECC) used to create your
certificates.
● public-certificate is the path and file name of a file that contains one or more trusted certificates. If
you are using FIPS-approved RSA encryption, you must generate your certificates using RSA.
For more information about verifying certificate fields for server authentication, see “Verifying certificate
fields” on page 991.
For more information about using digital certificates, see “Creating digital certificates” on page 983.
You can use the CONNECTION_PROPERTY system function to retrieve the encryption settings for the
current connection:
The function returns one of five values: None, Simple, ecc_tls, rsa_tls, or rsa_tls_fips depending which type
of encryption is being used by the connection.
See “CONNECTION_PROPERTY function [System]” [SQL Anywhere Server - SQL Reference].
See also
● “Configuring client applications to use transport-layer security” on page 990
● “-ec server option” on page 170
● “-ek database option” on page 239
● “-ep server option” on page 173
● “-es server option” on page 174
● “How connection parameters work” on page 76
● “Connection parameter tips” on page 102
● “DatabaseKey connection parameter [DBKEY]” on page 260
Examples
The following connection string fragment connects to a database server named demo with a TCP/IP link,
using transport-layer security and elliptic-curve encryption:
"ENG=demo;LINKS=tcpip;ENCRYPTION=tls(tls_type=ecc;trusted_certificates=eccser
ver.id)"
The following connection string fragment connects to a database server named demo with a TCP/IP link,
using transport-layer security and RSA encryption:
"ENG=demo;LINKS=tcpip;ENCRYPTION=tls(tls_type=rsa;fips=n;trusted_certificates
=rsaserver.id)"
The following connection string fragment connects to a database server named demo with a TCP/IP link,
using simple encryption:
"ENG=demo;LINKS=tcpip;ENCRYPTION=simple"
Usage
Anywhere
Values
String
Default
There is no default name.
Remarks
File data sources hold the same information as ODBC data sources stored in the registry. File data sources
can be easily distributed to end users so that connection information does not have to be reconstructed on
each computer.
Both ODBC and embedded SQL applications can use File data sources.
See also
● “DataSourceName connection parameter [DSN]” on page 263
● “How connection parameters work” on page 76
● “Connection parameter tips” on page 102
● “Using file data sources on Windows” on page 96
Usage
Only with the db_start_engine function.
Values
YES, NO
Default
NO
Remarks
By setting ForceStart=YES, the db_start_engine function starts a server without attempting to connect to
one, even if there is one already running.
See also
● “db_start_engine function” [SQL Anywhere Server - Programming]
● “How connection parameters work” on page 76
● “Connection parameter tips” on page 102
Usage
Anywhere except with TDS and Shared Memory connections. Shared Memory and TDS connections
(including jConnect) ignore the SQL Anywhere Idle (IDLE) connection parameter.
Values
Integer
Default
None
Remarks
The Idle (IDLE) connection parameter applies only to the current connection. You can have multiple
connections on the same server set to different timeout values.
If no connection idle timeout value is set, the idle timeout value is controlled by the setting on the server,
which defaults to 240 minutes. In case of a conflict between timeout values, the connection timeout value
supercedes any server timeout value whether specified or unspecified.
The minimum value for the IDLE connection parameter is 1 minute, and the maximum supported value is
32767 minutes. If you specify 0, idle timeout checking is turned off for the connection.
See also
● “-ti server option” on page 213
● “How connection parameters work” on page 76
Example
The following connection string fragment sets the timeout value for this connection to 10 minutes:
"ENG=myeng;LINKS=tcpip;IDLE=10"
Usage
Anywhere
Values
YES, NO
Default
NO
Remarks
The Integrated (INT) connection parameter has the following settings:
● YES An integrated login is attempted. If the connection attempt fails and the login_mode option is set
to Standard,Integrated, a standard login is attempted.
● NO This is the default setting. No integrated login is attempted.
For a client application to use an integrated login, the server must be running with the login_mode database
option set to a value that includes Integrated.
See also
● “login_mode option [database]” on page 481
● “How connection parameters work” on page 76
● “Connection parameter tips” on page 102
● “Using integrated logins” on page 113
Example
The following data source fragment uses an integrated login:
INT=YES
Usage
All platforms except Windows Mobile.
Values
YES, NO, SSPI, or GSS-API-library-file
Default
NO
Remarks
The Kerberos [KRB] connection parameter has the following settings:
● YES A Kerberos authenticated login is attempted.
● NO No Kerberos authenticated login is attempted. This is the default.
● SSPI A Kerberos authenticated login is attempted, and the built-in Windows SSPI interface is used
instead of a GSS-API library. SSPI can only be used on Windows platforms, and it cannot be used with
a Key Distribution Center (KDC) other than the Domain Controller Active Directory KDC. If your
Windows client computer has already logged in to a Windows domain, SSPI can be used without needing
to install or configure a Kerberos client.
● GSS-API-library-file A Kerberos authenticated login is attempted, and this string specifies the file
name of the Kerberos GSS-API library (or shared object on Unix). This is only required if the Kerberos
client uses a different file name for the Kerberos GSS-API library than the default, or if there are multiple
GSS-API libraries installed on the computer.
The UserID and Password connection parameters are ignored when using a Kerberos authenticated login.
To use Kerberos authentication, a Kerberos client must already be installed and configured (nothing needs
to be done for SSPI), the user must have already logged in to Kerberos (have a valid ticket-granting ticket),
and the database server must have enabled and configured Kerberos authenticated logins.
See also
● “-kl server option” on page 191
● “-kr server option” on page 192
● “-krb server option” on page 192
● “Using Kerberos authentication” on page 121
● “GRANT statement” [SQL Anywhere Server - SQL Reference]
● “Using SSPI for Kerberos logins on Windows” on page 126
Examples
Kerberos=YES
Kerberos=SSPI
Kerberos=c:\Program Files\MIT\Kerberos\bin\gssapi32.dll
Usage
Anywhere
Values
The two-letter combination representing a language. For example, specifying LANG=DE sets the default
language to German.
Default
The language specified by (in order) the SALANG environment variable, the dblang utility, or the installer.
Remarks
This connection parameter establishes the language for the connection. Any errors or warnings from the
server are delivered in the specified language, assuming that the server supports the language.
If no language is specified, the default language is used. The default language is the language specified by,
in order, the SALANG environment variable, the dblang utility, or the installer.
For more information about language codes, see “Understanding the locale language” on page 359.
This connection parameter only affects the connection. Messages returned from SQL Anywhere tools and
utilities appear in the default language, while the messages returned from the server appear in the connection's
language.
See also
● “How connection parameters work” on page 76
● “Connection parameter tips” on page 102
Usage
Anywhere
Values
YES, NO, AUTO
Default
AUTO
Remarks
● YES Always queue the cursor close request, which saves a round trip, but can cause locks and other
resources to be held after the cursor is closed by the client. The cursor close is performed when the next
request is sent to the database server on the same connection. Any isolation level 1 cursor stability locks
still apply to the cursor while the CLOSE cursor-name database request is queued.
When this connection parameter is set to YES or AUTO, cursors are not closed until the next database
request.
Enabling this option can improve performance, if your network exhibits poor latency or your application
sends many cursor open and close requests.
See also
● “How connection parameters work” on page 76
● “Connection parameter tips” on page 102
● “Reduce requests between client and server” [SQL Anywhere Server - SQL Usage]
Usage
Network server only.
All platforms except non-threaded Unix applications.
Values
Integer, in seconds
Default
None
If no LivenessTimeout value is set, the LivenessTimeout is controlled by the setting on the server, which
defaults to 120 seconds.
Remarks
A liveness packet is sent periodically across a client/server TCP/IP communication protocol to confirm that
a connection is intact. If the client runs for the LivenessTimeout period without detecting a liveness request
or response packet, the communication is ended.
Liveness packets are sent when a connection has not sent any packets for between one third and two thirds
of the LivenessTimeout value.
When there are more than 200 connections to a server, the server automatically calculates a higher
LivenessTimeout value based on the stated LivenessTimeout value. This enables the server to handle a large
number of connections more efficiently.
Alternatively, you can set this parameter by entering its value in the LivenessTimeout text box on the
Network tab of the ODBC Configuration For SQL Anywhere 11 window.
The minimum value for the LivenessTimeout connection parameter is 30 seconds, and the maximum value
is 32767 seconds. If you specify 0, liveness timeout checking is turned off for the connection. Any non-zero
value less than the minimum value is reset to the minimum value. For example, a connection string containing
"LivenessTimeout=5" uses "LivenessTimeout=30".
See also
● “How connection parameters work” on page 76
● “Connection parameter tips” on page 102
● “-tl server option” on page 214
Example
The following connection string fragment sets a LivenessTimeout value of 10 minutes:
LTO=600
Usage
Anywhere
Values
String
Default
No log file.
Remarks
If you want to save client error messages and debugging messages in a file, use the LogFile (LOG) connection
parameter.
If the file name does not include a path, it is relative to the current working directory of the client application.
The LogFile (LOG) connection parameter is connection-specific, so from a single application you can set
different LogFile arguments for different connections.
Typical log file contents are as follows:
See also
● “How connection parameters work” on page 76
● “Connection parameter tips” on page 102
● “LogFile protocol option [LOG]” on page 296
Example
The following command line starts Interactive SQL, connecting to the sample database with a LogFile (LOG)
connection parameter:
dbisql -c "DSN=SQL Anywhere 11 Demo;LOG=d:\logs\test.txt"
Usage
Anywhere. The client library prompting for a new password is only supported on Microsoft Windows.
Values
String, *
Default
The password is not changed, and the client library does not prompt for a new password.
Remarks
This connection parameter is very effective when you implement a login policy using the password_life_time
or password_expiry_on_next_login options. Alternatively, you can implement a password expiry policy by
having the login_procedure signal the Password has expired error.
If the user provides a new password, the database server authenticates the user ID and password and attempts
to change the password before the login_procedure option is called. This process allows the user to change
an expired password without the involvement of a DBA. If you have set the verify_password_function option,
the new password is verified. If you are authenticating with an Integrated or Kerberos login, the original
password is not validated and the database server ignores the new password value and the password is not
changed.
On Microsoft Windows, if you use the special value *, the client library prompts for a new password during
a connection attempt only if the existing password has expired. The user must provide their existing
password, provide their new password, and confirm their new password. When the user completes the fields
and clicks OK, the old password is authenticated and the database server attempts to change the password.
If you have set the verify_password_function option, the new password is verified. The process of verifying
if a user's password has expired, prompting for a password, and authenticating and changing the password
occurs with a single connect call to the client library.
A user receives a Password has expired error if their environment does not support password
prompting. In a Microsoft Windows environment, the prompt window might not correctly prevent interaction
with the calling application's window (it may not be modal or have the correct parent window) if the calling
application has multiple top-level windows or if the application's top level windows are minimized.
In a Windows environment, if you use the ODBC SQLDriverConnect function and the DriverCompletion
argument is anything other than SQL_DRIVER_NOPROMPT, the connection prompts for a new password
if the password has expired. The connection might prompt for a new password in OLE DB when the
DBPROP_INIT_PROMPT property is anything other than DBPROMPT_NOPROMPT. Both cases function
as if the NewPassword=* connection parameter was specified.
See also
● “GRANT statement” [SQL Anywhere Server - SQL Reference]
● “login_procedure option [database]” on page 483
● “verify_password_function option [database]” on page 532
● “post_login_procedure option [database]” on page 503
Example
The following connection string changes the password of user Test1 when they connect:
"UID=Test1;PWD=welcome;NEWPWD=hello"
In a Windows environment, the following connection string prompts the user Test1 for a new password when
the existing password expires:
"UID=Test1;PWD=welcome;NEWPWD=*"
Usage
Anywhere
Values
String
Default
No password provided.
Remarks
Every user of a database has a password. The password must be supplied for the user to be allowed to connect
to the database. Passwords have a maximum length of 255 bytes and are case sensitive. Passwords cannot
include leading spaces, trailing spaces, or semicolons.
The Password (PWD) connection parameter is not encrypted. If you are storing passwords in a data source,
you should use the EncryptedPassword (ENP) connection parameter. Sybase Central and the SQL Anywhere
ODBC configuration tool both use encrypted passwords.
If both the Password (PWD) connection parameter and the EncryptedPassword (ENP) connection parameter
are specified, the Password (PWD) connection parameter takes precedence.
Alternatively, you can set this parameter in the Password text box in the Connect window and ODBC
Configuration For SQL Anywhere 11 window.
Caution
Storing the password in a DSN or text file is a significant security risk. It is not recommended if there is any
sensitive data stored in the database. Sybase Central and the SQL Anywhere ODBC Configuration tool both
store the password in a DSN using encrypted passwords, but even encrypted passwords provide only a low
level of security.
See also
● “Setting a password” on page 401
● “Increasing password security” on page 952
● “EncryptedPassword connection parameter [ENP]” on page 265
● “GRANT statement” [SQL Anywhere Server - SQL Reference]
● “Case sensitivity” [SQL Anywhere Server - SQL Usage]
● “How connection parameters work” on page 76
● “Connection parameter tips” on page 102
Example
The following connection string fragment supplies the user ID DBA and password sql.
UID=DBA;PWD=sql
Usage
Anywhere
Values
Integer [ k | m ]
Default
512 KB (524288) all platforms except Windows Mobile
64 KB (65536 bytes) Windows Mobile
Remarks
The PrefetchBuffer (PBUF) connection parameter controls the memory allocated on the client to store
prefetched rows. The value is in bytes, but you can use k or m to specify units of kilobytes or megabytes,
respectively. This connection parameter accepts values between 64 KB and 8 MB.
In some circumstances, increasing the number of prefetched rows can improve query performance. You can
increase the number of prefetched rows using the PrefetchRows (PROWS) and PrefetchBuffer (PBUF)
connection parameters.
Increasing the PrefetchBuffer (PBUF) connection parameter also increases the amount of memory used to
buffer GET DATA requests. This may improve performance for some applications that process many GET
DATA (SQLGetData) requests.
For compatibility with previous versions, if a value less than 16384 is specified, it is interpreted as kilobytes.
Using kilobytes without the k suffix in the PrefetchBuffer connection parameter is deprecated. See
“PrefetchRows connection parameter [PROWS]” on page 279.
See also
● “How connection parameters work” on page 76
● “Connection parameter tips” on page 102
Examples
The following connection string fragment could be used to determine if the PrefetchBuffer memory limit is
reducing the number of prefetched rows.
...PrefetchRows=100;LogFile=c:\client.txt
The following string could be used to increase the memory limit to 256 KB:
...PrefetchRows=100;PrefetchBuffer=256k
Sends a prefetch request with a cursor open request when this parameter is enabled.
Usage
ODBC
Values
YES, NO
Default
NO
Remarks
Enabling this option sends a prefetch request with a cursor open request, thereby eliminating a network
request to fetch rows each time a cursor is opened. Columns must already be bound in order for the prefetch
to occur on the open. Rebinding columns between the cursor open and the first fetch when using
PrefetchOnOpen will cause reduced performance.
Making ODBC calls to SQLExecute or SQLExecDirect on a query or stored procedure which returns a result
set causes a cursor open.
Enabling this option can improve performance if your:
● network exhibits poor latency
● application sends many cursor open and close requests
Usage
Anywhere
Values
Integer
Default
10
200 for ADO.NET
Remarks
Increasing the number of rows prefetched from the database server by the client can improve performance
on cursors that only fetch relative 0 or 1, with either single row or wide fetches. Wide fetches include
embedded SQL array fetches and ODBC block fetches.
Improvements occur particularly under the following conditions:
● The application fetches many rows (several hundred or more) with very few absolute fetches.
● The application fetches rows at a high rate, and the client and server are on the same computer or
connected by a fast network.
● Client/server communication is over a slow network, such as a dial-up link or wide area network.
The number of rows prefetched is limited both by the PrefetchRows (PROWS) connection parameter and
the PrefetchBuffer (PBUF) connection parameter, which limits the memory available for storing prefetched
rows. See “PrefetchBuffer connection parameter [PBUF]” on page 278.
The maximum number of rows that can be prefetched is 1000.
See also
● “How connection parameters work” on page 76
● “Connection parameter tips” on page 102
Example
The following connection string fragment sets the number of prefetched rows to 100:
...PrefetchRows=100;...
Usage
Anywhere
Values
Integer
Default
0
Remarks
The value specified by this connection is a timeout, in seconds. It is not a counter of the number of times to
retry the connection attempt. The default value of zero indicates that the connection attempt should only be
tried once. There is a half-second delay between iterations, and the retries only occur if the connection attempt
failed because the database server was not found. Any other error is returned immediately. If the database
server is not found, the connection attempt will take at least as long as the time specified by the
RetryConnectionTimeout connection parameter.
Note that the default TCP timeout is 5 seconds, so if your connection string contains a value for RetryConnTO
that is less than 5, for example LINKS=tcp;RetryConnTO=3, then the connection attempt still takes 5
seconds.
See also
● “Timeout protocol option [TO]” on page 305
Example
The following connection string fragment tells the client library to continue to retry the connection attempt
for at least 5 seconds:
...RetryConnTO=5;...
Usage
Network servers or personal servers.
Values
String
Default
The default local database server.
Remarks
ServerName is not needed if you want to connect to the default local database server.
You need to supply a ServerName if more than one local database server is running, or if you want to connect
to a network server. In the Connect window, and in the ODBC Configuration For SQL Anywhere 11
window, this is the Server Name field.
If you are autostarting a server, you can provide a server name using this parameter.
The server name is interpreted according to the character set of the client computer. Non-ASCII characters
are not recommended in server names.
Names must be valid identifiers. Database server names cannot:
● begin with white space, single quotes, or double quotes
● end with white space
● contain semicolons
● be longer than 250 bytes
On Windows and Unix, version 9.0.2 and earlier clients cannot connect to version 10.0.0 and later database
servers with names longer than the following lengths:
● 40 bytes for Windows shared memory
● 31 bytes for Unix shared memory
● 40 bytes for TCP/IP
Note
It is recommended that you include the ServerName parameter in connection strings for deployed
applications. This ensures that the application connects to the correct server in the case where a computer is
running multiple SQL Anywhere database servers, and can help prevent timing-dependent connection
failures.
See also
● “Identifiers” [SQL Anywhere Server - SQL Reference]
● “-n server option” on page 196
● “How connection parameters work” on page 76
● “Connection parameter tips” on page 102
● “Connecting to an embedded database” on page 84
Example
Connect to a server named Guelph:
ENG=Guelph
Usage
Embedded databases
Values
String
Default
No StartLine parameter.
Remarks
You should supply a StartLine (START) connection parameter only if you are connecting to a database
server that is not currently running. The StartLine connection parameter is a command line to start a personal
database server. The database server is not autostarted if the CommLinks [LINKS] parameter includes
TCPIP.
Note
If you want to specify the database name, database file, or server, it is recommended that you use the DBN,
DBF, and ENG connection parameters, rather than the StartLine connection parameter.
The following command uses the recommended syntax:
START=dbeng11 -c 8M;ENG=mydb;DBN=mydb;DBF=c:\sample.db
For more information about available options, see “The SQL Anywhere database server” on page 148.
Note
The StartLine connection parameter is only used to start a database server if a connection cannot be made
to the specified database server or the database cannot be started and connected to on a database server that
is already running. For example, suppose you start a database server running a database as follows:
dbeng11 c:\mydb.db
Connect another database (without specifying a database server name using the ENG connection parameter):
dbisql -c "START=dbsrv11 -c 8M;DBN=seconddb;DBF=c:
\myseconddb.db;UID=DBA;PWD=sql"
In this case, the dbsrv11 database server is not started. Instead, the dbeng11 database server that was used
to start mydb.db is used to start and connect to myseconddb.db.
However, if ENG=server-name had been specified, and a server named server-name was not already running,
then the dbsrv11 database server would have started.
See also
● “How connection parameters work” on page 76
● “Connection parameter tips” on page 102
● “CommLinks connection parameter [LINKS]” on page 254
● “Connecting to an embedded database” on page 84
Example
The following data source fragment starts a personal database server with a cache of 8 MB.
StartLine=dbeng11 -c 8M;DBF=samples-dir\demo.db
Usage
db_stop_engine and db_stop_database functions only
Values
YES, NO
Default
NO
Remarks
The db_stop_engine and db_stop_database functions shut down a database server or database, respectively.
If you specify UNC=YES in the connection string, the database server or database is shut down even if there
are active connections. If Unconditional is not set to YES, then the database server or database is shut down
only if there are no active connections.
See also
● “db_stop_database function” [SQL Anywhere Server - Programming]
● “db_stop_engine function” [SQL Anywhere Server - Programming]
● “How connection parameters work” on page 76
● “Connection parameter tips” on page 102
Usage
Anywhere
Values
String
Default
None
Remarks
You must always supply a user ID when connecting to a database, unless you are using an integrated or
Kerberos login.
See also
● “How connection parameters work” on page 76
● “Connection parameter tips” on page 102
● “Database permissions and authorities overview” on page 392
Example
The following connection string fragment supplies the user ID DBA and password sql:
UID=DBA;PWD=sql
dbsrv11 -x tcpip(PARM1=value1;PARM2=value2;...)
From the client side, you enter the protocol options as the CommLinks (LINKS) connection parameter:
CommLinks=tcpip(PARM1=value1;PARM2=value2;...)
If there are spaces in a parameter, the network protocol options must be enclosed in quotation marks to be
parsed properly by the system command interpreter:
dbsrv11 -x "tcpip(PARM1=value1;PARM2=value2;...)"
CommLinks="tcpip(PARM1=value1;PARM2=value2;...)"
The quotation marks are also required under Unix if more than one parameter is given because Unix interprets
the semicolon as a command separator.
Boolean parameters are turned on with YES, Y, ON, TRUE, T, or 1, and are turned off with any of NO, N,
OFF, FALSE, F, and 0. The parameters are case insensitive.
The examples provided should all be entered on a single line; you can also include them in a configuration
file and use the @ server option to invoke the configuration file.
The options available for TCP/IP, HTTP, and HTTPS are as follows.
“Host protocol option [IP]” on page 291 “LocalOnly protocol option [LO-
CAL]” on page 296
“LDAP protocol option [LDAP]” on page 295 “LogFile protocol option [LOG]” on page 296
“LocalOnly protocol option [LO- “LogFormat protocol option [LF]” on page 297
CAL]” on page 296
“TDS protocol option” on page 305 “MyIP protocol option [ME]” on page 301
“VerifyServerName protocol option [VERI- “Timeout protocol option [TO]” on page 305
FY]” on page 306
Usage
TCP/IP
Values
String, in the form of an IP address
Default
Broadcasts to all addresses on the same subnet.
Remarks
The default broadcast address is created using the local IP address and subnet mask. The subnet mask
indicates which portion of the IP address identifies the network, and which part identifies the host.
For example, for a subnet of 10.24.98.x, with a mask of 255.255.255.0, the default broadcast address would
be 10.24.98.255.
When specifying an IPv6 address on a Windows platform, the interface identifier should be used. Unix
platforms support both interface identifiers and interface names in IPv6 addresses. The interface identifier
is required on Linux (kernel 2.6.13 and later). See “IPv6 support in SQL Anywhere” on page 135.
See also
● “BroadcastListener protocol option [BLISTENER]” on page 288
● “DoBroadcast protocol option [DOBROAD]” on page 290
● “Locating a database server using the Broadcast Repeater utility” on page 109
Example
The following connection string example tells the client to broadcast only on interface number 2 when using
IPv6:
LINKS=tcpip(BROADCAST=ff02::1%2)
Usage
TCP/IP (server side)
Values
YES, NO
Default
YES
Remarks
This option allows you to turn broadcast listening OFF for this port.
Using -sb 0 is the same as specifying BroadcastListener=NO on TCP/IP.
If broadcast listening is off, then the database server does not respond to UDP broadcasts. This means that
clients must use either the HOST= TCP protocol option to specify the hostname of the database server, or
register the database server with LDAP and use LDAP on the clients to find the database server. This also
means that the dblocate utility does not include the database server in its output.
See also
● “-sb server option” on page 207
● “Broadcast protocol option [BCAST]” on page 287
● “DoBroadcast protocol option [DOBROAD]” on page 290
Example
Start a database server that accepts TCP/IP connections, and requires that TCP/IP connections use the Host
protocol option:
The following is a fragment of a client connection string to connect to the database server:
...LINKS=tcpip;HOST=myserver;...
Usage
TCP/IP (client side only)
Values
Integer
Default
Assigned dynamically per connection by the networking implementation. If you do not have firewall
restrictions, it is recommended that you do not use this parameter.
Remarks
This option is provided for connections across firewalls, as firewall software filters according to TCP/UDP
port. It is recommended that you do not use this parameter unless you need to for firewall reasons.
The ClientPort option designates the port number on which the client application communicates using TCP/
IP. You can specify a single port number, or a combination of individual port numbers and ranges of port
numbers. For example:
● (cport=1234)
● (cport=1234,1235,1239)
● (cport=1234-1238)
● (cport=1234-1237,1239,1242)
It is best to specify a list or a range of port numbers if you want to make multiple connections using a given
Data Source or a given connect string. If you specify a single port number, then your application will be able
to maintain only one connection at a time. In fact, even after closing the one connection, there is a several
minute timeout period during which no new connection can be made using the specified port. When you
specify a list and/or range of port numbers, the application keeps trying port numbers until it finds one to
which it can successfully bind.
See also
● “Host protocol option [IP]” on page 291
● “DoBroadcast protocol option [DOBROAD]” on page 290
● “ServerPort protocol option [PORT]” on page 302
● “Connecting across a firewall” on page 136
Examples
The following connection string fragment makes a connection from an application using port 6000 to a server
named my-server using port 5000:
CommLinks=tcpip(ClientPort=6000;ServerPort=5000);ServerName=my-server
The following connection string fragment makes a connection from an application that can use ports 5050
through 5060, as well as ports 5040 and 5070 for communicating with a server named my-server using the
default server port:
CommLinks=tcpip(ClientPort=5040,5050-5060,5070);
ServerName=my-server
Usage
HTTP, HTTPS
Values
AUTO, REQUIRED, database-name
Default
AUTO
Remarks
If this parameter is set to REQUIRED, the URI must specify a database name.
If this parameter is set to AUTO, the URI may specify a database name, but does not need to do so. If the
URI contains no database name, the default database on the server is used to process web requests. Since
the server must guess whether or not the URI contains a database name when set to AUTO, you should
design your web site so as to avoid ambiguity.
If this parameter is set to the name of a database, that database is used to process all web requests. The URI
must not contain a database name.
Example
The following command starts two databases, but permits only one of them to be accessed via HTTP.
dbsrv11 -xs http(DBN=web) samples-dir\demo.db web.db
Usage
TCP/IP
Values
ALL, NONE, DIRECT (client side)
YES, NO (server side)
Default
ALL (client side)
YES (server side)
Remarks
Client usage With DoBroadcast=ALL a broadcast is performed to search for a database server. The
broadcast goes first to the local subnet. If HOST= is specified, broadcast packets are also sent to each of the
hosts. All broadcast packets are UDP packets.
With DoBroadcast=DIRECT, no broadcast is performed to the local subnet to search for a database server.
Broadcast packets are sent only to the hosts listed in the HOST (IP) protocol option. If you specify
DoBroadcast=DIRECT, the HOST (IP) protocol option is required.
Specifying DoBroadcast=NONE causes no UDP broadcasts to be used and the server address cache
(sasrv.ini) is ignored. A TCP/IP connection is made directly with the HOST/PORT specified, and the server
name is verified. With TCP/IP, you can choose not to verify the server name by setting the VerifyServerName
(VERIFY) protocol option to NO. The HOST (IP) protocol option is a required parameter, unless LDAP is
being used, while the ServerPort (PORT) protocol option is optional.
For DIRECT and NONE, you must specify the server host with the HOST option.
Server usage Setting DoBroadcast=NO prevents the database server from broadcasting to find other
servers with the same name when starting up. This is useful in certain rare circumstances, but it is not
generally recommended.
See also
● “Broadcast protocol option [BCAST]” on page 287
● “BroadcastListener protocol option [BLISTENER]” on page 288
Example
The following command starts a client without broadcasting to search for a database server. Instead, the
server is looked for only on the computer named silver.
CommLinks=tcpip(DOBROADCAST=DIRECT;HOST=silver) demo
Usage
TCP/IP
Values
String
Default
No additional computers.
Remarks
HOST specifies additional computers outside the immediate network to be searched by the client library.
On the server, the search is performed to avoid starting a server with a duplicate name. Specifying a host in
the HOST protocol option does not mean that the database server must be running on a specified hosts.
For TCP/IP, the address can be the hostname IP address. You may optionally specify a PORT value as well.
When specifying an IPv6 address on a Windows platform, the interface identifier should be used. Unix
platforms support both interface identifiers and interface names in IPv6 addresses. The interface identifier
is required on Linux (kernel 2.6.13 and later). See “IPv6 support in SQL Anywhere” on page 135.
The server prints addressing information to the database server messages window during startup if the -z
option is used. In addition, the client application writes this information to its log file if the LogFile connection
parameter is specified.
You can use a comma-separated list of addresses to search for more than one computer. You can also append
a port number to an IP address, using a colon as separator. Alternatively, you can specify the host and server
ports explicitly, as in HOST=myhost;PORT=5000. For IPv6 addresses, you must enclose the address in
parentheses, for example (fe80::5445:5245:444f):2638.
To specify multiple values for a single parameter, use a comma-separated list. When you specify multiple
ports and servers, you can associate a particular port with a specific server by specifying the port in the
HOST (IP) protocol option instead of the PORT parameter.
IP and HOST are synonyms.
See also
● “ClientPort protocol option [CPORT]” on page 289
Examples
The following connection string fragment instructs the client to look on the computers kangaroo and
197.75.209.222 (port 2369) to find a database server:
LINKS=tcpip(IP=kangaroo,197.75.209.222:2369)
The following connection string fragment instructs the client to look on the computers my-server and
kangaroo to find a database server. A connection is attempted to the first host that responds running on port
2639.
LINKS=tcpip(HOST=my-server,kangaroo;PORT=2639)
The following connection string fragment instructs the client to look for a server on host1 running on port
1234 and for a server on host2 running on port 4567. The client does not look on host1 on port 4567 or on
host2 on port 1234.
LINKS=tcpip(HOST=host1:1234,host2:4567)
The following connection string fragment instructs the client to look for a server on an IPv6 address:
LINKS=tcpip(HOST=fe80::5445:5245:444f)
The following examples demonstrate using IPv6 addresses with the Host protocol option:
Global scope address, unique everywhere, so no interface index is required
// no index required
-c "links=tcpip(Host=fd77:55d:59d9:56a:202:55ff:fe76:df19)"
// all communication is done through interface 2
-c "links=tcpip(Host=fd77:55d:59d9:56a:202:55ff:fe76:df19%2)"
// all communication is done through eth0
-c "links=tcpip(Host=fd77:55d:59d9:56a:202:55ff:fe76:df19%eth0)"
Usage
HTTPS
Values
String
Default
There is no default identity file name.
Remarks
This required option specifies the name of an identity file. The identity file contains the public certificate
and its private key, and for certificates that are not self-signed, the identity file also contains all of the signing
certificates, which includes, among other things, the encryption certificate. The password for this certificate
must be specified with the Identity_Password parameter.
See also
● “Setting up transport-layer security” on page 981
● “Identity_Password protocol option” on page 294
Example
Start a server that requires web connections to use a particular encryption certificate.
dbsrv11 -xs https(Identity=cert.file;Identity_Password=secret) ...
Usage
HTTPS
Values
String
Default
There is no default identity file password.
Remarks
This required option specifies the password that matches the encryption certificate specified by the Identity
protocol option.
See also
● “Setting up transport-layer security” on page 981
● “Identity protocol option” on page 293
Example
Start a server that requires web connections to use a particular encryption certificate.
dbsrv11 -xs https(Identity=cert.file;Identity_Password=secret) ...
Usage
HTTP
Values
Integer
Default
60
Remarks
Normally, a connection is closed after each request. When a client requests the Keep-Alive option, an HTTP
connection can be kept open after each request and response, so that multiple requests can be executed on
the same connection.
Once a connection is opened, the client has the specified amount of time to send the complete HTTP request,
including the body for POST requests. On connections where Keep-Alive is requested, the timeout is reset
after sending a result, so the beginning of each request is like the opening of a new connection.
If you do not want the connection to time out, specify kto=0.
The difference between the KeepaliveTimeout and Timeout protocol options is that KeepaliveTimeout
specifies the total time from opening the connection, while Timeout specifies the maximum amount of time
between packets within the request.
See also
● “Working with HTTP headers” [SQL Anywhere Server - Programming]
● “Timeout protocol option [TO]” on page 305
Usage
TCP/IP
Values
YES, NO, or filename
Default
YES
The default file name is saldap.ini.
Remarks
Having the database server register itself with an LDAP server allows clients to query the LDAP server.
This allows clients running over a WAN or through a firewall to find servers without specifying the IP
address. It also allows the Locate utility (dblocate) to find such servers.
Specifying LDAP=filename turns LDAP support on and uses the specified file as the configuration file.
Specifying LDAP=YES turns LDAP support on and uses saldap.ini as the configuration file.
You can hide the contents of the saldap.ini file with simple encryption using the File Hiding utility. See
“Hiding the contents of .ini files” on page 698.
LDAP is only used with TCP/IP.
See also
● “Connecting using an LDAP server” on page 138
Usage
TCP/IP, HTTP, HTTPS
Values
YES, NO
Default
NO
Remarks
If no server with the matching server name is found on the local computer, a server will not be autostarted.
The LocalOnly (LOCAL) protocol option is only useful if DoBroadcast=ALL (the default) is also specified.
LocalOnly=YES uses the regular broadcast mechanism, except that broadcast responses from servers on
other computers are ignored.
You can use the LocalOnly (LOCAL) protocol option with the server to restrict connections to the local
computer. Connection attempts from remote computers will not find this server, and the Locate [dblocate]
utility will not see this server. Running a server with the LocalOnly (LOCAL) protocol option set to YES
allows the network server to run as a personal server without experiencing connection or CPU limits.
See also
● “Broadcast protocol option [BCAST]” on page 287
● “Starting a database server that listens for web requests” [SQL Anywhere Server - Programming]
Usage
HTTP, HTTPS
Values
Filename
Default
None
Remarks
Specify the name of the file to which the database server is to write information about web requests.
See also
● “LogFormat protocol option [LF]” on page 297
● “LogMaxSize protocol option [LSIZE]” on page 298
● “LogOptions protocol option [LOPT]” on page 298
Usage
HTTP, HTTPS
Values
Format-string
Default
@T - @W - @I - @P - "@M @U @V" - @R - @L - @E
Remarks
This parameter controls the format of messages written to the log file and which fields appear in them. If
they appear in the string, the current values are substituted for the following codes as each message is written.
● @@ The @ character.
● @B Date and time that processing of the request started, unless the request could not be queued due
to an error.
● @C Date and time that the client connected.
● @D Name of the database associated with the request.
● @E Text of the error message, if an error occurred.
● @F Date and time that processing of the request finished.
● @I IP address of the client.
● @L Length of the response, in bytes, including headers and body.
● @M HTTP request method.
● @P Listener port associated with the request.
● @Q Date and time that the request was queued for processing, unless the request could not be queued
due to an error.
● @R Status code and description of the HTTP response.
● @S HTTP status code.
● @T Date and time that the current log entry was written.
● @U Requested URI.
● @V Requested HTTP version.
● @W Time taken to process the request (@F - @B), or 0.000 if the request was not processed due to
an error.
See also
● “LogFile protocol option [LOG]” on page 296
● “LogMaxSize protocol option [LSIZE]” on page 298
● “LogOptions protocol option [LOPT]” on page 298
Usage
HTTP, HTTPS
Values
Integer [ k | m | g ]
Default
0
Remarks
When the log file reaches the stated size, it is renamed and another log file is created. If LogMaxSize is zero,
the log file size is unlimited. The default value is in bytes, but you can use k, m, or g to specify units of
kilobytes, megabytes, or gigabytes, respectively.
See also
● “LogFile protocol option [LOG]” on page 296
● “LogFormat protocol option [LF]” on page 297
● “LogOptions protocol option [LOPT]” on page 298
Usage
HTTP, HTTPS
Values
NONE, OK, INFO, ERRORS, ALL, status-codes, REQHDRS, RESHDRS, HEADERS
Default
ALL
Remarks
The values available include keywords that select particular types of messages, and HTTP status codes.
Multiple values may be specified, separated by commas.
The following keywords control which categories of messages are logged:
● NONE Log nothing.
● OK Log requests that complete successfully (20x HTTP status codes).
● INFO Log requests that return over or not modified status codes (30x HTTP status codes).
● ERRORS Log all errors (40x and 50x HTTP status codes).
● ALL Log all requests.
The following common HTTP status codes are also available. They can be used to log requests that return
particular status codes:
● C200 OK
● C400 Bad request
● C401 Unauthorized
● C403 Forbidden
● C404 Not found
● C408 Request timeout
● C501 Not implemented
● C503 Service unavailable
In addition, the following keywords may be used to obtain more information about the logged messages:
● REQHDRS When logging requests, also write request headers to the log file.
● RESHDRS When logging requests, also write response headers to the log file.
● HEADERS When logging requests, also write both request and response headers to the log file (same
as REQHDRS,RESHDRS).
See also
● “LogFile protocol option [LOG]” on page 296
● “LogFormat protocol option [LF]” on page 297
● “LogMaxSize protocol option [LSIZE]” on page 298
Usage
HTTP, HTTPS
Values
Size
Default
5 (personal server)
Number of licensed connections (network server)
Remarks
The number of simultaneous connections accepted by the server. The value 0 indicates no limit.
See also
● “MaxRequestSize protocol option [MAXSIZE]” on page 300
Usage
HTTP, HTTPS
Values
Integer [ k | m | g ]
Default
100k
Remarks
The size of the largest request accepted by the server. The default value is in bytes, but you can use k, m,
or g to specify units of kilobytes, megabytes, or gigabytes, respectively. If the size of a request exceeds this
limit, the connection is closed and a 413 ENTITY TOO LARGE response is returned to the client. This
value limits only the size of the request, not that of the response. The value 0 disables this limit, but should
be used with extreme caution. Without this limit, a rogue client could overload the server or cause it to run
out of memory.
See also
● “MaxConnections protocol option [MAXCONN]” on page 299
Example
The following command line (entered all on one line) instructs the server to accept requests up to 150000
bytes in size:
dbsrv11 -xs http{MaxRequestSize=150000}
Usage
TCP/IP, HTTP, HTTPS
Values
String
Remarks
The MyIP (ME) protocol option is provided for computers with more than one network adapter.
Each adapter has an IP address. By default, the database server uses every network interface it finds. If you
don't want your database server to listen on all network interfaces, specify the address of each interface you
want to use in the MyIP (ME) protocol option.
If the keyword NONE is supplied as the IP number, no attempt is made to determine the addressing
information. The NONE keyword is intended for clients on computers where this operation is expensive,
such as computers with multiple network cards or remote access (RAS) software and a network card. It is
not intended for use on the server.
Separate multiple IP addresses with commas.
When specifying an IPv6 address on a Windows platform, the interface identifier should be used. Unix
platforms support both interface identifiers and interface names in IPv6 addresses. The interface identifier
is required on Linux (kernel 2.6.13 and later). See “IPv6 support in SQL Anywhere” on page 135.
See also
● “Using the TCP/IP protocol” on page 135
Example
The following command line (entered all on one line) instructs the server to use two network cards.
dbsrv11 -x tcpip(MyIP=192.75.209.12,192.75.209.32) "samples-dir\demo.db"
The following command line (entered all on one line) instructs the database server to use an IPv6 network
card:
dbsrv11 -x tcpip(MyIP=fe80::5445:5245:444f) "samples-dir\demo.db"
Sets the size for a buffer used by the TCP/IP protocol stack.
Usage
TCP/IP
Values
Integer [ k | m | g ]
Default
Computer-dependent.
Remarks
You may want to increase the value if BLOB performance over the network is important. By default, the
specified buffer size is in bytes. Use k, m, or g to specify units of kilobytes, megabytes, or gigabytes,
respectively.
See also
● “Using the TCP/IP protocol” on page 135
Usage
TCP/IP
Values
Integer [ k | m | g ]
Default
Computer-dependent.
Remarks
The default value is in bytes, but you can use k, m, or g to specify units of kilobytes, megabytes, or gigabytes,
respectively. You may want to increase the value if BLOB performance over the network is important.
See also
● “Using the TCP/IP protocol” on page 135
Usage
TCP/IP, HTTP, HTTPS
Values
Integer
Default
The default value for TCP/IP is 2638. The default value for HTTP is 80. The default value for HTTPS is
443.
Remarks
The Internet Assigned Numbers Authority has assigned the SQL Anywhere database server port number
2638 to use for TCP/IP communications. However, other applications are not disallowed from using this
reserved port, and this may result in an addressing collision between the database server and another
application.
In the case of the database server, the ServerPort protocol option designates the port number on which to
communicate using TCP/IP. You can specify a single port number, or a combination of individual port
numbers and ranges of port numbers. For example:
● (port=1234)
● (port=1234,1235,1239)
● (port=1234-1238)
● (port=1234-1237,1239,1242)
When you specify a list and/or range of port numbers, the database server attempts to bind to all specified
port numbers.
The database server always listens on UDP port 2638 on most operating systems, even if you specify a
different port using a network protocol option. Hence, applications can connect to the database server without
specifying a port number. Having this port available allows SQL Anywhere clients to find SQL Anywhere
database servers running on other subnets and through firewalls.
For a client, the ServerPort protocol option informs the client of the port or ports on which database servers
are listening for TCP/IP communication. The client broadcasts to every port that is specified by the ServerPort
(PORT) protocol option to find the server.
If you using a web server, by default, the database server listens on the standard HTTP and HTTPS ports of
80 and 443, respectively.
If you start a database server using TCP/IP port number 2638 (the default), then the server also listens to
UDP port 2638. The database server listens to UDP ports and responds to requests on these ports so that
clients can locate the database server by server name.
If the database server's TCP/IP port number is not 2638, then the server listens to the same UDP port as the
TCP/IP port.
UDP packets sent by the database server in response to client broadcasts contain no sensitive information.
The data contained in these packets is limited to:
● database server name
● port number
● database server version
● names of databases running on the database server
You can hide database names from broadcast requests by using the -dh option. You can also specify -sb 0
to disable the UDP listeners completely.
Differences on Mac OS X
Mac OS X does not allow multiple processes to bind to the same UDP port. When the database server is
running on one of these platforms, it only listens to the specified UDP port or port 2638 if no port is specified.
This means that clients must specify the TCP/IP port number if the server is not using the default port (2638).
For example if the database server is started with the command dbsrv11 -n MyServer samples-
dir/demo.db, a client on the same subnet can find the server using the following connection parameters
ENG=MyServer;LINKS=tcpip. If another server is started on Mac OS X, with the following command
dbsrv11 -n SecondServer -x tcpip(PORT=7777) samples-dir/demo.db, a client on the
same subnet can find the server using the connection parameters
ENG=SecondServer;LINKS=tcpip(PORT=7777). Note that if the database server was running on
a platform other than Mac OS X, then the client would not need to specify the PORT parameter.
Additionally, on Mac OS X, if a SQL Anywhere database server is already using port 2638, and a second
network database server was started without the PORT protocol option, the second network server would
fail to start. The reason for this is users need to know and specify the server's port number in their connection
parameters. Personal servers start successfully, even if port 2638 is in use, because shared memory is
normally used to connect to personal servers.
See also
● “-x server option” on page 222
● “-xs server option” on page 225
● “-sb server option” on page 207
Example
The following example shows how to use the PORT protocol option to specify the port the server starts on.
1. Start a network database server:
dbsrv11 -x tcpip -n server1
The default port is currently allocated, and so the server starts on another port. On Mac OS X, this will
fail.
3. If another web server on your computer is already using port 80 or you do not have permission to start
a server on this low of a port number, you may want to start a server that listens on an alternate port,
such as 8080:
Usage
TCP/IP (server side only)
Values
YES, NO
Default
YES
Remarks
To disallow TDS connections to a database server, set TDS to NO. If you want to ensure that only encrypted
connections are made to your server, this protocol option is the only way to disallow TDS connections.
See also
● “-ec server option” on page 170
Example
The following command starts a database server using the TCP/IP protocol, but disallowing connections
from Open Client or jConnect applications.
dbsrv11 -x tcpip(TDS=NO) ...
Usage
TCP/IP, HTTP, HTTPS
Values
Integer, in seconds
Default
5 for TCP/IP.
30 for HTTP and HTTPS.
Remarks
Timeout also specifies the length of time to wait for a response when disconnecting. You may want to try
longer times if you are having trouble establishing TCP/IP communications.
On the database server, this is the amount of time to wait after sending the broadcast looking for servers with
the same name. It is only used on server startup, and does not affect client connections.
When using HTTP or HTTPS on the server, this parameter specifies the maximum idle time permitted when
receiving a request. If this limit is reached, the connection is closed and a 408 REQUEST TIMEOUT is
returned to the client. The value 0 disables idle timeout, but should be used with extreme caution. Without
this limit, a rogue client could consume the server's resources and prevent other clients from connecting.
See also
● “KeepaliveTimeout protocol option [KTO]” on page 294
Example
The following data source fragment starts a TCP/IP communication link only, with a timeout period of twenty
seconds.
...
CommLinks=tcpip(TO=20)
...
Usage
TCP/IP (client side only)
Values
YES, NO
Default
YES
Remarks
When connecting over TCP using the DoBroadcast=NONE parameter, the client makes a TCP connection,
then verifies that the name of the server found is the same as the one it's looking for. Specifying
VerifyServerName=NO skips the verification of the server name. This allows SQL Anywhere clients to
connect to a SQL Anywhere server if they know only an IP address/port.
The server name must still be specified in the connection string, but it is ignored. The VerifyServerName
(VERIFY) protocol option is used only if DoBroadcast=NONE is specified.
If the server is using -sb 0 or BroadcastListener=NO, the client does not need to specify DoBroadcast=NONE
to connect to it, although the client must still specify HOST=. The dblocate utility will not find the server.
Note
It is recommended that you only use this parameter in the rare circumstance where it is not possible to give
each server a unique server name, and use that unique name to connect. Giving each server a unique server
name, and connecting to the server using that name is still the best way to connect.
See also
● “DoBroadcast protocol option [DOBROAD]” on page 290
Contents
Introduction to SQL Anywhere environment variables .............................................. 312
DYLD_LIBRARY_PATH environment variable [Mac OS X] ...................................... 314
LD_LIBRARY_PATH environment variable [Linux and Solaris] ................................ 315
LIBPATH environment variable [AIX] ........................................................................ 316
ODBCHOME environment variable [Unix] ................................................................. 317
ODBCINI and ODBC_INI environment variables [Unix] ............................................ 318
PATH environment variable ....................................................................................... 319
SACHARSET environment variable .......................................................................... 320
SADIAGDIR environment variable ............................................................................ 321
SALANG environment variable .................................................................................. 323
SALOGDIR environment variable .............................................................................. 324
SATMP environment variable .................................................................................... 325
SHLIB_PATH environment variable [HP-UX] ............................................................ 327
SQLANY11 environment variable .............................................................................. 328
SQLANYSAMP11 environment variable ................................................................... 329
SQLCONNECT environment variable ....................................................................... 330
SQLPATH environment variable ............................................................................... 331
SQLREMOTE environment variable .......................................................................... 332
SYBASE environment variable .................................................................................. 333
TMP, TEMPDIR, and TEMP environment variables .................................................. 334
The SQL Anywhere installer creates or modifies the following environment variables in your computer's
properties: PATH and SQLANY11. After installing SQL Anywhere, you must restart your computer for
these environment variables to take effect.
Other environment variables can be set by modifying the properties for your computer, or within command
prompts or batch files by using the SET command.
The SQL Anywhere installer sets the following environment variables: DYLD_LIBRARY_PATH,
ODBCINI, PATH, and SQLANY11. After installing SQL Anywhere, you must log out and log in for the
environment variable settings to take effect. Rebooting is not required.
You must run the dbmodenv utility to configure the GUI environment (~/.MacOSX/environment.plist) for
each user who wants to use SQL Anywhere applications from the Finder. Each user must log out and log in
for the settings to take effect.
The dbmodenv utility is located in /Applications/SQLAnywhere11/System/bin32.
Terminal sessions do not inherit environment variables from the Finder. The following section describes
how to set environment variables for terminal sessions.
Once SQL Anywhere 11 is installed, each user must set some environment variables for the system to locate
and run SQL Anywhere applications. The SQL Anywhere installer creates two files, sa_config.sh and
sa_config.csh, for this purpose. These files are installed in install-dir/bin32 and install-dir/bin64. Each file
sets all needed user environment variables.
As the names imply, one file is designed to work under Bourne shell (sh) and its derivatives (such as ksh or
bash). The other file is designed to work under C-shell (csh) and its derivatives (such as tcsh).
Some statements are commented out in each of these batch files. The system administrator may want to edit
these files and remove comments, depending on the configuration of their system.
To run a SQL Anywhere application, you have several choices:
1. If you add the environment variables from the sa_config files to your system environment, you can run
applications by launching them from a GUI, such as X window server, or by typing the application name
in a terminal window.
2. In a terminal window, if you source one of the sa_config files, you can run the application by typing its
name.
3. install-dir/bin32s and install-dir/bin64s contain scripts with the same names as SQL Anywhere
applications. These scripts set the appropriate environment variables before launching the application.
You can run the application by running the corresponding script. You do not have to source an
sa_config file before you run these scripts.
To source a file means to execute commands contained in a text file in the current instance of the shell. This
is accomplished using a command built into the shell.
Under Bourne shell and its derivatives, the name of this command is . (a single period). For example, if
SQL Anywhere is installed in /opt/sqlanywhere11, the following statement sources sa_config.sh:
. /opt/sqlanywhere11/bin32/sa_config.sh
Under C-shell and its derivatives, the command is source. For example, if SQL Anywhere is installed
in /opt/sqlanywhere11, the following statement sources sa_config.csh:
source /opt/sqlanywhere11/bin32/sa_config.csh
Syntax
DYLD_LIBRARY_PATH=path-list
Default
/Applications/SQLAnywhere11/System/lib32
Remarks
The sa_config.sh and sa_config.csh files, created by the installer, are scripts that create or modify this and
other environment variables.
See also
● “LD_LIBRARY_PATH environment variable [Linux and Solaris]” on page 315
● “LIBPATH environment variable [AIX]” on page 316
● “SHLIB_PATH environment variable [HP-UX]” on page 327
● “Setting environment variables on Unix and Mac OS X” on page 312
Syntax
LD_LIBRARY_PATH=path-list
Default
● /opt/sqlanywhere11/lib32 (32-bit platforms)
● /opt/sqlanywhere11/lib64 (64-bit platforms)
Remarks
The sa_config.sh and sa_config.csh files, created by the installer, are scripts that create or modify this and
other environment variables.
See also
● “DYLD_LIBRARY_PATH environment variable [Mac OS X]” on page 314
● “LIBPATH environment variable [AIX]” on page 316
● “SHLIB_PATH environment variable [HP-UX]” on page 327
● “Setting environment variables on Unix and Mac OS X” on page 312
Syntax
LIBPATH=path-list
Default
● /usr/lpp/sqlanywhere11/lib32 (32-bit platforms)
● /usr/lpp/sqlanywhere11/lib64 (64-bit platforms)
Remarks
The sa_config.sh and sa_config.csh files, created by the installer, are scripts that create or modify this and
other environment variables.
See also
● “DYLD_LIBRARY_PATH environment variable [Mac OS X]” on page 314
● “LD_LIBRARY_PATH environment variable [Linux and Solaris]” on page 315
● “SHLIB_PATH environment variable [HP-UX]” on page 327
● “Setting environment variables on Unix and Mac OS X” on page 312
Syntax
ODBCHOME=odbc-ini-directory
Remarks
The .odbc.ini file is the system information file that contains ODBC data sources. If the file is named anything
other than .odbc.ini, you must use the ODBCINI or ODBC_INI environment variables to specify its location.
For information about the algorithm for locating ODBC data sources, see “Using ODBC data sources on
Unix” on page 97.
See also
● “ODBCINI and ODBC_INI environment variables [Unix]” on page 318
● “Setting environment variables on Unix and Mac OS X” on page 312
Syntax
ODBCINI=odbc-ini-file
ODBC_INI=odbc-ini-file
Remarks
The file name does not need to be .odbc.ini if it is specified using one of these environment variables. Both
environment variables are provided for compatibility with other products.
For information about the algorithm for locating ODBC data sources, see “Using ODBC data sources on
Unix” on page 97.
See also
● “ODBCHOME environment variable [Unix]” on page 317
● “Setting environment variables on Unix and Mac OS X” on page 312
Syntax
PATH=path-list
Default
Note
The following paths are only added if the corresponding component is installed.
Mac OS X /Applications/SQLAnywhere11/System/bin32
/Applications/SQLAnywhere11/System/sybcentral600
/Applications/SQLAnywhere11/System/openserver/OCS-15_0
/opt/sqlanywhere11/openserver/OCS-15_0/bin
Remarks
On Windows, the PATH environment variable is modified by the installer to include the directories where
SQL Anywhere executables are located.
On Unix, the sa_config.sh and sa_config.csh files, created by the installer, are scripts that create or alter this
and other environment variables.
See also
● “Setting environment variables on Windows” on page 312
● “Setting environment variables on Unix and Mac OS X” on page 312
Syntax
SACHARSET=charset
Remarks
The charset is a character set name.
For information about recommended character sets, see “Recommended character sets and
collations” on page 378.
If SACHARSET is not specified, the character set comes from the operating system.
See also
● “Setting environment variables on Windows” on page 312
● “Setting environment variables on Unix and Mac OS X” on page 312
Syntax
SADIAGDIR=diagnostic-information-directory
Default
Operating system Default location
Unix $HOME/.sqlanywhere11/diagnostics
Remarks
SQL Anywhere stores crash reports and feature statistics information in a diagnostic directory. The
SADIAGDIR environment variable is used to determine the location of the diagnostic directory where SQL
Anywhere writes crash reports.
If the directory specified by this environment variable does not exist, then the database server operates as
though the environment variable is not set.
On Windows (except Windows Mobile), diagnostics are written to the first writable directory in the following
list:
1. The directory specified by the SADIAGDIR environment variable.
2. The directory of the current executable.
3. The current directory.
4. The temporary directory. See “SATMP environment variable” on page 325 and “TMP, TEMPDIR, and
TEMP environment variables” on page 334.
On Windows Mobile, diagnostics are written to the first writable directory in the following list:
1. The directory of the current executable.
2. The current directory.
3. The temporary directory. See “Registry settings on Windows Mobile” on page 343.
On Unix, diagnostics are written to the first writable directory in the following list:
1. The directory specified by the SADIAGDIR environment variable.
2. The directory specified by $HOME/.sqlanywhere11/diagnostics.
3. The current directory.
4. The temporary directory. See “SATMP environment variable” on page 325 and “TMP, TEMPDIR, and
TEMP environment variables” on page 334.
Note
On Unix, writing crash reports to the user's home directory is not recommended when the database or
MobiLink server is running as a daemon, or the user is root/nobody. Because of this, the Unix install prompts
you for a suitable location and sets the SADIAGDIR environment variable in the sa_config.sh and
sa_config.csh files.
See also
● “Support utility (dbsupport)” on page 764
● “Error reporting in SQL Anywhere” on page 71
● “Setting environment variables on Windows” on page 312
● “Setting environment variables on Unix and Mac OS X” on page 312
Syntax
SALANG=language-code
Remarks
The language-code is a two-letter combination representing a language. For example, setting
SALANG=DE sets the default language to German.
For information about supported language codes, see “Understanding the locale language” on page 359.
The first of the following methods that returns a value determines the default language:
1. Check the SALANG environment variable.
2. (Windows) Check the registry as set during installation or by dblang.exe. See “Language Selection utility
(dblang)” on page 723.
3. Query the operating system for language information.
4. If no language information is set, English is the default.
See also
● “Language Selection utility (dblang)” on page 723
● “Registry settings on installation” on page 342
● “Setting environment variables on Windows” on page 312
● “Setting environment variables on Unix and Mac OS X” on page 312
Syntax
SALOGDIR=directory-name
Remarks
If the SALOGDIR environment variable is set, it is assumed to contain the path for a directory where the
backup history file, backup.syb can be written. This file is updated each time you execute a BACKUP or
RESTORE statement.
On Windows, the backup.syb file is created in the first writable location in the following list:
1. The SALOGDIR environment variable.
2. The installation directory.
On 32-bit Windows platforms, the default location is install-dir\bin32. If this directory does not exist, an
error is given.
3. The directory of the database server executable.
4. Write the backup.syb file in the root directory of the current drive.
On Unix, the backup.syb file is created in the first writable location in the following list:
1. The SALOGDIR environment variable.
2. The HOME environment variable.
3. Write the backup.syb file to the directory where the database server was started.
See also
● “BACKUP statement” [SQL Anywhere Server - SQL Reference]
● “Setting environment variables on Windows” on page 312
● “Setting environment variables on Unix and Mac OS X” on page 312
Syntax
SATMP=directory-name
Remarks
SQL Anywhere creates two types of temporary files: database server-related temporary files (created on all
platforms), and communications-related temporary files (created only on Unix for both the client and the
server).
The SATMP environment variable specifies the location of temporary files used by the database server and
the SQL Anywhere command line utilities that require a temporary directory. It is useful when running the
database server as a service because it enables you to hold the temporary file in a directory that cannot be
accessed by other programs.
If the location of the temporary file is not specified with the -dt option when the database server is started,
then the database server checks the value of the SATMP environment variable to determine where to place
the temporary file. If the SATMP environment variable does not exist, then the first of the TMP, TMPDIR,
or TEMP environment variables to exist is used. On Unix, if none of the above environment variables
exist, /tmp is used.
On Windows Mobile, you can specify the directory to use as the server's temporary directory in the registry.
For information about the temporary file location on Windows Mobile, see “Registry settings on Windows
Mobile” on page 343.
On Unix, both the client and the database server must set SATMP to the same value when connecting via
shared memory.
For information about securing shared memory connections on Unix, see “Security tips” on page 950.
If you want to restrict the permissions of the temporary files created by the database server or client on Unix,
you must set this environment variable to a directory that is not in the following list:
● /tmp
● /tmp/.SQLAnywhere
● the value of the TMP environment variable, if set
● the value of the TMPDIR environment variable, if set
● the value of the TEMP environment variable, if set
● a symbolic link pointing to any of the above directories
When SATMP is set to a directory that is not listed above, the database server searches up the given directory
path looking for directories owned by the current user with permissions set to 770, 707, or 700. If the
permissions are not set to one of these values, files are created with permissions set to 777. For each directory
that is found, the database server removes the appropriate permissions (other, group, and other+group,
respectively) from the permission mask used to create temporary files.
Caution
Setting SATMP to a directory that is not included in the list above may affect the ability of users using
different Unix accounts to connect to the database server over shared memory.
See also
● “-dt server option” on page 170
● “TMP, TEMPDIR, and TEMP environment variables” on page 334
● “Setting environment variables on Windows” on page 312
● “Setting environment variables on Unix and Mac OS X” on page 312
● “Place different files on different devices” [SQL Anywhere Server - SQL Usage]
Syntax
SHLIB_PATH=path-list
Default
● /opt/sqlanywhere11/lib32 (32-bit platforms)
● /opt/sqlanywhere11/lib64 (64-bit platforms)
Remarks
The sa_config.sh and sa_config.csh files, created by the installer, are scripts that create or modify this and
other environment variables.
See also
● “DYLD_LIBRARY_PATH environment variable [Mac OS X]” on page 314
● “LD_LIBRARY_PATH environment variable [Linux and Solaris]” on page 315
● “LIBPATH environment variable [AIX]” on page 316
● “Setting environment variables on Unix and Mac OS X” on page 312
Syntax
SQLANY11=directory-name
Default
Operating system Location
AIX /usr/lpp/sqlanywhere11
Mac OS X /Applications/SQLAnywhere11/System
Remarks
This environment variable should be set for several reasons. For example, samples require this environment
variable to locate SQL Anywhere applications.
On Windows, the installer sets the location of the SQLANY11 environment variable.
On Unix, the sa_config.sh and sa_config.csh files, created by the installer, are scripts that create or modify
this and other environment variables.
See also
● “Setting environment variables on Windows” on page 312
● “Setting environment variables on Unix and Mac OS X” on page 312
Syntax
SQLANYSAMP11=directory-name
Default
Operating system Default location
Mac OS X /Applications/SQLAnywhere11/Samples
AIX /usr/lpp/sqlanywhere11/samples
Remarks
On Windows, the installer sets the location of the SQLANYSAMP11 environment variable.
On Unix, the sa_config.sh and sa_config.csh files, created by the installer, are scripts that create or modify
this and other environment variables.
See also
● “Setting environment variables on Windows” on page 312
● “Setting environment variables on Unix and Mac OS X” on page 312
Syntax
SQLCONNECT=parameter=value; ...
Remarks
This string is a list of parameter settings, of the form parameter=value, delimited by semicolons.
Connection parameters specified by the SQLCONNECT environment variable are not used if they have
already been specified in the connection string.
For information about the supported connection parameters, see “Connection parameters” on page 248.
See also
● “Connection parameter tips” on page 102
● “Setting environment variables on Windows” on page 312
● “Setting environment variables on Unix and Mac OS X” on page 312
Syntax
SQLPATH=path-list
Remarks
Interactive SQL searches the directories specified in SQLPATH for command files and Help files before
searching the system path.
See also
● “Setting environment variables on Windows” on page 312
● “Setting environment variables on Unix and Mac OS X” on page 312
Syntax
SQLREMOTE=path
Remarks
Addresses for the FILE message link in SQL Remote are subdirectories of the SQLREMOTE environment
variable. This environment variable should specify a shared directory.
On Windows operating systems, except Windows Mobile, an alternative to setting the SQLREMOTE
environment variable is to set the SQL Remote\Directory registry entry to the proper root directory.
See also
● “Setting environment variables on Windows” on page 312
● “Setting environment variables on Unix and Mac OS X” on page 312
Syntax
SYBASE=directory-name
Remarks
You only need to set this environment variable if you are using other Sybase applications.
See also
● “Setting environment variables on Windows” on page 312
● “Setting environment variables on Unix and Mac OS X” on page 312
Syntax
TMP=path
TMPDIR=path
TEMP=path
Remarks
SQL Anywhere software may create temporary files for various operations. A temporary file is created when
the database server starts, and is erased when the database server stops. As its name suggests, the temporary
file is used while the database server is running to hold temporary information. The temporary file does not
hold information that needs to be kept between sessions.
Temporary files are held in the directory specified by one of the TMP, TMPDIR, or TEMP environment
variables. If more than one of these environment variables is specified, then the first of TMP, TMPDIR, and
TEMP is used.
SQL Anywhere Server checks the SATMP environment variable first. If it is not specified, then these
environment variables are checked. See “SATMP environment variable” on page 325.
If none of the environment variables is defined, temporary files are placed in the current working directory
of the server. On Unix only, if none of these environment variables are found, then /tmp is used.
On Windows Mobile, you can use the registry to specify the directory to use as the server's temporary
directory.
For more information about setting the temporary directory value, see “Registry settings on Windows
Mobile” on page 343.
See also
● “-dt server option” on page 170
● “SATMP environment variable” on page 325
● “Setting environment variables on Windows” on page 312
● “Setting environment variables on Unix and Mac OS X” on page 312
● “Place different files on different devices” [SQL Anywhere Server - SQL Usage]
Contents
Installation directory structure .................................................................................... 336
How SQL Anywhere locates files .............................................................................. 338
Registry and INI files ................................................................................................. 341
The SQL Anywhere installation directory itself holds several items, including the following:
● Read Me First A Read Me First file named readme.txt holds last minute information.
For platforms other than Windows Mobile, there are several directories under the installation directory:
● Executable directories There is a separate directory for each operating system platform, which holds
configuration files and context-sensitive help files.
On Windows, except Windows Mobile, these files are installed in the bin32 or bin64 directory. If you
are using Unix, they are installed in the bin32 or bin64 and lib32 or lib64 directories.
You only have the directories required for your operating system version.
● java directory JAR files are stored in this directory.
● scripts directory The scripts directory contains SQL scripts that are used by the database
administration utilities and as examples.
● \SDK\Include directory The \SDK\Include directory contains header files for developing C/C++
applications for SQL Anywhere. On Unix, this directory is called include.
On Windows Mobile devices, all files are installed in the installation directory \Program Files\SQLAny11,
except for DLLs, which are installed in the \Windows directory. No subdirectories are created.
Samples directory
When you install SQL Anywhere 11, you can choose the directory where the samples are installed. The
documentation refers to this location as samples-dir.
The SQLANYSAMP11 environment variable specifies the location of samples-dir. See “SQLANYSAMP11
environment variable” on page 329.
On Windows, you can access the samples from the Start menu by choosing Programs » SQL Anywhere
11 » Sample Applications And Projects.
The following table shows default and typical locations of samples-dir for each supported operating system:
1When accessing the SQL Anywhere samples directory in Windows Explorer, the location is Documents
and Settings > All Users > Shared Documents > SQL Anywhere 11 > Samples. However, if you are
accessing the SQL Anywhere samples directory from a command prompt, the path is C:\Documents and
Settings\All Users\Documents\SQL Anywhere 11\Samples.
Examples of SQL statements that use file names include the following:
● INSTALL JAVA statement The name of the file that holds Java classes.
● LOAD TABLE and UNLOAD TABLE statements The name of the file from which data should be
loaded or to which the data should be unloaded.
● CREATE DATABASE statement A file name is needed for this statement and similar statements
that can create files.
In some cases, SQL Anywhere uses a simple algorithm to locate files. In other cases, a more extensive search
is performed.
On Windows, SQL Anywhere programs, including the database server and administration utilities, can
perform a more extensive search for required files such as DLLs or shared libraries. In these cases, SQL
Anywhere programs look for files in the following order:
1. The module's directory (the directory where the program executable file or library file is located).
2. The executable directory (the directory where the program executable file or library is located).
3. The installation path (the SQL Anywhere installation directory, install-dir). install-dir is a single directory
specified by the SQLANY11 environment variable if it is defined.
4. No path (the path provided by the user).
5. The Location registry entry.
6. System-specific directories. This includes directories where common operating system files are held,
such as the Windows directory and the Windows\system32 directory on Windows operating systems.
7. The PATH directories. Directories in the system path and the user's path are searched.
Note
On Windows, SQL Anywhere searches the following paths relative to each location in the preceding list:
1. .
2. ..
3. .\bin32 and ..\bin32 (32-bit programs only)
4. .\bin64 and ..\bin64 (64-bit programs only)
5. .\java (for Java-related files)
6. ..\java (for Java-related files)
7. .\scripts (for SQL script files)
8. ..\scripts (for SQL script files)
On Windows Mobile, SQL Anywhere programs, including the database server and administration utilities,
can perform a more extensive search for required files such as DLLs or shared libraries. In these cases, SQL
Anywhere programs look for files in the following order:
1. The module's directory (the directory where the program executable file or library file is located).
2. The executable directory (the directory where the program executable file or library is located).
3. No path (the path provided by the user).
4. The Location registry entry.
5. System-specific directories. This includes directories where common operating system files are held,
such as Windows.
Note
On Windows Mobile, SQL Anywhere searches the following paths relative to each location in the preceding
list:
1. .
2. ..
3. .\bin32
4. ..\bin32
5. .\java (for Java-related files)
6. ..\java (for Java-related files)
7. .\scripts (for SQL script files)
8. ..\scripts (for SQL script files)
On Unix, SQL Anywhere programs, including the database server and administration utilities, can perform
a more extensive search for required files such as DLLs or shared libraries. In these cases, SQL Anywhere
programs look for files in the following order:
1. The executable path (if it can be determined).
2. The installation path (the SQL Anywhere installation directory, install-dir). install-dir is a single directory
specified by the SQLANY11 environment variable if it is defined.
3. No path (the path provided by the user).
4. The PATH environment variable.
5. The LIBPATH environment variable:
● LD_LIBRARY_PATH on Linux and Solaris
● LD_LIBRARY_PATH and SHLIB_PATH on HP-UX
● LIBPATH on AIX
● DYLD_LIBRARY_PATH on Mac OS X
Note
On Unix, SQL Anywhere searches the following paths relative to each location in the preceding list:
1. .
2. ..
3. ./bin32 and ../bin32 (32-bit programs only)
4. ./bin64 and ../bin64 (64-bit programs only)
5. ./lib32 and ../lib32 (library files for 32-bit programs only)
6. ./lib64 and ../lib64 (library files for 64-bit programs only)
7. ./java (for Java-related files)
8. ../java (for Java-related files)
9. ./scripts (for SQL script files)
10. ../scripts (for SQL script files)
11. ./res (for .res files)
12. ../res (for .res files)
13. ./tix (for .tix files)
14. ../tix (for .tix files)
Caution
You should not add simple encryption to the system information file (named .odbc.ini by default) with the
File Hiding utility (dbfhide) on Unix unless you are only using SQL Anywhere data sources. If you plan to
use other data sources (for example, for MobiLink synchronization), then obfuscating the contents of the
system information file may prevent other drivers from functioning properly.
Registry structure
On Windows (except Windows Mobile), you can access the registry directly with the registry editor. The
SQL Anywhere registry entries are held in either the HKEY_CURRENT_USER or
HKEY_LOCAL_MACHINE keys, in the following location:
Software
Sybase
SQL Anywhere
11.0
Sybase Central
6.0.0
The language is set based on the language selection specified during installation. See “Understanding
the locale language” on page 359.
● Sybase Central\6.0.0\Language This entry holds a two-letter code indicating the current language
for messages and errors. For example:
Language "EN"
This entry is used by Sybase Central. The language is set based on the language selection specified during
installation. See “Understanding the locale language” on page 359.
If the specified directory does not exist and cannot be created, the database server:
● uses the \Temp directory if it exists.
● attempts to create a \Temp directory if it does not already exist.
If the \Temp directory does not exist and cannot be created, the server uses the current directory.
Contents
Localized versions of SQL Anywhere ........................................................................ 346
Understanding character sets .................................................................................... 353
Understanding locales ............................................................................................... 359
Understanding collations ........................................................................................... 362
International language and character set tasks ......................................................... 369
Character set and collation reference information ..................................................... 374
Unix Yes
Mac OS X Yes
For English, German, Japanese, and Simplified Chinese, all SQL Anywhere components are localized,
including:
● Packaging
● Installer
● Documentation and context-sensitive help
● Software
○ Start menu items and program folders
○ Database servers and client libraries
○ MobiLink server and client
○ SQL Remote client
○ Administration tools, including Interactive SQL, Sybase Central, and all related plug-ins
○ Command-line tools, such as dbinit and dbunload
For French, the installer, software, and context-sensitive help are localized.
The following components are not localized and are only available in English:
● DataWindow .NET
● InfoMaker
● PowerDesigner Physical Data Model
Deployment localization applies to a subset of software components typically deployed to end users.
Packaging, documentation, administration, development, and installation software are not localized.
Localized software components include:
● Database servers and client libraries
● MobiLink server and client
● SQL Remote client
● Command-line tools, such as dbinit and dbunload
ISO-compatible format for the date, YYYY-MM-DD. SQL Anywhere provides the CONVERT function,
which provides output formatting of dates and times into a variety of popular formats. See:
○ “date_format option [compatibility]” on page 466
○ “time_format option [compatibility]” on page 524
○ “timestamp_format option [compatibility]” on page 526
○ “CONVERT function [Data type conversion]” [SQL Anywhere Server - SQL Reference]
See also
● “Creating a database with a named collation” on page 371
● “Recommended character sets and collations” on page 378
When is ICU needed on the database server? (all platforms except Windows Mobile)
Ideally, ICU should always be available for use by the database server. The following table specifies when
and why ICU is needed:
The database For password conversion from the database character set to UTF-8 (database passwords
character set is are stored in UTF-8, internally).
not UTF-8 but
is a multi-byte
character set.
The client and Proper conversion to and from a multi-byte character set requires ICU.
database char-
acter sets are
different, and
when either of
them is multi-
byte (includ-
ing UTF-8).
This includes
Unicode
ODBC, OLE
DB,
ADO.NET,
and iAny-
where JDBC
applications,
regardless of
the database
character set
where at least
one of these
clients do not
have ICU.
The database The database server requires ICU to convert UTF-8 to another character set.
character set is
not UTF-8 and
conversion
between
CHAR and
NCHAR val-
ues is re-
quired.
An embedded The database server requires ICU to convert UTF-8 to another character set. Note that
SQL client the default embedded SQL client NCHAR character set is the same as the initial client
uses an CHAR character set. This can be changed using the db_change_nchar_charset function.
NCHAR char- See “db_change_nchar_charset function” [SQL Anywhere Server - Programming].
acter set other
than UTF-8.
The CSCON- Character set conversion in the case of the third point above requires ICU. Sortkey
VERT or generation for many sortkey labels requires UCA, which, in turn, requires ICU. See
SORTKEY “CSCONVERT function [String]” [SQL Anywhere Server - SQL Reference] and
functions are “SORTKEY function [String]” [SQL Anywhere Server - SQL Reference].
used. The
CSCON-
VERT func-
tion is called
to convert be-
tween charac-
ter sets that
conform to the
requirements
of the third
point above.
The SORTKEY Sortkey generation for many sortkey labels requires UCA, which, in turn, requires
function is used. ICU. See “SORTKEY function [String]” [SQL Anywhere Server - SQL Reference].
The CHAR Even if the character sets match, using ICU is recommended because it improves
character set character set conversion if you are using NCHAR, or if the CHAR character set is
does not match multibyte.
the OS character
set.
Note
If you do not install the ICU library, you must choose either a collation whose character set matches the
Windows Mobile character set or the UTF8BIN collation as the CHAR collation when creating your
database. Also, you must choose the UTF8BIN collation as the NCHAR collation when creating your
database.
When can I get correct character set conversion on the database server without ICU?
You can get correct character set conversion without ICU when both the database character set and client
character set are single-byte and sqlany.cvf is available (all platforms), or if the operating system supports
the conversion (Windows only). This is because single-byte to single-byte conversions can be processed
without ICU, provided that the sqlany.cvf file is available, or the host operating system has the appropriate
converters installed.
When is ICU needed on the client? (all platforms except Windows Mobile)
For Unicode client applications, you are likely to get better combined client and database server performance
when all clients have ICU installed, regardless of the database character set. This is because some of the
required conversion activity may be offloaded from the database server to the client, and because fewer
conversions are required.
Also, if you are using ODBC on Windows platforms, you must have ICU installed on the client, even for
ANSI applications. This is because the driver manager converts ANSI ODBC calls to Unicode ODBC calls.
How do I decide which collation to use for my data- “Understanding collations” on page 362
base?
How are characters represented in software, and in “Understanding character sets” on page 353
SQL Anywhere in particular?
What collations does SQL Anywhere provide? “Choosing collations” on page 365
What character set encodings does SQL Anywhere “Supported character sets” on page 374
support?
I have a different character set on client computers “Character set conversion” on page 356
from that in use in the database. How can I get char-
acters to be exchanged properly between client and
server?
What character sets can I use for connection strings? “Connection strings and character
sets” on page 356
How do I change the collation sequence of an existing “Changing a database from one collation to an-
database? other” on page 372
● Client application The client application interface displays text, and internally the client application
may process text.
● Client software messages The client library uses the same language library as the database server
to provide messages to the client application.
● Operating systems The client and server operating systems may provide messages or process text.
For a satisfactory working environment, all these sources of text must work together. Loosely speaking, they
must all be working in the user's language and/or character set.
With few exceptions, characters 0 to 127 are the same for all of the code pages. The mapping for this range
of characters is called the ASCII character set. It includes the English language alphabet in upper and
lowercase, as well as common punctuation symbols and the digits. This range is often called the seven-bit
range (because only seven bits are needed to represent the numbers up to 127) or the lower page. The
characters from 128 to 255 are called extended characters, or upper code page characters, and vary from
one code page to another.
Problems with code page compatibility are rare if the only characters used are from the English alphabet, as
these are represented in the ASCII portion of each code page (0 to 127). However, if other characters are
used, as is generally the case in any non-English environment, there can be problems if the database and the
application use different code pages.
For example, suppose a database using the UTF-8 character set loads a table from a file containing cp1252
data, and the encoding is not specified as cp1252 on the LOAD TABLE statement. Because the encoding is
not specified, the data is assumed to be encoded in UTF-8, so no character conversion takes place; the cp1252
encoding is stored directly in the database. This means that characters such as the euro symbol, represented
in cp1252 as hex 80, are not converted into UTF-8. The euro symbol in UTF-8 is represented by the three-
byte sequence E2 82 AC, but, in this case, will be stored in the database as 80. Subsequently, when an
application requests data, the database server attempts to convert the data from UTF-8 to the client character
set. The conversion will produce corrupted characters.
Example
As an example, characters in code page 932 (Japanese) are either one or two bytes in length. If the value of
the first byte, also called the lead byte, is in the range of hexadecimal values from \x81 to \x9F or from \xE0
to \xFC (decimal values 129-159 or 224-252), the character is a two-byte character and the subsequent byte,
also called a follow byte, completes the character. A follow byte is any byte(s) other than the first byte.
If the first byte is outside the lead byte range, the character is a single-byte character and the next byte is the
first byte of the following character.
When using the LOAD TABLE statement, and functions like CSCONVERT, TO_CHAR, and TO_NCHAR,
you can refer to the database character set as db_charset, and to the database NCHAR character set as
nchar_charset.
For more information about the CHAR and NCHAR data types, see “Character data types” [SQL Anywhere
Server - SQL Reference].
If you select UTF8BIN as the char collation the database character set is UTF-8. If you specify UTF-8
encoding the char collation is UCA.
The Unicode Collation Algorithm (UCA) provides advanced comparison, ordering, and case conversion,
but it can affect performance. Although UTF8BIN is space-efficient and fast, the sort order and comparison
is binary. Specify the char collation as UTF8BIN if you require Unicode characters in your SQL statements,
but do not need the full power of UCA for sorting and comparison. Use UCA only when necessary, by using
the SORTKEY and COMPARE functions.
See also
● “SORTKEY function [String]” [SQL Anywhere Server - SQL Reference]
● “COMPARE function [String]” [SQL Anywhere Server - SQL Reference]
● “Unicode Collation Algorithm (UCA)” on page 363
● “SQL Anywhere Collation Algorithm (SACA)” on page 362
If your client application does not provide font settings that you can change, it is likely using your default
operating system font. In this case, consult your operating system documentation for information about how
to change the default system font, and change it to a Unicode font.
See also
● “Substitution characters” [SQL Anywhere Server - SQL Reference]
● “Using Interactive SQL” on page 612
The equivalence of upper and lowercase characters is defined in the collation. There are some collations
where particular care is required when assuming case insensitivity of identifiers. For example, Turkish
collations have a case-conversion behavior that can cause unexpected and subtle errors. The most common
error is that a system object containing a letter I or i is not found.
For more information about Turkish character sets and collations, see “Turkish character sets and
collations” on page 381.
Understanding locales
Both the database server and the client library recognize their language and character set environment using
a locale definition.
Introduction to locales
The application locale, or client locale, is used by the client or client library when making requests to the
database server, to determine the character set in which results should be returned, as well as the language
of error messages, warnings, and other messages. The database server compares its own locale with the
application locale to determine whether character set conversion is needed. Different databases on a server
may have different locale definitions, and each client may have its own locale.
The locale consists of the following components:
● Language The language is a two-character string using the ISO-639 standard values (for example,
DE for German). Both the database server and the client have language values for their locale.
The database server uses the locale language to determine the language libraries to load. When creating
a database, if no collation is specified, the database server also uses the language, together with the
character set, to determine which collation to use.
The client library uses the locale language to determine the language libraries to load, and the language
to request from the database. See “Understanding the locale language” on page 359.
● Character set The character set is the code page, or encoding, in use. The client and server both have
character set values, and they may differ. If they differ, character set conversion is used to enable
interoperability. See “Understanding the locale character set” on page 361.
The following table displays the valid language label values, together with the equivalent ISO 639 language
codes:
For more information about how to find locale settings, see “Determining locale
information” on page 369.
Understanding collations
A collation describes how to sort and compare characters from a particular character set or encoding. SQL
Anywhere supports two collation algorithms: the SQL Anywhere Collation Algorithm (SACA), and the
Unicode Collation Algorithm (UCA). SACA provides fast, compact, and reasonable sorting at the expense
of linguistic correctness. UCA provides linguistic correctness, but with a small expense in storage
requirements and execution time.
This section describes the supplied collations, and provides suggestions as to which collations to use under
certain circumstances.
For more information about how to create a database with a specific collation, see “Creating a database with
a named collation” on page 371 and “Initialization utility (dbinit)” on page 703.
For information about customization of the UCA collation using collation tailoring syntax, see “Collation
tailoring options” on page 366.
In a typical collation for a single-byte character set, all accented and unaccented forms of a character are
mapped to the same value, making the collation accent insensitive. Accented and unaccented forms of the
same letter compare as exactly equal and sort near each other.
The collation also provides conversion between uppercase and lowercase letters, preserving accents.
In multibyte character sets, the lead-bytes are mapped into the 256 distinct values. Follow bytes are compared
using their binary value.
For most collations for multibyte character sets, this mapping technique provides a reasonable ordering
because the character set encoding groups characters into 256-byte pages identified by the lead byte. The
pages, and the characters within each page, are in a reasonable order in the character set. The collations
typically preserve the ordering of the pages (lead bytes) within the character set. Some pages may be ordered
by other characteristics. For example, the 932JPN collation provided for Japanese code page 932 groups the
full-width (Kanji) and half-width (katakana) characters.
Case conversion is provided only for the 7-bit English characters.
UTF-8 is a multibyte character set. Each character contains from one to four bytes. SQL Anywhere provides
the UTF8BIN collation for sorting UTF-8 characters.
In UTF8BIN, lead bytes are mapped into 256 distinct values, and follow bytes are compared using their
binary values. Because of the representation of characters in UTF-8 and the limitation of 256 distinct mapping
values, it is not possible to group related characters such as accented and unaccented forms of the same letter.
The ordering is essentially binary.
Case conversion is supported only for the 7-bit English characters.
Note
The default UCA ordering sorts most characters in most languages into an appropriate order. However,
because of the sorting and comparison variations between languages sharing characters, the UCA cannot
provide proper sorting for all languages. For this purpose, ICU provides a syntax for tailoring the UCA. See
“Collation tailoring options” on page 366.
The UCA provides advanced comparison, ordering, and case conversion at a small cost in space and time.
The mapped form of a string is longer than the original string. The algorithm provides sophisticated handling
of more complex characters.
Unlike the SQL Anywhere Collation Algorithm, the Unicode Collation Algorithm is only for use with single-
byte and UTF-8 character sets, and it separates each character into one or more attributes. For letters, these
attributes are base character, accent, and case.
Non-letters typically have only one attribute, the base character.
UCA compares character strings as follows:
● Compare the base characters. If one string of base characters differs from the other, then the comparison
is complete. Accent and case are not considered.
● If the database is accent sensitive, compare the accents. If the accents differ, then the comparison is
complete. Case is not considered.
● If the database is case sensitive, compare the case of each character.
The original string values are equal if and only if the base characters, accents, and case are the same for both
strings.
Example
Suppose UCA is used to compare the strings in the first column of the table below. The subsequent columns
describe the three attributes for each string. Notice that the base characters are identical; the words differ
only in accents and case.
noel noel none, none, none, none lower, lower, lower, lower
noël noel none, none, accent, none lower, lower, lower, lower
Noel noel none, none, none, none upper, lower, lower, lower
Noël noel none, none, accent, none upper, lower, lower, lower
The following table shows the ordering that would occur in the four possible combinations of accent- and
case-sensitivity using UCA:
Noël
noël
NCHAR collation
NCHAR data types, including NCHAR, NVARCHAR, and LONG NVARCHAR, can use the Unicode
Collation Algorithm or can use the UTF8BIN collation, which uses the SQL Anywhere Collation Algorithm.
Choosing collations
When you create a database, SQL Anywhere can choose a default collation based on operating system
language and character set settings. In most cases, the default collation is a suitable choice, but you can also
explicitly choose a collation to match your needs from the wide selection of supplied collations. In some
cases, SQL Anywhere supports more than one collation for a particular language.
You should choose a collation that uses a character set and sort order that are appropriate for the data in your
database. You can also specify collation tailoring options for additional control over the sorting and
comparing of characters. For more information about creating databases, see “Creating a
database” on page 14.
For more information about data sorting and international features, see “SQL Anywhere international
features” on page 348.
See also
● “Creating a database with a named collation” on page 371
● “Recommended character sets and collations” on page 378
Note
Databases created with collation tailoring options cannot be started using a pre-10.0.1 database server.
Locale UCA (none) Any valid locale code. For example, en.
Case- All Case- ● respect Respect case differences between letters. For the UCA col-
Sensi- sup- Sensi- lation, this is equivalent to UpperFirst. For other collations, it depends
tivity ported tive, on the collation itself.
colla- Case ● ignore Ignore case differences between letters.
tions
● UpperFirst Always sort uppercase first (Aa).
● LowerFirst Always sort lowercase first (aA).
For more information about these sort types, see Unicode Technical Stand-
ard #35, at http://www.unicode.org/reports/tr35/.
Note
To tailor a UCA collation to conform to the Swedish Academy's 2005 standards in which V and W are
considered to be different characters at the primary level, specify UCA
(locale=swe;sorttype=phonebook). Without sorttype=phonebook, V and W are considered to
be the same character in the Swedish locale.
See also
● “CREATE DATABASE statement” [SQL Anywhere Server - SQL Reference]
● “Initialization utility (dbinit)” on page 703
● “COMPARE function [String]” [SQL Anywhere Server - SQL Reference]
● “SORTKEY function [String]” [SQL Anywhere Server - SQL Reference]
How SQL Anywhere chooses the default collation for a new database
When a new database is created, and the collation is not explicitly specified, SQL Anywhere uses the
language and character set to determine the collation.
● The language comes from the SALANG environment variable (if it exists), the registry, or the operating
system. See “SALANG environment variable” on page 323.
● The character set comes from the SACHARSET environment variable (if it exists) or the operating
system. See “SACHARSET environment variable” on page 320.
SELECT PROPERTY( 'Language' ); The locale language for the database server.
SELECT DB_PROPERTY( 'CharSet' ); Character set used to store CHAR data in the
database.
See also
● “PROPERTY function [System]” [SQL Anywhere Server - SQL Reference]
● “DB_PROPERTY function [System]” [SQL Anywhere Server - SQL Reference]
● “CONNECTION_PROPERTY function [System]” [SQL Anywhere Server - SQL Reference]
Setting locales
You can use the default locale on your operating system, or explicitly set a locale for use by the SQL
Anywhere components on your computer.
To set the SQL Anywhere locale
1. If the default locale is appropriate for your needs, you do not need to take any action.
For more information about how to find out the default locale of your operating system, see “Determining
locale information” on page 369.
2. If you need to change the locale, you can set either or both of the SALANG and SACHARSET
environment variables:
SACHARSET=charset
SALANG=language_code
The charset is a valid character set label, and language_code is a language code from the list of valid
languages. See “Language label values” on page 360.
For more information about setting environment variables on different operating systems, see “SQL
Anywhere environment variables” on page 311.
The first column of the list is the collation label, which you supply when creating the database.
2. Create a database using the dbinit utility, specifying a collation sequence using the -z option. The
following command creates a database with a Greek collation.
dbinit -z 1253ELL mydb.db
The following command creates a case sensitive database, spanish.db, which uses the 1262spa collation
for non-NCHAR data. For NCHAR data, the UCA collation is specified, with locale es, and sorting by
lowercase first.
dbinit -c -z 1252spa -zn uca(locale=es;case=LowerFirst) spanish.db
The following statement creates a database using code page 1252 and uses the UCA for both CHAR and
NCHAR data types. Accents and case are respected during comparison and sorting.
CREATE DATABASE 'c:\\uca.db'
COLLATION 'UCA'
ENCODING 'CP1252'
NCHAR COLLATION 'UCA'
ACCENT RESPECT
CASE RESPECT;
See also
● “Tutorial: Creating a SQL Anywhere database” [SQL Anywhere Server - SQL Usage]
● “Creating a database” on page 14
● “CREATE DATABASE statement” [SQL Anywhere Server - SQL Reference]
● “Initialization utility (dbinit)” on page 703
For early versions of SQL Anywhere, this property may not exist. The character set is also implied by
the collation name. For example, collation 1252LATIN1 uses code page 1252.
2. Determine the character set for the data in the existing database.
This should be the same as, or compatible with, the database character set. If it is not, it is an excellent
reason to rebuild the database, but requires great care in the rebuilding process.
In particular, if you have been using a database with collation 850LATIN1 with earlier versions of SQL
Anywhere that either did not support character set conversion (versions 5 and earlier) or disabled it by
default (versions 6 and 7), and if your client applications were normal Windows applications, you may
have code page 1252 character data in your database that is expecting data to be in code page 850. A
simple test for this case is to use UNLOAD TABLE with the ENCODING option to unload some
character data, then view it in Windows Notepad. If accented data is correct, then the character data in
the database matches the Windows ANSI code page, which for English and other Western European
languages is code page 1252. If the data appears correct in a DOS-based editor, then the character data
matches the Windows OEM code page, which is likely 437 or 850.
3. Unload the database.
If the data character set is incompatible with the database character set, it is critical that the data be
unloaded without character set conversion. Depending on the version of SQL Anywhere being used, you
can use the internal unload feature of dbunload, or manually unload the data using the UNLOAD TABLE
statement.
4. Create the new database, specifying the collations and character sets you want to use.
5. Load the data into the new database.
If the unloaded data and schema (reload.sql) match the character set of the computer used to do the
reload, you can use the external reload option of dbunload. The server's character set conversion will
automatically convert the data to the correct character set for the database.
If the data's encoding does not match the character set of the database, and you are loading data using
LOAD TABLE statements (internal reload), you must use the ENCODING clause; the database server
does not, by default, perform character set conversion for data loaded using LOAD TABLE statements.
If the data's encoding does not match the code page of the computer on which you are working, and you
are loading using INPUT statements (external reload), you must use the ENCODING clause; otherwise,
the database server assumes that the data is in the computer's native character set.
See also
● “LOAD TABLE statement” [SQL Anywhere Server - SQL Reference]
● “UNLOAD statement” [SQL Anywhere Server - SQL Reference]
● “INPUT statement [Interactive SQL]” [SQL Anywhere Server - SQL Reference]
● “Creating a database with a named collation” on page 371
● “Unload utility (dbunload)” on page 776
● “Rebuilding databases” [SQL Anywhere Server - SQL Usage]
● “CharSet connection parameter [CS]” on page 252
dbinit -le
Each line of output lists the most common labels for a given character set encoding, in comma separated
form. The first label in each line of output is the preferred SQL Anywhere name for the character set encoding.
The others are the labels used by different authorities, organizations, or standards. These are IANA (Internet
Assigned Numbers Authority), MIME (Multipurpose Internet Mail Extensions), ICU (International
Components for Unicode), Java, and ASE (Adaptive Server Enterprise).
If you do not find the character set you are looking for, you can also execute the following command to see
a longer list that includes labels that are less common:
dbinit -le+
When a character set encoding label is specified, SQL Anywhere searches for the label in the set of labels
known to it. Different authorities sometimes use the same label for different character sets. SQL Anywhere
does its best to resolve ambiguities by context. For example, a JDBC application that references a character
set by an ambiguous label resolves to a Java standard label. It is recommended that the SQL Anywhere label
always be used to avoid any ambiguities. An excellent resource for understanding character set encoding
labels is International Components for Unicode.
In addition to the character set encoding labels returned by the dbinit -le option, you can also use the following
character set aliases:
● os_charset Alias for the character set used by the operating system hosting the database server.
● char_charset Alias for the CHAR character set used by the database.
● nchar_charset Alias for the NCHAR character set used by the database.
An easy way to determine if a certain character set or label is supported is to test it using the CSCONVERT
function. See “CSCONVERT function [String]” [SQL Anywhere Server - SQL Reference].
dbinit -l
936ZHO Code Page 936, Simplified Chinese, PRC GBK 2312-80 8-bit encoding
950ZHO_HK Code Page 950, Traditional Chinese, Big 5 encoding with HKSCS
1254TRK Code Page 1254, Windows Latin 5, Turkish, ISO 8859-9 with extensions
1254TRKALT Code Page 1254, Windows Turkish, ISO8859-9 with extensions, I-dot
equals I-no-dot
Alternate collations
Alternate collations are available for compatibility with older versions of SQL Anywhere, or for special
purposes. To see the full list of supported alternate collations, run the following command:
dbinit -l+
The following table lists the supported Adaptive Server Enterprise collations for use with features such as
the SORTKEY function.
Note
For languages not found in the tables below, the UTF-8 encoding should be used with collations UCA or
UTF8BIN.
Windows platforms
Unix platforms
Even though these letters appear as variations of the same letter, in the Turkish alphabet they are considered
to be distinct letters. SQL Anywhere provides the Turkish collation 1254TRK to support these variations.
Turkish rules for case conversion of these characters are incompatible with ANSI SQL standard rules for
case conversion. For example, Turkish says that the lowercase equivalent of I is:
For this reason, correct case-insensitive matching is dependent on whether or not the text being matched is
Turkish or English/ANSI. In many contexts, there is not enough information to make such a distinction,
which leads to some non-standard behaviors in such databases.
For example, consider the following statements, executed against a database using the 1254TRK collation:
The first statement references a system object, and ANSI SQL conversion rules are required to match the
name. The second statement references a user object, and Turkish conversion rules are required to match
the name. However, the database server cannot tell which conversion rules to use until it knows what the
object is, and it cannot know what the object is, until it knows what conversion rules to use. The situation
cannot be resolved properly for both system and user objects. In this example, since the database server is
using the Turkish collation 1254TRK, the first statement fails because lowercase I is not considered
equivalent to uppercase I, and the second statement succeeds.
The incompatibility of Turkish and ANSI standards requires that system object references in Turkish
databases specify the object name in the correct case, that is, the case used to create the object. The first
statement above should be written as follows:
Note that keywords, such as INSERT, are case-insensitive even in Turkish databases. SQL Anywhere knows
that all keywords use only English letters, so it uses ANSI case conversion rules when matching keywords.
SQL Anywhere also applies this knowledge for certain other identifiers, such as built-in functions. However,
objects whose names are stored in the catalog must be specified using the correct case or letter, as described
above.
This is not correct for a Turkish user, but may be acceptable in some cases.
The second issue appears when using ORDER BY. Consider the following strings:
because I-no-dot is less than I-dot. In a 1254TRKALT database, the order would be
Contents
Managing login policies overview .............................................................................. 386
Database permissions and authorities overview ....................................................... 392
Managing user permissions and authorities .............................................................. 400
Managing connected users ....................................................................................... 412
Managing groups ....................................................................................................... 413
Database object names and prefixes ........................................................................ 420
Using views and procedures for extra security .......................................................... 422
Changing ownership on nested objects ..................................................................... 425
How user permissions are assessed ......................................................................... 427
Managing the resources connections use ................................................................. 428
Users and permissions in the catalog ........................................................................ 429
You can create, alter, and drop login policies. As well, you can create, alter, and drop users, and assign login
policies to them. The sa_get_user_status system procedure lets you get information about the current status
of a user. See “sa_get_user_status system procedure” [SQL Anywhere Server - SQL Reference].
A default login policy called root is stored in the database and contains the default option values for all
policies. If you want to use different settings than the defaults, you can either alter the root policy, or create
a policy and then alter it to contain overrides for the defaults. A policy inherits its default settings from the
root policy, unless it is altered to contain overrides.
For example, suppose the root policy value for max_connections is 5. You create a policy called myPolicy
and alter it to set max_connections to Unlimited. Then, you create a user and assign the myPolicy login
policy. When the user logs in, their login policy option settings are inherited from the root login policy with
the exception of max_connections, which is set to Unlimited.
Inheritance of default values from the root policy is important to understand because if you subsequently
change the value of an option setting in the root policy, you impact users of policies that rely on the default
value for that setting. Similarly, if a root value is changed, it does not impact any users of policies that contain
an override for that setting.
Example
This example creates overrides in the root login policy for the locked and max_connections values.
See also
● “ALTER LOGIN POLICY statement” [SQL Anywhere Server - SQL Reference]
Example
This example creates the Test1 login policy with option values.
See also
● “CREATE LOGIN POLICY statement” [SQL Anywhere Server - SQL Reference]
● “Assigning a login policy to an existing user” on page 388
● “Altering a login policy” on page 389
Example
This example creates a user called SQLTester with the password "welcome" and assigns the Test1 login
policy.
See also
● “CREATE USER statement” [SQL Anywhere Server - SQL Reference]
● “Creating new users” on page 400
5. Click OK.
Example
This example assigns the Test2 login policy to SQLTester.
ALTER USER SQLTester
LOGIN POLICY Test2;
See also
● “ALTER USER statement” [SQL Anywhere Server - SQL Reference]
● “Creating new users” on page 400
Example
This example creates overrides in the Test1 login policy for the locked and max_connections values.
See also
● “ALTER LOGIN POLICY statement” [SQL Anywhere Server - SQL Reference]
● “Assigning a login policy to an existing user” on page 388
Note
You cannot drop a login policy if it is still assigned to a user.
Example
This example drops the Test1 login policy.
DROP LOGIN POLICY Test1;
See also
● “DROP LOGIN POLICY statement” [SQL Anywhere Server - SQL Reference]
● If the database is read only due to its role as a mirror database in a high availability system, then the
effect of any statement executed on the primary database is reflected in the mirror database. Also, the
dynamic information collected on the primary server is sent to the mirror database and is merged in
transient memory with the information collected for the mirror database.
Inheriting authorities
The following table lists the authorities you can assign to users, and whether they are inherited through group
membership:
Inheritance of permissions
The following table lists the permissions you can assign to users, and whether they are inherited through
group membership:
INSERT Yes Allows the user to insert da- See “GRANT state-
ta into a database object ment” [SQL Anywhere
Server - SQL Reference].
REFER- Yes Allows the user to create in- See “GRANT state-
ENCES dexes on a table, and create ment” [SQL Anywhere
foreign keys that reference Server - SQL Reference].
the table
Negative permissions
SQL Anywhere does not support negative permissions. This means that you cannot revoke a permission that
was not explicitly granted.
For example, suppose user bob is a member of a group called sales. If a user grants DELETE permission on
a table, T, to sales, then bob can delete rows from T. If you want to prevent bob from deleting from T, you
cannot simply execute a REVOKE DELETE on T from bob, since the DELETE ON T permission was never
granted directly to bob. In this case, you would have to revoke bob's membership in the sales group.
See:
● “GRANT statement” [SQL Anywhere Server - SQL Reference]
● “REVOKE statement” [SQL Anywhere Server - SQL Reference]
Authorities overview
In SQL Anywhere, authorities can be thought of as database-level permissions. As such, they are not
necessarily associated with any object within the database (other than the user). For example, a user with
BACKUP authority is allowed to back up the database. Authorities can also include database object
permissions. For example, a user with PROFILE authority can perform application profiling and database
tracing tasks, which involves using system tables and system procedures that are not available to other users
(other than users with DBA authority).
BACKUP authority
The BACKUP authority allows a user to back up databases and transaction logs with archive or image
backups using the BACKUP statement or dbbackup utility. BACKUP authority is not inherited through
group membership, and can be granted only by a user with DBA authority. See “BACKUP statement” [SQL
Anywhere Server - SQL Reference] and “Backup utility (dbbackup)” on page 672.
DBA authority
When you create a database, a single usable user ID is also created. By default, the first user ID is DBA, and
the password is initially sql (passwords are case sensitive). You can change the name and password of the
DBA user using the DBA USER and DBA PASSWORD clauses of the CREATE DATABASE statement
or by specifying the dbinit -dba option. See “CREATE DATABASE statement” [SQL Anywhere Server -
SQL Reference], and “Initialization utility (dbinit)” on page 703.
The DBA user ID automatically has DBA authority within the database. This level of permission enables
DBA users to perform any activity in the database. They can create tables, change table structures, create
new user IDs, revoke permissions from users, back up the database, and so on.
DBA authority is not inherited by group membership.
Caution
To prevent unauthorized access to your data, you should change the password for the DBA user (or change
the DBA user and password) before deploying the database.
PROFILE authority
The PROFILE authority allows a user to perform the following profiling, tracing, and diagnostic operations:
● application profiling
● diagnostic tracing
● procedure profiling
See also
● “Application profiling” [SQL Anywhere Server - SQL Usage]
● “Advanced application profiling using diagnostic tracing” [SQL Anywhere Server - SQL Usage]
● “Index Consultant” [SQL Anywhere Server - SQL Usage]
● “Procedure profiling using system procedures” [SQL Anywhere Server - SQL Usage]
● “Request logging” [SQL Anywhere Server - SQL Usage]
● “DBA authority” on page 395
● “sa_server_option system procedure” [SQL Anywhere Server - SQL Reference]
READCLIENTFILE authority
The READCLIENTFILE authority allows a user to read files on the client computer, for example when
loading data from a file on a client computer.
The READCLIENTFILE authority can be inherited through group membership.
See also
● “Accessing data on client computers” [SQL Anywhere Server - SQL Usage]
● “WRITECLIENTFILE authority” on page 397
● “GRANT statement” [SQL Anywhere Server - SQL Reference]
● “LOAD TABLE statement” [SQL Anywhere Server - SQL Reference]
● “READ_CLIENT_FILE function [String]” [SQL Anywhere Server - SQL Reference]
READFILE authority
The READFILE authority allows a user to use the OPENSTRING clause in a SELECT statement to read a
file. Without READFILE authority, the user can still use the OPENSTRING clause to query a string or
BLOB value, but not a file.
The READFILE authority can be inherited through group membership.
For more information about using the OPENSTRING clause in a SELECT statement, see “FROM
clause” [SQL Anywhere Server - SQL Reference].
RESOURCE authority
The RESOURCE authority allows a user to create database objects, such as tables, views, stored procedures,
and triggers. The RESOURCE authority is not inherited through group membership, and can be granted only
by a user with DBA authority.
To create a trigger, a user needs both RESOURCE authority and ALTER permissions on the table to which
the trigger applies.
DBA authority is required to create database objects with different owners.
VALIDATE authority
The VALIDATE authority allows a user to perform database, table, index, and checksum validation using
the VALIDATE statement or dbvalid utility. The VALIDATE authority is not inherited through group
membership, and can be granted only by a user with DBA authority.
See also
● “VALIDATE statement” [SQL Anywhere Server - SQL Reference]
● “Validation utility (dbvalid)” on page 793
WRITECLIENTFILE authority
The WRITECLIENTFILE authority allows a user to write to files on a client computer, for example when
using the UNLOAD TABLE statement to write data to a client computer.
The WRITECLIENTFILE authority can be inherited through group membership.
See also
● “Accessing data on client computers” [SQL Anywhere Server - SQL Usage]
● “READCLIENTFILE authority” on page 396
● “GRANT statement” [SQL Anywhere Server - SQL Reference]
● “READ_CLIENT_FILE function [String]” [SQL Anywhere Server - SQL Reference]
● “WRITE_CLIENT_FILE function [String]” [SQL Anywhere Server - SQL Reference]
Permissions overview
In SQL Anywhere, permissions allow users to access, create, modify, and delete database objects (tables,
views, procedures, and so on). For example, to select data from a table, the user must either own the table,
or have SELECT permissions on it.
A user's permissions can be grouped into the following main categories:
● Permissions explicitly set for the user or group These are the permissions that are explicitly set
for a user or group to control whether they can create, modify, execute, or delete database objects.
● Permissions acquired through ownership of an object These are the permissions acquired by
virtue of creating a data base object. For example, if a user creates a table, their ownership allows them
to modify or delete the object.
● Permissions inherited through group membership These are the permissions inherited from a
group to which a user or group belongs.
● Permissions on disabled objects You can grant permissions on disabled objects. Permissions to
disabled objects are stored in the database and become effective when the object is enabled.
Permission Description
REFERENCES Permission to create indexes on a table and to create foreign keys that
reference a table.
UPDATE Permission to update rows in a table or view. This can also granted on a
set of columns in a table or view.
For more information about the permissions you can set on database objects, see “GRANT statement” [SQL
Anywhere Server - SQL Reference].
See also
● “Groups without passwords” on page 417
Even if there are no security concerns regarding a multi-user database, there are good reasons for setting up
an individual user ID for each user. In addition to granting permissions to individual users, you can also
grant permissions to groups of users. The administrative overhead is very low if a group with the appropriate
permissions is set up.
You may want to use individual user IDs since:
● The Log Translation utility (dblog) can selectively extract the changes made by individual users from a
transaction log. This is very useful when troubleshooting or piecing together what happened if data is
incorrect.
● Sybase Central displays much more useful information so you can tell which connections belong to
which users.
● Row locking messages (with the blocking option set to Off) are more informative.
Example
This example adds a new user to the database with the user ID of M_Haneef and a password of Welcome.
CREATE USER M_Haneef
IDENTIFIED BY Welcome;
See also
● “CREATE USER statement” [SQL Anywhere Server - SQL Reference]
Setting a password
A user must have a password to be able to connect to the database. Passwords are case sensitive and they
cannot:
When passwords are created or changed, they are converted to UTF-8 before being hashed and stored in the
database. If the database is unloaded and reloaded into a database with a different character set, existing
passwords continue to work. If the server cannot convert from the client's character set to UTF-8, then it is
recommended that the password be composed of 7-bit ASCII characters as other characters may not work
correctly.
Changing a password
To change a user password (Sybase Central)
1. Connect to the database as a user with DBA authority.
2. Click Users & Groups.
3. In the Users & Groups list, right-click a user and then choose Properties.
4. Select This User Has A Password.
5. Complete the Password and Confirm Password fields.
6. Click Apply.
7. Click OK.
Example
ALTER USER M_Haneef
IDENTIFIED BY welcome;
6. Click Apply.
7. Click OK.
Example
The following command changes the password for the DBA user to welcome_DBA:
ALTER USER DBA
IDENTIFIED BY welcome_DBA;
See also
● “ALTER USER statement” [SQL Anywhere Server - SQL Reference]
See also
● “Setting properties for database objects” [SQL Anywhere Server - SQL Usage]
● “Database options” on page 437
Granting authorities
You grant authorities in much the same way as you grant permissions.
For example, to grant DBA authority, the appropriate SQL statement is:
GRANT DBA TO user-id;
For more information about the supported authorities in SQL Anywhere, see “Authorities
overview” on page 394.
5. Click Apply.
Tips
You can also assign permissions from the User Properties or Group Properties window. To assign
permissions to multiple users or groups, use the Table Properties window. To assign permissions to multiple
tables, use the User Properties window.
Example 1
All table permissions are granted in a very similar fashion. You can grant permission to M_Haneef to delete
rows from the table named sample_table as follows:
1. Connect to the database as a user with DBA authority, or as the owner of sample_table.
2. Execute the following SQL statement:
GRANT DELETE
ON sample_table
TO M_Haneef;
Example 2
You can grant permission to M_Haneef to update the column_1 and column_2 columns only in the table
named sample_table as follows:
1. Connect to the database as a user with DBA authority, or as the owner of sample_table.
2. Execute the following SQL statement:
GRANT UPDATE ( column_1, column_2 )
ON sample_table
TO M_Haneef;
Table permissions are limited in that they generally apply to all the data in a table, although the
REFERENCES, SELECT, and UPDATE permissions can be granted to a subset of columns. You can fine-
tune user permissions by creating procedures that perform actions on tables, and then granting users the
permission to execute the procedure.
See also
● “GRANT statement” [SQL Anywhere Server - SQL Reference]
For more information about the SQL statements involved, see “Granting permissions on
tables” on page 404.
A user may perform an operation through a view if one or more of the following are true:
● The appropriate permission(s) on the view for the operation has been granted to the user by a user with
DBA authority.
● The user has the appropriate permission(s) on all the base table(s) for the operation.
● The user was granted appropriate permission(s) for the operation on the view by a non-DBA user. This
user must be either the owner of the view or have WITH GRANT OPTION of the appropriate
permission(s) on the view. The owner of the view must be either:
○ a user with DBA authority.
○ a user that does not have DBA authority, but also the owner of all the base table(s) referred to by the
view.
○ a user that does not have DBA authority, and not the owner of some or all of the base table(s) referred
to by the view. However, the view owner has SELECT permission WITH GRANT OPTION on the
base table(s) not owned and any other required permission(s) WITH GRANT OPTION on the base
table(s) not owned for the operation.
Instead of the owner having permission(s) WITH GRANT OPTION on the base table(s),
permission(s) may have been granted to PUBLIC. This includes SELECT permission on system
tables.
UPDATE permissions can be granted on an entire view or on individual columns within a view.
Note
You can grant permissions on disabled views. Permissions to disabled views are stored in the database and
become effective when the object is enabled.
Tip
You can also assign permissions from the User Properties or Group Properties window. Use the View
Properties window to assign permissions to multiple users or groups. Use the User Properties or Group
Properties window to assign permissions to multiple views.
See also
● “GRANT statement” [SQL Anywhere Server - SQL Reference]
Note
You can only specify WITH GRANT OPTION for users. Members of groups do not inherit the WITH
GRANT OPTION if it is granted to a group.
Example
You can grant permission to M_Haneef to delete rows from the table named sample_table, and the right to
pass on this permission to other users, as follows:
1. Connect to the database as a user with DBA authority, or as the owner of sample_table
2. Execute the SQL statement:
GRANT DELETE ON sample_table
TO M_Haneef
WITH GRANT OPTION;
See also
● “Granting permissions on tables” on page 404
● “Permissions and authorities of groups” on page 416
The method for granting permissions to execute a procedure is similar to that for granting permissions on
tables and views. However, the WITH GRANT OPTION clause of the GRANT statement does not apply
to the granting of permissions on procedures.
You can use either Sybase Central or Interactive SQL to set permissions.
To grant permissions on procedures (Sybase Central)
1. Connect to the database as a user with DBA authority.
2. Click Procedures & Functions.
3. Right-click a procedure and then choose Properties.
4. Click the Permissions tab.
5. Configure the permissions for the procedure:
● Click Grant.
● Double-click a user or group.
● To allow or revoke permission to execute a procedure, select a user or group and click the Execute
column. A checkmark indicates the user or group can execute the procedure.
● To revoke all permissions, select a user or group and click Revoke.
6. Click Apply.
Tip
You can also assign permissions from the User Properties or Group Properties window. Use the
Procedure Properties window to assign permissions to multiple users or groups. Use the User
Properties or Group Properties window to assign permissions to multiple procedures.
Example
You can grant M_Haneef permission to execute a procedure named my_procedure, as follows:
1. Connect to the database as a user with DBA authority or as owner of my_procedure procedure.
2. Execute the SQL statement:
GRANT EXECUTE
ON my_procedure
TO M_Haneef;
You can use procedures to allow users to perform well-defined activities on a table, without having any
general permissions on the table.
See also
● “GRANT statement” [SQL Anywhere Server - SQL Reference]
● “Granting permissions on tables” on page 404
After granting a user remote permissions, you can subscribe the user to publications.
To revoke remote permissions from remote users
1. Connect to the database as a user with DBA authority.
2. Click Users & Groups or SQL Remote Users.
3. Right-click a user and then choose Revoke Remote.
4. Click Yes.
To revoke their permission to delete rows from sample_table, the command is:
REVOKE DELETE
ON sample_table
FROM M_Haneef;
When you add a user to a group, the user inherits all the permissions and inheritable authorities assigned to
that group. SQL Anywhere does not allow you to revoke a subset of the permissions and authorities that a
user inherits as a member of a group. You can only revoke permissions that are explicitly given by a GRANT
statement. If you need to remove inherited permissions or authorities from a user, consider creating a new
group with the required permissions and authorities, and making the user a member, or remove the user from
the group and explicitly grant the permissions they require.
See also
● “REVOKE statement” [SQL Anywhere Server - SQL Reference]
● “GRANT statement” [SQL Anywhere Server - SQL Reference]
Example
Remove the user M_Haneef from the database.
DROP USER M_Haneef;
See also
● “DROP USER statement” [SQL Anywhere Server - SQL Reference]
● “REVOKE statement” [SQL Anywhere Server - SQL Reference]
● “Revoking user permissions and authorities” on page 410
● “Deleting groups from the database” on page 418
Managing groups
Once you understand how to manage permissions for individual users (as described in Managing user
permissions and authorities), working with groups is straightforward. A group is identified by a user ID, just
as a single user is. However, a group user ID has the permission to have members.
You can construct a hierarchy of groups, where each group inherits permissions from its parent group. That
means that a group can also be a member of a group. As well, each user ID may belong to more than one
group, so the user-to-group relationship is many-to-many.
When you grant permissions to a group or revoke permissions from a group for tables, views, and procedures,
all members of the group inherit those changes. Some authorities are
The ability to create a group without a password enables you to prevent anybody from connecting to the
database using the group user ID. See “Groups without passwords” on page 417.
For more information about granting remote permissions for groups, see “Granting and revoking remote
permissions” on page 409.
Note
You can only specify WITH GRANT OPTION for users. Members of groups do not inherit the WITH
GRANT OPTION if it is granted to a group.
A group is simply a user ID with special permissions. You grant permissions to a group and revoke
permissions from a group in exactly the same manner as any other user. See “Managing user permissions
and authorities” on page 400.
Creating groups
You can create a new group in both Sybase Central and Interactive SQL. You need DBA authority to create
a new group.
To create a new group (Sybase Central)
1. Connect to the database as a user with DBA authority.
2. Right-click Users & Groups and then choose New » Group.
Example
Create the user ID personnel.
See also
● “GRANT statement” [SQL Anywhere Server - SQL Reference]
● “CREATE USER statement” [SQL Anywhere Server - SQL Reference]
● “Creating new users” on page 400
Example
Grant the user M_Haneef membership in the personnel group:
GRANT MEMBERSHIP
IN GROUP personnel
TO M_Haneef;
See also
● “Database permissions and authorities overview” on page 392
● “GRANT statement” [SQL Anywhere Server - SQL Reference]
● “Creating new users” on page 400
Tip
You can also remove a user by double-clicking the group, clicking the Members tab in the right pane, right-
clicking the user or group and choosing Remove Members.
Example
Remove the user M_Haneef from the personnel group:
REVOKE MEMBERSHIP
IN GROUP personnel
FROM M_Haneef;
See also
● “REVOKE statement” [SQL Anywhere Server - SQL Reference]
● “Creating new users” on page 400
● “Deleting users from the database” on page 410
● “Deleting groups from the database” on page 418
Notes
Members of a group do not inherit the DBA, RESOURCE, and GROUP permissions. Even if the user ID
has RESOURCE authority, the members of personnel do not have RESOURCE authority.
Note
You can only specify WITH GRANT OPTION for users. Members of groups do not inherit the WITH
GRANT OPTION if it is granted to a group.
The SYSGROUPS view contains a list of group-name, member-name pairs representing the group
memberships in your database.
If a table named employees is owned by the user ID personnel, and if M_Haneef is a member of the personnel
group, then M_Haneef can refer to the employees table simply as employees in SQL statements. Users who
are not members of the personnel group need to use the qualified name personnel.employees.
This user ID can be granted group permissions, and other user IDs can be granted membership in the group,
inheriting any permissions that have been given to personnel. However, nobody can connect to the database
using the personnel user ID because it has no valid password.
The user ID personnel can be an owner of database objects, even though no user can connect to the database
using this user ID. The CREATE TABLE statement, CREATE PROCEDURE statement, and CREATE
VIEW statement all allow the owner of the object to be specified as a user other than that executing the
statement. Only a user with DBA authority can perform this assignment of ownership.
Special groups
When you create a database, the SYS, PUBLIC, and dbo groups are also automatically created. None of
these groups has passwords, so it is not possible to connect to the database as SYS, PUBLIC, or dbo. However,
these groups serve important functions in the database.
Example
Remove the group personnel from the database.
See also
● “REVOKE statement” [SQL Anywhere Server - SQL Reference]
● “Revoking user permissions and authorities” on page 410
● “Deleting users from the database” on page 410
Tables, procedures, and views all have an owner. The DBA user ID owns the tables in the sample database.
In some circumstances, you must prefix the object name with the owner user ID, as in the following statement.
SELECT *
FROM DBA.Employees;
The Employees table reference is said to be qualified. In other circumstances it is sufficient to give the object
name. This section describes when you need to use the owner prefix to identify tables, views and procedures,
and when you do not.
When referring to a database object, you require a prefix unless:
● You are the owner of the database object.
● The database object is owned by a group ID of which you are a member.
Example
Consider the following example of a corporate database. The user ID company created all the tables, and
since this user ID belongs to the database administrator, it therefore has DBA authority.
CREATE USER Company
IDENTIFIED BY secret;
GRANT DBA TO Company;
Not everybody in the company should have access to all information. Consider two user IDs in the sales
department, Joe and Sally, who should have access to the Customers, Products, and Orders tables. To do
this, you create a Sales group.
CREATE USER Sally IDENTIFIED BY xxxxx;
CREATE USER Joe IDENTIFIED BY xxxxx;
CREATE USER Sales IDENTIFIED BY xxxxx;
GRANT GROUP TO Sales;
GRANT ALL ON Customers TO Sales;
GRANT ALL ON Orders TO Sales;
Now Joe and Sally have permission to use these tables, but they still have to qualify their table references
because the table owner is Company, and Sally and Joe are not members of the Company group:
SELECT *
FROM company.Customers;
To rectify the situation, make the Sales group a member of the Company group.
GRANT GROUP TO Company;
GRANT MEMBERSHIP IN GROUP Company TO Sales;
Now Joe and Sally, being members of the Sales group, are indirectly members of the Company group, and
can reference their tables without qualifiers. The following command now works:
SELECT *
FROM Customers;
Note
Joe and Sally do not have any extra permissions because of their membership in the company group. The
company group has not been explicitly granted any table permissions. (The company user ID has implicit
permission to look at tables like Salaries because it created the tables and has DBA authority.) Thus, Joe and
Sally still get an error executing either of these commands:
SELECT *
FROM Salaries;
SELECT *
FROM company.Salaries;
In either case, Joe and Sally do not have permission to look at the Salaries table.
In these cases, you can use views and stored procedures to tailor permissions to suit the needs of your
organization. This section describes some of the uses of views and procedures for permission management.
See also
● “Working with views” [SQL Anywhere Server - SQL Usage]
● “Granting permissions on views” on page 405
Example 1
The Sales manager needs access to information in the database concerning employees in the department.
However, there is no reason for the manager to have access to information about employees in other
departments.
This example describes how to create a user ID for the sales manager, create views that provide the
information she needs, and grant the appropriate permissions to the sales manager user ID.
1. Create the new user ID using the GRANT statement. While logged in as a user with DBA authority,
execute the following statements:
CONNECT DBA
IDENTIFIED by sql;
The table reference could be qualified with the owner to avoid an ambiguous reference to an identically
named table.
3. Give SalesManager permission to look at the view:
GRANT SELECT
ON EmployeeSales
TO SalesManager;
You use exactly the same command to grant permission on views and on tables.
Example 2
The next example creates a view which allows the Sales Manager to look at a summary of sales orders. This
view requires information from more than one table for its definition:
1. Create the view.
CREATE VIEW OrderSummary AS
SELECT OrderDate, Region, SalesRepresentative, CompanyName
FROM SalesOrders
KEY JOIN Customers;
2. Grant permission for the Sales Manager to examine this view.
GRANT SELECT
ON OrderSummary
TO SalesManager;
3. To check that the process has worked properly, connect to the SalesManager user ID and look at the
views you created:
CONNECT SalesManager
IDENTIFIED BY sales;
SELECT *
FROM DBA.EmployeeSales;
SELECT *
FROM DBA.OrderSummary;
No permissions have been granted to the Sales Manager to look at the underlying tables. The following
commands produce permission errors.
SELECT * FROM GROUPO.Employees;
SELECT * FROM GROUPO.SalesOrders;
Strict security
For strict security, you can disallow all access to the underlying tables, and grant permissions to users or
groups of users to execute certain stored procedures. This approach strictly defines the manner in which data
in the database can be modified.
This approach minimizes problems associated with the order in which permissions are set.
Setting options
You can set database options using the SET OPTION statement, with the following syntax:
Database option settings are not inherited through the group structure.
See also
● “Database options” on page 437
● “SET OPTION statement” [SQL Anywhere Server - SQL Reference]
DUMMY PUBLIC Dummy table that can be used to find the current user
ID. See “DUMMY system table” [SQL Anywhere
Server - SQL Reference].
SYSGROUP PUBLIC One row for each member of each group. See
“SYSGROUP system view” [SQL Anywhere Server
- SQL Reference].
SYSPROCPERM PUBLIC Each row holds one user granted permission to use
one procedure. See “SYSPROCPERM system
view” [SQL Anywhere Server - SQL Reference].
SYSUSER DBA only Information on all users in the database. See “SY-
SUSER system view” [SQL Anywhere Server - SQL
Reference].
SYSUSERAUTHORITY PUBLIC Authority granted for each user ID. See “SYSUSER-
AUTHORITY system view” [SQL Anywhere Server
- SQL Reference].
Database options
Contents
Introduction to database options ............................................................................... 432
Specify a user ID or group name to set the option for that user or group only. Every user belongs to the
PUBLIC group. If no user ID or group is specified, the option change is applied to the currently logged on
user ID that issued the SET OPTION statement.
Any option, whether user-defined or not, must have a public setting before a user-specific value can be
assigned. The database server does not support setting TEMPORARY values for user-defined options.
For example, the following statement applies an option change to the user DBA, if DBA is the user that
issues it:
SET OPTION blocking_timeout = 3;
The following statement applies a change to the PUBLIC user ID, a user group to which all users belong.
You must have DBA authority to execute this statement.
SET OPTION PUBLIC.login_mode = 'Standard';
If option-value is omitted, the specified option setting is deleted from the database. If it was a personal option
setting, the value reverts back to the PUBLIC setting. If a TEMPORARY option is deleted, the option setting
reverts back to the permanent setting.
See “SET OPTION statement” [SQL Anywhere Server - SQL Reference].
To set options for a database (Sybase Central)
1. Open the database server.
2. Right-click the database and choose Options.
3. Edit the values.
Tips
With the Database Options window, you can also set database options for specific users and groups (when
you open this window for a user or group, it is called the User Options window or Group Options window,
respectively).
When you set options for the database itself, you are actually setting options for the PUBLIC group in that
database because all users and groups inherit option settings from PUBLIC.
Caution
Changing option settings while fetching rows from a cursor is not supported because it can lead to unreliable
results. For example, changing the date_format setting while fetching from a cursor would lead to different
date formats among the rows in the result set. Do not change option settings while fetching rows.
Note
In databases that use a Turkish collation or are case sensitive, executing a query on SYSOPTION or a query
like the following may not match any rows if the option name is used with the wrong case:
SELECT * FROM sa_conn_properties( ) WHERE propname = 'BLOCKING';
For information about the proper case for option names, see “Alphabetical list of options” on page 447.
DBA authority is required to set an option for the PUBLIC user ID.
Changing the value of an option for the PUBLIC user ID sets the permanent value of the option for all users
who have not SET their own value. An option value cannot be set for an individual user ID unless there is
already a PUBLIC user ID setting for that option.
Some options which can only be set for the PUBLIC user take effect immediately for existing connections,
even though the changed setting will not be visible to users via the CONNECTION_PROPERTY function.
An example of this is the global_database_id option. For this reason, PUBLIC-only options should not be
changed while other users are connected to the database.
Adding the TEMPORARY keyword to the SET OPTION statement changes the duration of the change.
Ordinarily an option change is permanent. It does not change until it is explicitly changed using the SET
OPTION statement.
When the SET TEMPORARY OPTION statement is executed, the new option value takes effect only for
the current connection, and only for the duration of the connection.
When the SET TEMPORARY OPTION is used to set a PUBLIC option, the change is in place for as long
as the database is running. When the database is shut down, temporary options for the PUBLIC user ID
revert back to their permanent value.
Setting a temporary option for the PUBLIC user ID offers a security advantage. For example, when the
login_mode option is enabled, the database relies on the login security of the system on which it is running.
Enabling it as a temporary option setting means that a database relying on the security of a Windows domain
will not be compromised if the database is shut down and copied to a local computer. In this case, the
login_mode option will revert to its permanent value, which could be Standard, a mode where integrated
logins are not permitted.
To order this list alphabetically, you can execute the following statement:
SELECT *
FROM sa_conn_properties( )
ORDER BY PropName;
If you want to filter the result or order by anything other than name, you could also use a WHERE clause.
For example:
SELECT *
FROM sa_conn_properties( )
WHERE PropDescription LIKE '%cache%'
ORDER BY PropNum;
You can use the sa_server_option system procedure to instruct the database server to send a message or
return an error when an attempt is made to set a database option.
You use the OptionWatchList property to create a list the options that you want to monitor, and the
OptionWatchAction property to specify the action the database server should take when an attempt is made
to set an option that is being monitored.
For example, the following command instructs the database server to monitor the database options
automatic_timestamp, float_as_double, and tsql_hex_constant:
CALL dbo.sa_server_option(
'OptionWatchList','automatic_timestamp,float_as_double,tsql_hex_constant' );
The following command instructs the database server to return an error if an attempt is made to set an option
specified in the OptionWatchList property:
CALL dbo.sa_server_option( 'OptionWatchAction','ERROR' );
See also
● “sa_server_option system procedure” [SQL Anywhere Server - SQL Reference]
● OptionWatchAction and OptionWatchList properties: “Server-level properties” on page 561
See also
● “login_procedure option [database]” on page 483
● “sp_login_environment system procedure” [SQL Anywhere Server - SQL Reference]
● “sp_tsql_environment system procedure” [SQL Anywhere Server - SQL Reference]
Option classification
SQL Anywhere provides many options. It is convenient to divide them into a few general classes. The classes
of options are:
Database options
This section lists all database options.
“default_dbspace option [database]” on page 469 String Empty string (use the system
dbspace)
“oem_string option [database]” on page 496 String (up to 128 Empty string
bytes)
Compatibility options
The following options allow you to make SQL Anywhere behavior compatible with Adaptive Server
Enterprise, or to support both old behavior and allow ISO SQL/2003 behavior.
For further compatibility with Adaptive Server Enterprise, some of these options can be set for the duration
of the current connection using the Transact-SQL SET statement instead of the SQL Anywhere SET OPTION
statement. See “SET statement [T-SQL]” [SQL Anywhere Server - SQL Reference].
Default settings
The default setting for some of these options differs from the Adaptive Server Enterprise default setting. To
ensure compatibility across your SQL Anywhere and Adaptive Server Enterprise databases, you should
explicitly set each of the compatibility options listed in this section.
When a connection is made using the Open Client or JDBC interfaces, some option settings are explicitly
set for the current connection to be compatible with Adaptive Server Enterprise. These options are listed in
the following table.
Options for Open Client and JDBC connection compatibility with Adaptive Server Enterprise
Option Setting
allow_nulls_by_default Off
ansi_blanks Off
ansinull On
chained Off
continue_after_raiserror On
date_format YYYY-MM-DD
date_order MDY
escape_character Off
isolation_level 1
quoted_identifier Off
time_format HH:NN:SS.SSS
tsql_outer_joins Off
tsql_variables On
Synchronization options
The following database options can be set to configure SQL Anywhere databases used as MobiLink
synchronization clients.
“delete_old_logs option [MobiLink client] [SQL On, Off, Delay, n days Off
Remote] [Replication Agent]” on page 472
Allowed values
On, Off
Default
On
Off for Open Client and jConnect connections
Remarks
The allow_nulls_by_default option is included for Transact-SQL compatibility. See “Setting options for
Transact-SQL compatibility” [SQL Anywhere Server - SQL Usage].
Allowed values
On, Off
Default
Off
Scope
DBA authority required.
Remarks
This option must be enabled to read from files on a client computer, for example using the
READ_CLIENT_FILE function.
See also
● “Accessing data on client computers” [SQL Anywhere Server - SQL Usage]
● “READ_CLIENT_FILE function [String]” [SQL Anywhere Server - SQL Reference]
● “READCLIENTFILE authority” on page 396
● “LOAD TABLE statement” [SQL Anywhere Server - SQL Reference]
● “isql_allow_read_client_file option [Interactive SQL]” on page 648
● “allow_write_client_file option [database]” on page 449
● “isql_allow_write_client_file option [Interactive SQL]” on page 649
● “Security of client side data” [SQL Anywhere Server - SQL Usage]
Allowed values
On, Off
Default
Off
Scope
Can be set for the PUBLIC group only. DBA authority required.
Remarks
This option controls whether snapshot isolation is enabled for the database. Once this option is set to On,
the database server starts recording the original versions of updated rows in the temporary file in the event
that a transaction uses snapshot isolation.
If there are transactions in progress when the setting of the allow_snapshot_isolation option is changed, then
the change does not take effect immediately. Any transactions that are running when the option setting is
changed from Off to On must complete before snapshots can be used. When the setting of the option is
changed from On to Off, any outstanding snapshots are allowed to complete before the database server stops
collecting version information, and new snapshots are not initiated.
You can view the current snapshot isolation setting for a database by querying the value of the
SnapshotIsolationState database property:
See also
● “isolation_level option [compatibility]” on page 478
● “updatable_statement_isolation option [database]” on page 529
● “Snapshot isolation” [SQL Anywhere Server - SQL Usage]
● “Isolation levels and consistency” [SQL Anywhere Server - SQL Usage]
● “Enabling snapshot isolation” [SQL Anywhere Server - SQL Usage]
Example
The following statement enables snapshot isolation for a database:
Allowed values
On, Off
Default
Off
Scope
DBA authority required.
Remarks
This option must be enabled to write files to a client computer, for example using the WRITE_CLIENT_FILE
function.
See also
● “Accessing data on client computers” [SQL Anywhere Server - SQL Usage]
● “WRITE_CLIENT_FILE function [String]” [SQL Anywhere Server - SQL Reference]
● “WRITECLIENTFILE authority” on page 397
● “UNLOAD statement” [SQL Anywhere Server - SQL Reference]
● “isql_allow_write_client_file option [Interactive SQL]” on page 649
● “allow_read_client_file option [database]” on page 448
● “isql_allow_read_client_file option [Interactive SQL]” on page 648
● “Security of client side data” [SQL Anywhere Server - SQL Usage]
Allowed values
On, Off
Default
Off
Remarks
The ansi_blanks option has no effect unless the database ignores trailing blanks in string comparisons and
pads strings that are fetched into character arrays. It forces a truncation error whenever a value of data type
CHAR(N) is read into a C char[M] variable for values of N greater than or equal to M. With ansi_blanks set
to Off, a truncation error occurs only when at least one non-blank character is truncated.
For embedded SQL with the ansi_blanks option set to On, when you supply a value of data type DT_STRING,
you must set the sqllen field to the length of the buffer containing the value (at least the length of the value
plus space for the terminating null character). With ansi_blanks set to Off, the length is determined solely
by the position of the NULL character. The value of the ansi_blanks option is determined when the
connection is established. Changing the option once the connection has been made does not affect this sqllen
embedded SQL behavior.
When a database is blank padded, this option controls truncation warnings sent to the client if the expression
being fetched is CHAR or NCHAR (not VARCHAR or NVARCHAR) and it is being fetched into a char or
nchar (not VARCHAR or NVARCHAR) host variable. If these conditions hold and the host variable is too
small to hold the fetched expression once it is blank padded to the expression's maximum length, a truncation
warning is raised and the indicator contains the minimum number of bytes required to hold the fetched
expression if it is blank padded to its maximum length. If the expression is CHAR(N) or NCHAR(N), the
indicator may be set to a value other than N to take in account character set translation of the value returned
and character length semantics.
Allowed values
On, Off
Default
Off
Remarks
The draft SQL/3 standard requires all cursors be closed when a transaction is rolled back. By default, on a
rollback SQL Anywhere closes only those cursors that were opened without a WITH HOLD clause. This
option allows you to force closure of all cursors.
The close_on_endtrans option overrides the ansi_close_cursors_on_rollback option.
See also
● “close_on_endtrans option [compatibility]” on page 459
Allowed values
On, Off
Default
On
Scope
Can be set for the PUBLIC group only. Takes effect immediately. DBA authority required.
Remarks
With ansi_permissions set to On, the SQL/2003 permissions requirements for DELETE and UPDATE
statements are checked. The default value is Off in Adaptive Server Enterprise. The following table outlines
the differences.
SQL statement Permissions required with ansi_per- Permissions required with an-
missions off si_permissions on
The ansi_permissions option can be set only for the PUBLIC group. No private settings are allowed.
Allowed values
Off, Cursors, Strict
Default
Cursors
Remarks
SQL Anywhere provides several extensions that allow updates that are not permitted by the ANSI SQL
standard. These extensions provide powerful, efficient mechanisms for performing updates. However, in
some cases, they cause behavior that is not intuitive. This behavior can produce anomalies such as lost
updates if the user application is not designed to expect the behavior of these extensions.
The ansi_update_constraints option controls whether updates are restricted to those permitted by the SQL/
2003 standard.
If the option is set to Strict, the following updates are prevented:
● Updates of cursors containing JOINS
● Updates of columns that appear in an ORDER BY clause
● The FROM clause is not allowed in UPDATE statements
If the option is set to Cursors, these same restrictions are in place, but only for cursors. If a cursor is not
opened with FOR UPDATE or FOR READ ONLY, the database server chooses updatability based on the
SQL/2003 standard. If the ansi_update_constraints option is set to Cursors or Strict, cursors containing an
ORDER BY clause default to FOR READ ONLY; otherwise, they continue to default to FOR UPDATE.
See also
● “UPDATE statement” [SQL Anywhere Server - SQL Reference]
Allowed values
On, Off
Default
On
Remarks
This option is implemented primarily for Transact-SQL (Adaptive Server Enterprise) compatibility. The
ansinull option affects the results of comparison predicates with NULL constants, and also affects warnings
issued for grouped queries over NULL values.
With ansinull set to On, ANSI three-valued logic is used for all comparison predicates in a WHERE or
HAVING clause, or in an On condition. Any comparisons with NULL using = or != evaluate to unknown.
Setting ansinull to Off means that SQL Anywhere uses two-valued logic for the following four conditions:
expr = NULL
expr != NULL
expr != @var
In each case, the predicate evaluates to either true or false—never unknown. In such comparisons, the NULL
value is treated as a special value in each domain, and an equality (=) comparison of two NULL values yields
true. Note that the expression expr must be a relatively simple expression, referencing only columns,
variables, and literals; subqueries and functions are not permitted.
With ansinull set to On, the evaluation of any aggregate function, except COUNT(*), on an expression that
contains at least one NULL value, may generate the warning null value eliminated in
aggregate function (SQLSTATE=01003). With ansinull set to Off, this warning does not appear.
Limitations
● Setting ansinull to Off affects only WHERE, HAVING, or ON predicates in SELECT, UPDATE,
DELETE, and INSERT statements. The semantics of comparisons in a CASE or IF statement, or in IF
expressions, are unaffected.
● Adaptive Server Enterprise 12.5 introduced a change in the behavior of LIKE predicates with a NULL
pattern string when ansinull is set to Off. In SQL Anywhere, LIKE predicates remain unaffected by the
setting of ansinull.
Allowed values
On, Off
Default
Off
Scope
Can be set for the PUBLIC group only. Takes effect immediately. DBA authority required.
Remarks
This option turns auditing on and off.
Auditing is the recording of detailed information about many events in the database in the transaction log.
Auditing provides some security features, at the cost of some performance. When you turn on auditing for
a database, you cannot stop using the transaction log. You must turn auditing off before you turn off the
transaction log. Databases with auditing on cannot be started in read-only mode.
For the auditing option to work, you must set the auditing option to On, and also specify which types of
information you want to audit using the sa_enable_auditing_type system procedure. Auditing will not take
place if either of the following are true:
● The auditing option is set to Off
● Auditing options have been disabled
If you set the auditing option to On, and do not specify auditing options, all types of auditing information
are recorded. Alternatively, you can choose to record any combination of the following: permission checks,
connection attempts, DDL statements, public options, and triggers using the sa_enable_auditing_type system
procedure.
See also
● “Auditing database activity” on page 958
● “sa_enable_auditing_type system procedure” [SQL Anywhere Server - SQL Reference]
● “sa_disable_auditing_type system procedure” [SQL Anywhere Server - SQL Reference]
Example
Turn on auditing
SET OPTION PUBLIC.auditing = 'On';
Allowed values
On, Off
Default
Off
Scope
Can be set for an individual connection or for the PUBLIC group. Takes effect immediately.
If you set this option temporarily, that setting applies to the current connection only. Different connections
under the same user ID can have different settings for this option.
Intra-query parallelism is not used for connections with background_priority set to on. See “Parallelism
during query execution” [SQL Anywhere Server - SQL Usage].
Remarks
Setting this option to On causes requests to execute at the Background priority level. When this option is set
to Off, requests execute at the value specified by the Priority option.
See also
● “priority option [database]” on page 507
● “max_priority option [database]” on page 488
Allowed values
Integer, in bytes
Default
256
Remarks
Any value longer than the blob_threshold option is replicated as a BLOB. That is, it is broken into pieces
and replicated in chunks before being reconstituted using a SQL variable and concatenating the pieces at the
recipient site.
Each SQL statement must fit within a message, so you should not set the value of this option to a size larger
than your message size (50 KB by default).
See also
● “SQL Remote options” [SQL Remote]
Allowed values
On, Off
Default
On
Scope
Can be set for an individual connection or for the PUBLIC group. Takes effect immediately.
Remarks
If the blocking option is set to On, any transaction attempting to obtain a lock that conflicts with an existing
lock held by another transaction waits until every conflicting lock is released or until the blocking_timeout
is reached. If the lock is not released within blocking_timeout milliseconds, then an error is returned for the
waiting transaction. If the blocking option is set to Off, the transaction that attempts to obtain a conflicting
lock receives an error.
See also
● “blocking_timeout option [database]” on page 456
Allowed values
Integer, in milliseconds
Default
0
Scope
Can be set for an individual connection or for the PUBLIC group. Takes effect immediately.
Remarks
When the blocking option is set to On, any transaction attempting to obtain a lock that conflicts with an
existing lock waits for blocking_timeout milliseconds for the conflicting lock to be released. If the lock is
not released within blocking_timeout milliseconds, then an error is returned for the waiting transaction.
Setting this option to 0 forces all transactions attempting to obtain a lock to wait until all conflicting
transactions release their locks.
See also
● “blocking option [database]” on page 456
Allowed values
On, Off
Default
On
Off for Open Client and jConnect connections
Remarks
Controls the Transact-SQL transaction mode. In Unchained mode (chained=Off), each statement is
committed individually unless an explicit BEGIN TRANSACTION statement is executed to start a
transaction. In chained mode (chained=On) a transaction is implicitly started before any data retrieval or
modification statement.
Allowed values
Integer
Default
60
Scope
Can be set for the PUBLIC group only. DBA authority required. You must shut down and restart the database
server for the change to take effect.
Remarks
This option is used with the recovery_time option to decide when checkpoints should be done.
See also
● “Checkpoints and the checkpoint log” on page 869
● “recovery_time option [database]” on page 509
● “How the database server decides when to checkpoint” on page 872
Allowed values
0, 7
Default
0
Scope
Can be set for an individual connection or for the PUBLIC group.
Remarks
This option controls whether information about how queries are executed on a remote database appears in
the database server messages window when using remote data access. Set this option to 7 to see debugging
information in the database server messages window. When this option is set to 0 (the default), debugging
information for remote data access does not appear in the database server messages window.
Once you have turned on remote tracing, the tracing information appears in the database server messages
window. You can log this output to a file by specifying the -o server option when you start the database
server. See “-o server option” on page 197.
Allowed values
Integer
Default
50
Scope
Can be set for an individual connection or for the PUBLIC group. Takes effect when a new connection is
made to a remote server.
Remarks
This option sets the ODBC FetchArraySize value when using ODBC to connect to a remote database server.
Allowed values
On, Off
Default
On
Off for jConnect connections
Remarks
When close_on_endtrans is set to On, cursors are closed whenever a transaction is committed unless the
cursor was opened WITH HOLD. The behavior when a transaction is rolled back is governed by the
ansi_close_cursors_on_rollback option.
When close_on_endtrans is set to Off, cursors are not closed at either a commit or a rollback, regardless of
the ansi_close_cursors_on_rollback option setting or whether the cursor was opened WITH HOLD or not.
Setting this to Off provides Adaptive Server Enterprise compatible behavior.
See also
● “ansi_close_cursors_on_rollback option [compatibility]” on page 451
Allowed values
On, Off
Default
On
Remarks
The database server updates statistics during normal statement execution and uses the gathered statistics to
self-tune the column statistics. Set the collect_statistics_on_dml_updates option to Off to disable the
updating of statistics during the execution of data-altering DML statements such as INSERT, DELETE, and
UPDATE.
Under normal circumstances, it should not be necessary to turn this option off. However, in environments
where significantly large amounts of data are frequently changing, setting this option to Off may improve
performance—assuming update_statistics is also set to On.
The difference between the collect_statistics_on_dml_updates option and the update_statistics option is that
the update_statistics option compares the actual number of rows that satisfy a predicate with the number of
rows that are estimated to satisfy the predicate, and then updates the estimates accordingly. The
collect_statistics_on_dml_updates option modifies the column statistics based on the values of the specific
rows that are inserted, updated, or deleted.
See also
● “update_statistics option [database]” on page 530
● “Updating column statistics” [SQL Anywhere Server - SQL Usage]
Allowed values
Integer, from -1 to 9
Default
6
Remarks
The values have the following meanings:
● -1 Send messages in version 5 format. The Message Agent from version 5 cannot read messages sent
by the Message Agent from version 6 and later. You should ensure that the compression option is set to
-1 until all Message Agents in your system are upgraded to version 6 or later.
● 0 No compression.
● 1 to 9 Increasing degrees of compression. Creating messages with high compression can take longer
than creating messages with low compression.
See also
● “SQL Remote options” [SQL Remote]
Controls whether auditing is enabled or disabled for each connection when the auditing option is set to On.
Allowed values
On, Off
Default
On
Scope
Can be set as a temporary option only, for the duration of the current connection. DBA authority required.
Remarks
The setting of the conn_auditing option is only respected when it is set in a login procedure (specified by
the login_procedure database option). Setting conn_auditing to On turns on auditing for the connection.
However, auditing information is not recorded unless the auditing option is also set to On. You can execute
the following statement to determine whether a connection is being audited:
SELECT CONNECTION_PROPERTY ( 'conn_auditing' );
See also
● “Controlling auditing” on page 958
● “auditing option [database]” on page 454
● “login_procedure option [database]” on page 483
Allowed values
String
Default
Empty string
Scope
Can be set for an individual connection only.
Remarks
This option only takes effect when you are using the OEM Edition of the SQL Anywhere database server.
Authenticated applications must set the connection_authentication database option for every connection
immediately after the connection is established. If the signature is verified, the connection is authenticated
and has no restrictions on its activities beyond those imposed by the SQL permissions. If the signature is not
verified, the connection is limited to those actions permitted by unauthenticated applications.
The connection_authentication option must be set for the duration of the current connection only by using
the TEMPORARY keyword. The following SQL statement authenticates the connection:
The company-name and application-name must match those in the database authentication statement. The
application-signature is the application signature that you obtained from Sybase.
If your company name has quotation marks, apostrophes, or other special characters, you must double them
in the string for it to be accepted.
For more information about configuring and using the OEM Edition of SQL Anywhere, see “Running
authenticated SQL Anywhere applications” on page 65.
See also
● “database_authentication [database]” on page 464
Example
The following example specifies an authentication string that contains special characters:
Allowed values
On, Off
Default
On
Remarks
The RAISERROR statement is used within procedures and triggers to generate an error. When this option
is set to Off, the execution of the procedure or trigger is stopped whenever the RAISERROR statement is
encountered.
If you set the continue_after_raiserror option to On, the RAISERROR statement no longer signals an
execution-ending error. Instead, the RAISERROR status code and message are stored and the most recent
RAISERROR is returned when the procedure completes. If the procedure that caused the RAISERROR was
called from another procedure, the RAISERROR is not returned until the outermost calling procedure ends.
Intermediate RAISERROR statuses and codes are lost after the procedure ends. If, at return time, an error
occurs along with the RAISERROR, then the information for the new error is returned and the RAISERROR
information is lost. The application can query intermediate RAISERROR statuses by examining the
@@error global variable at different execution points.
The setting of the continue_after_raiserror option is used to control behavior following a RAISERROR
statement only if the on_tsql_error option is set to Conditional (the default). If you set the on_tsql_error
option to Stop or Continue, the on_tsql_error setting takes precedence over the continue_after_raiserror
setting.
See also
● “on_tsql_error option [compatibility]” on page 498
Allowed values
On, Off
Default
On
Remarks
This option controls whether data type conversion failures, when data is fetched from the database or inserted
into the database, are reported by the database as errors (conversion_error set to On) or as a warning
(conversion_error set to Off).
When conversion_error is set to On, the SQLE_CONVERSION_ERROR error is generated. If the option
is set to Off, the warning SQLE_CANNOT_CONVERT is produced.
If conversion errors are reported as warnings only, the NULL value is used in place of the value that could
not be converted. In embedded SQL, an indicator variable is set to -2 for the column or columns that cause
the error.
Allowed values
Integer, in milliseconds
Default
250
Scope
Can be set for an individual connection or for the PUBLIC group. Takes effect immediately.
Remarks
This option has meaning only when cooperative_commits is set to On. The database server waits for the
specified number of milliseconds for other connections to fill a page of the log before writing to disk. The
default setting is 250 milliseconds.
See also
● “cooperative_commits option [database]” on page 464
Allowed values
On, Off
Default
On
Scope
Can be set for an individual connection or for the PUBLIC group. Takes effect immediately.
Remarks
If cooperative_commits is set to Off, a COMMIT is written to disk as soon as the database server receives
it, and the application is then allowed to continue.
If cooperative_commits is set to On (the default) and if there are other active connections, the database server
does not immediately write the COMMIT to the disk. Instead, the application waits for up to the maximum
length set by the cooperative_commit_timeout option for something else to put on the pages before they are
written to disk.
Setting cooperative_commits to On, and increasing the cooperative_commit_timeout setting, increases
overall database server throughput by cutting down the number of disk I/Os, but at the expense of a longer
turnaround time for each individual connection.
If both cooperative_commits and delayed_commits are set to On, and the cooperative_commit_timeout
interval passes without the pages getting written, the application is resumed (as if the commit had worked),
and the remaining interval (delayed_commit_timeout - cooperative_commit_timeout) is used as a
delayed_commits interval. The pages are then written, even if they are not full.
See also
● “delayed_commits option [database]” on page 471
database_authentication [database]
Sets the authentication string for a database.
Allowed values
String
Default
Empty string
Scope
Can be set for the PUBLIC group only. You must restart the database for this option to take effect.
Remarks
This option only takes effect when you are using the OEM Edition of the SQL Anywhere database server.
When a database is authenticated, only connections that specify the correct authentication signature can
perform operations on the database. Connections that are not authenticated operate in read-only mode. You
must use the OEM Edition of SQL Anywhere if you want to use authenticated databases.
To authenticate a database, set the database_authentication option for the database:
SET OPTION PUBLIC.database_authentication =
'company = company-name;
application = application-name;
signature = database-signature';
The company-name and application-name arguments are the values you supplied to Sybase when obtaining
your signature, and database-signature is the database signature that you received from Sybase.
If your company name has quotation marks, apostrophes, or other special characters, you must double them
in the string for it to be accepted.
When the database server loads an authenticated database, it displays a message in the database server
messages window describing the authenticated company and application. You can check that this message
is present to verify that the database_authentication option has taken effect. The message has the following
form:
This database is licensed for use with:
Application: application-name
Company: company-name
You can store the authentication statement in a SQL script file to avoid having to type in the long signature
repeatedly. If you store the authentication statement in the file install-dir\scripts\authenticate.sql, it is applied
whenever you create, rebuild, or upgrade a database.
For more information about configuring and using the OEM Edition of SQL Anywhere, see “Running
authenticated SQL Anywhere applications” on page 65.
See also
● “connection_authentication option [database]” on page 461
Example
SET OPTION PUBLIC.database_authentication =
'company = MyCompany;
application = MySQLAnywhereApp;
signature = 0fa55157edb8e14d818e';
Allowed values
String
Default
'YYYY-MM-DD' (this corresponds to ISO date format specifications)
Scope
Can be set for an individual connection or for the PUBLIC group. Takes effect immediately.
Remarks
The format is a string using the following symbols:
Symbol Description
Each symbol is substituted with the appropriate data for the date that is being formatted.
If the character data is multibyte, the length of each symbol reflects the number of characters, not the number
of bytes. For example, the 'mmm' symbol specifies a length of three characters for the month.
For symbols that represent character data (such as mmm), you can control the case of the output as follows:
● Type the symbol in all uppercase to have the format appear in all uppercase. For example, MMM produces
JAN.
● Type the symbol in all lowercase to have the format appear in all lowercase. For example, mmm produces
jan.
● Type the symbol in mixed case to have SQL Anywhere choose the appropriate case for the language that
is being used. For example, in English, typing Mmm produces May, while in French it produces mai.
For symbols that represent numeric data, you can control zero-padding with the case of the symbols:
● Type the symbol in same-case (such as MM or mm) to allow zero padding. For example, yyyy/mm/dd
could produce 2002/01/01.
● Type the symbol in mixed case (such as Mm) to suppress zero padding. For example, yyyy/Mm/Dd could
produce 2002/1/1.
See also
● “time_format option [compatibility]” on page 524
● “timestamp_format option [compatibility]” on page 526
Example
The following table illustrates date_format settings, together with the output from the following statement,
executed on Monday, April 14, 2008.
SELECT CAST( CURRENT DATE AS VARCHAR );
yyyy/mm/dd/ddd 2008/04/14/mon
yyyy/Mm/Dd/ddd 2008/4/14/mon
jjj 105
mm-yyyy 04-2008
Allowed values
MDY, YMD, DMY
Default
YMD (this corresponds to ISO date format specifications)
For Open Client and jConnect connections, the default is set to MDY
Scope
Can be set for an individual connection or for the PUBLIC group. Takes effect immediately.
Remarks
The database option date_order is used to determine whether 10/11/12 is Oct 11 1912, Nov 12 1910, or Nov
10 1912.
Allowed values
On, Off
Default
Off
Remarks
This option allows you to control the behavior of debugging messages in stored procedures and triggers that
contain a MESSAGE statement with the DEBUG ONLY clause specified. By default, this option is set to
Off and debugging messages do not appear when the MESSAGE statement is executed. By setting
debug_messages to On, you can enable the debugging messages in all stored procedures and triggers.
Note
DEBUG ONLY messages are inexpensive when the debug_messages option is set to Off, so these statements
can usually be left in stored procedures on a production system. However, they should be used sparingly in
locations where they would be executed frequently; otherwise, they may result in a small performance
penalty.
See also
● “MESSAGE statement” [SQL Anywhere Server - SQL Reference]
Allowed values
On, Off
Default
Off
Scope
Can be set as a temporary option only, for the duration of the current connection. DBA authority required.
Remarks
When the dedicated_task connection option is set to On, a request handling task is dedicated exclusively to
handling requests for the connection. By pre-establishing a connection with this option enabled, you will be
able to gather information about the state of the database server if it becomes otherwise unresponsive.
Allowed values
String.
Default
Empty string
Scope
Can be set for an individual connection or for the PUBLIC group. Takes effect immediately.
Remarks
For each database, you can create up to twelve dbspaces in addition to the system (main) dbspace. When a
table is created without specifying a dbspace, the dbspace named by this option setting is used. If this option
is not set, is set to the empty string, or is set to system, then the SYSTEM dbspace is used.
When you create temporary tables or indexes, they are always placed in the TEMPORARY dbspace,
regardless of the setting of the default_dbspace option. If you specify the IN clause when creating a base
table, the dbspace specified by the IN clause is used, rather than the dbspace specified by the default_dbspace
option.
If all tables are created in a location other than the system dbspace, then the system dbspace is only used for
the checkpoint log and system tables. This is useful if you want to put the checkpoint log on a separate disk
from the rest of your database objects for performance reasons. You can place the checkpoint log in a separate
disk by changing all CREATE TABLE statements to specify the dbspace, or by changing this option before
creating any tables.
See also
● “Using additional dbspaces” on page 17
● “Place different files on different devices” [SQL Anywhere Server - SQL Usage]
● “CREATE DBSPACE statement” [SQL Anywhere Server - SQL Reference]
Example
In the following example, a new dbspace named MyLibrary is created. The default dbspace is then set to the
MyLibrary dbspace and the table LibraryBooks is stored in the MyLibrary dbspace instead of the system
dbspace.
Allowed values
Integer, between 1 and 1000000 inclusive
Default
1
Scope
Can be set for an individual connection or for the PUBLIC group. Takes effect immediately.
Remarks
Since a TIMESTAMP value is precise to six decimal places in SQL Anywhere, by default 1 microsecond
(0.000001 of a second) is added to differentiate between two identical TIMESTAMP values.
Some software, such as Microsoft Access, truncates TIMESTAMP values to three decimal places, making
valid comparisons a problem. You can set the truncate_timestamp_values option to On to specify the number
of decimal place values SQL Anywhere stores to maintain compatibility.
For MobiLink synchronization, if you are going to set this option, it must be set prior to performing the first
synchronization.
See also
● “truncate_timestamp_values option [database] [MobiLink client]” on page 527
Allowed values
Integer, in milliseconds
Default
500
Scope
Can be set for an individual connection or for the PUBLIC group. Takes effect immediately.
Remarks
This option has meaning only when delayed_commits is set to On. it governs when a COMMIT entry in the
transaction log is written to disk. With delayed_commits set to On, the database server waits for the number
of milliseconds set in the delayed_commit_timeout option for other connections to fill a page of the log
before writing the current page contents to disk. See “delayed_commits option [database]” on page 471.
Allowed values
On, Off
Default
Off (this corresponds to ISO COMMIT behavior)
Scope
Can be set for an individual connection or for the PUBLIC group. Takes effect immediately.
Remarks
When set to On, the database server replies to a COMMIT statement immediately instead of waiting until
the transaction log entry for the COMMIT has been written to disk. When set to Off, the application must
wait until the COMMIT is written to disk.
When this option is On, the log is written to disk when the log page is full or according to the
delayed_commit_timeout option setting, whichever is first. There is a slight chance that a transaction may
be lost even though committed if a system failure occurs after the database server replies to a COMMIT, but
before the page is written to disk. Setting delayed_commits to On, and the delayed_commit_timeout option
to a high value, promotes a quick response time at the slight risk of losing a committed transaction during
recovery.
If both cooperative_commits and delayed_commits are set to On, and if the cooperative_commit_timeout
interval passes without the pages getting written, the application is resumed (as if the commit had worked),
and the remaining interval (delayed_commit_timeout - cooperative_commit_timeout) is used as a
delayed_commits interval after which the pages will be written, even if they are not full.
See also
● “cooperative_commit_timeout option [database]” on page 463
● “cooperative_commits option [database]” on page 464
● “delayed_commit_timeout option [database]” on page 470
Allowed values
On, Off, Delay, n days
Default
Off
Remarks
This option is used by SQL Anywhere MobiLink clients, by SQL Remote, and by the SQL Anywhere
Replication Agent. The default setting is Off. When it is set to On, each old transaction log is deleted when
all the changes it contains have been replicated or synchronized successfully. When it is set to DELAY, each
old transaction log with a file name indicating that it was created on the current day is not deleted, even if
all changes have been sent and confirmed. When it is set to n days, logs that were created before n days ago
are deleted.
For more information about how to use the delete_old_logs option in conjunction with the BACKUP
statement to delete old copies of transaction logs, see “BACKUP statement” [SQL Anywhere Server - SQL
Reference].
Example
If, on January 18 you run dbmlsync against a remote database that has set the delete_old_logs option to 10
days, dbmlsync deletes offline transaction logs that were created on or before January 7. The remote database
would set the option as follows:
SET OPTION delete_old_logs = '10 days';
See also
● “SQL Anywhere client logging” [MobiLink - Client Administration]
● “MirrorLogDirectory (mld) extended option” [MobiLink - Client Administration]
● “SQL Remote options” [SQL Remote]
Allowed values
On, Off
Default
On
Remarks
If this option is set to On, then SQL Anywhere allows duplicate correlation names to be used in the null-
supplying side of outer joins. All tables or views specified with the same correlation name are interpreted
as the same instance of the table or view.
The following FROM clause illustrates the SQL Anywhere interpretation of a join using duplicate correlation
names where C1 and C2 are search conditions:
( R left outer join T on ( C1 ), T join S on ( C2 ) )
Note
To see the result of eliminating duplicate correlation names, you can view the rewritten statement using the
REWRITE function with the second argument set to ANSI.
See also
● “REWRITE function [Miscellaneous]” [SQL Anywhere Server - SQL Reference]
Allowed values
On, Off
Default
Off
Remarks
This option is used by SQL Remote to indicate whether the message link parameters should be stored in the
database (Off) or externally (On).
Allowed values
On, Off
Default
On
Remarks
When set to On, triggers are fired. When set to Off, no triggers are fired, including referential integrity
triggers (such as cascading updates and deletes). Only a user with DBA authority can set this option. The
option is overridden by the -gf option, which turns off all trigger firing regardless of the fire_triggers setting.
This option is relevant when replicating data from Adaptive Server Enterprise to SQL Anywhere because
all actions from Adaptive Server Enterprise transaction logs are replicated to SQL Anywhere, including
actions performed by triggers.
See also
● “-gf server option” on page 181
● “Introduction to triggers” [SQL Anywhere Server - SQL Usage]
Allowed values
1, 2, 3, 4, 5, 6, 7
Default
7 (Sunday is the first day of the week)
Remarks
The values have the following meaning:
Value Meaning
1 Monday
2 Tuesday
Value Meaning
3 Wednesday
4 Thursday
5 Friday
6 Saturday
7 Sunday
The value specified by this option affects the result of the DATEPART function when obtaining a weekday
value. You can also change the first day of week using the DATEFIRST option in the SET statement.
The value specified by this option does not affect the result of the DOW function. For example, even if the
first day of the week is set to Monday, the DOW function returns a 2 for Monday.
See also
● “DATEPART function [Date and time]” [SQL Anywhere Server - SQL Reference]
● “SET statement [T-SQL]” [SQL Anywhere Server - SQL Reference]
Allowed values
Empty, Omit
Default
Omit
Remarks
If you execute a query that includes the FOR XML clause, the for_xml_null_treatment option determines
how NULL values are treated. By default, elements and attributes that contain NULL values are omitted
from the result. Setting this option to Empty generates empty elements or attributes if the value is NULL.
See also
● “Using the FOR XML clause to retrieve query results as XML” [SQL Anywhere Server - SQL Usage]
● “SELECT statement” [SQL Anywhere Server - SQL Reference]
Caution
The force_view_creation option should only be used within a reload.sql script. This option is used by the
Unload utility (dbunload) and should not be set explicitly.
Allowed values
Integer
Default
2147483647
Scope
Can be set for the PUBLIC group only. DBA authority required.
Remarks
The value you specify for this option is the starting value. For columns created with DEFAULT GLOBAL
AUTOINCREMENT, when a row is inserted into the table that does not include a value for the DEFAULT
GLOBAL AUTOINCREMENT column, the database server generates a value for the column. The value is
determined by the global_database_id value and the partition size for the column.
Setting global_database_id to the default value indicates that GLOBAL DEFAULT AUTOINCREMENT
is disabled. In this case NULL is generated as a default.
You can find the value of the option in the current database using the following statement:
SELECT DB_PROPERTY( 'GlobalDBID' );
This feature is of particular use in replication environments to ensure unique primary keys.
See also
● “CREATE TABLE statement” [SQL Anywhere Server - SQL Reference]
● GlobalDBID property: “Database-level properties” on page 574
● MobiLink: “Setting the global database ID” [MobiLink - Server Administration]
● SQL Remote: “Ensuring unique primary keys” [SQL Remote]
Example
The following example sets the database identification number to 100.
SET OPTION PUBLIC.global_database_id = '100';
Specify the amount of time, in minutes, that the client waits for an HTTP session to time out before giving
up.
Allowed values
Integer (1 to 525600)
Default
30
Scope
Can be set for the PUBLIC group only. DBA authority required.
Remarks
This option provides variable session timeout control for web service applications. A web service application
can change the timeout value from within any request that owns the HTTP session, but a change to the
timeout value can impact subsequent queued requests if the HTTP session times out. The web application
must include logic to detect whether a client is attempting to access an HTTP session that no longer exists.
This can be done by examining the value of the SessionCreateTime connection property to determine whether
a timestamp is valid: if the HTTP request is not associated with the current HTTP session, then the
SessionCreateTime connection property contains an empty string.
See also
● SessionCreateTime and http_session_timeout properties: “Connection-level properties” on page 538
● “Using HTTP sessions” [SQL Anywhere Server - Programming]
Allowed values
String
Default
NULL
Scope
Can be set for the PUBLIC group only. DBA authority required.
Remarks
This option allows a user with DBA authority to specify the name of the Domain Controller server that is
used to look up group membership when using Windows user groups for integrated logins. By default, the
computer that SQL Anywhere is running on is used for verifying group membership.
See also
● “Creating integrated logins for Windows user groups” on page 116
● “GRANT statement” [SQL Anywhere Server - SQL Reference]
Example
The following example specifies that group membership is verified on the computer server-1.
SET OPTION PUBLIC.integrated_server_name = '\\server-1';
Allowed values
0, 1, 2, 3, snapshot, statement-snapshot, readonly-statement-snapshot
Default
0
1 for Open Client, jConnect, and TDS connections
Scope
Can be set for an individual connection or for the PUBLIC group. Takes effect immediately.
Remarks
This option controls the locking isolation level as follows:
● 0 Allow dirty reads, non-repeatable reads, and phantom rows.
● 1 Prevent dirty reads. Allow non-repeatable reads and phantom rows.
● 2 Prevent dirty reads and non-repeatable reads. Allow phantom rows.
● 3 Serializable. Prevent dirty reads, non-repeatable reads, and phantom rows.
● snapshot Use a snapshot of committed data from the time when the first row is read or updated by
the transaction.
● statement-snapshot For each statement, use a snapshot of committed data from the time when the
first row is read from the database. Non-repeatable reads and phantom rows can occur within a
transaction, but not within a single statement.
● readonly-statement-snapshot For read-only statements, use a snapshot of committed data from
the time when the first row is read from the database. Non-repeatable reads and phantom rows can occur
within a transaction, but not within a single statement. For updatable statements, use the isolation level
specified by the updatable_statement_isolation option (can be one of 0 (the default), 1, 2, or 3).
For more detailed information about supported isolation levels, see “Isolation levels and consistency” [SQL
Anywhere Server - SQL Usage].
The allow_snapshot_isolation option must be set to On to use the snapshot, statement-snapshot, or readonly-
statement-snapshot settings.
If you are using the iAnywhere JDBC driver, the default isolation level is 0.
Queries running at isolation level snapshot, statement-snapshot, or readonly-statement-snapshot see a
snapshot of a committed state of the database.
You can override any temporary or public settings for this option within individual INSERT, UPDATE,
DELETE, SELECT, UNION, EXCEPT, and INTERSECT statements by including an OPTION clause in
the statement. See:
● “INSERT statement” [SQL Anywhere Server - SQL Reference]
● “UPDATE statement” [SQL Anywhere Server - SQL Reference]
● “DELETE statement” [SQL Anywhere Server - SQL Reference]
● “SELECT statement” [SQL Anywhere Server - SQL Reference]
● “UNION clause” [SQL Anywhere Server - SQL Reference]
● “EXCEPT clause” [SQL Anywhere Server - SQL Reference]
● “INTERSECT clause” [SQL Anywhere Server - SQL Reference]
See also
● “allow_snapshot_isolation option [database]” on page 448
● “updatable_statement_isolation option [database]” on page 529
● “Snapshot isolation” [SQL Anywhere Server - SQL Usage]
● “Isolation levels and consistency” [SQL Anywhere Server - SQL Usage]
● “Choosing isolation levels” [SQL Anywhere Server - SQL Usage]
Allowed values
String
Default
Empty string
Scope
Can be set for the PUBLIC group only. DBA authority required.
Remarks
By default, this option contains an empty string. In this case, the database server searches the JAVA_HOME
environment variable, the path, and other locations for the Java VM. The JavaVM database property allows
you to query which Java VM the database server will use if the java_location option is not set.
See also
● “java_main_userid option [database]” on page 480
● “java_vm_options option [database]” on page 480
Allowed values
String
Default
DBA user (the default user created when the database is initialized)
Scope
Can be set for the PUBLIC group only. DBA authority required.
Remarks
The specified user ID should have DBA authority so they can perform the required operations. The password
for this user is not required.
See also
● “java_location option [database]” on page 479
● “java_vm_options option [database]” on page 480
● “Choosing a Java VM” [SQL Anywhere Server - Programming]
Allowed values
String
Default
Empty string
Scope
Can be set for the PUBLIC group only. DBA authority required.
Remarks
This option lets you specify options that the database server uses when launching the Java VM specified by
the java_location option. These additional options can be used to set up the Java VM for debugging purposes
or to run as a service on UNIX platforms. In some cases, additional options are required to use the Java VM
in 64-bit mode instead of 32-bit mode.
See also
● “java_location option [database]” on page 479
● “java_main_userid option [database]” on page 480
● “Choosing a Java VM” [SQL Anywhere Server - Programming]
Example
The following example uses the java_vm_options option to keep the Java VM running on Unix when the
database server is started as a service and the user needs to log out:
The following example instructs the Java VM to use 64-bit mode on HP-UX:
Allowed values
On, Off
Default
Off
Scope
Can be set for the PUBLIC group only. DBA authority required. Takes effect immediately.
Remarks
When this option is set to On, the database server logs information about deadlocks in an internal buffer.
The size of the buffer is fixed at 10000 bytes. You can view the deadlock information using the
sa_report_deadlocks stored procedure. The contents of the buffer are cleared when this option is set to Off.
When deadlock occurs, information is reported for only those connections involved in the deadlock. The
order in which connections are reported is based on which connection is waiting for which row. For thread
deadlocks, information is reported about all connections.
When you have deadlock reporting turned on, you can also use the Deadlock system event to take action
when a deadlock occurs. See “Understanding system events” on page 902.
See also
● “sa_report_deadlocks system procedure” [SQL Anywhere Server - SQL Reference]
● “Determining who is blocked” [SQL Anywhere Server - SQL Usage]
● “Tutorial: Diagnosing deadlocks” [SQL Anywhere Server - SQL Usage]
Controls the use of integrated and Kerberos logins for the database.
Allowed values
One or more of: Standard, Integrated, Kerberos, Mixed (deprecated)
Default
Standard
Scope
Can be set for the PUBLIC group only. DBA authority required. Takes effect immediately.
Remarks
This option specifies whether standard, integrated, and Kerberos logins are permitted. One or more of the
following login modes are accepted (the values are case insensitive):
● Standard Standard logins are permitted. This is the default setting. Standard connection logins must
supply both a user ID and password, and do not use the Integrated or Kerberos connection parameters.
● Integrated Integrated logins are permitted.
● Kerberos Kerberos logins are permitted.
● Mixed (deprecated) This is equivalent to specifying Standard,Integrated.
If you specify multiple login modes, the database server allows all the specified modes.
Caution
Setting the login_mode database option to not allow Standard logins restricts connections to only those users
or groups who have been granted an integrated or Kerberos login mapping. Attempting to connect with a
user ID and password generates an error. The only exceptions to this are users with DBA authority.
You can specify multiple values in a comma-separated list. This list cannot contain white space. For example,
the following setting allows both standard and integrated logins:
If a database file is not secured and can be copied by unauthorized users, the temporary public login_mode
option should be used (both for integrated and Kerberos logins). This way, integrated and Kerberos logins
are not supported by default if the file is copied.
See also
● “Using integrated logins” on page 113
● “Using Kerberos authentication” on page 121
● “Security concerns: Copied database files” on page 130
Example
Enable only integrated logins (standard logins and Kerberos logins fail):
Allowed values
String
Default
sp_login_environment system procedure
Scope
DBA authority required.
Remarks
This login procedure calls the sp_login_environment procedure at run time to determine the database
connection settings. The login procedure is called after all the checks have been performed to verify that the
connection is valid. The procedure specified by the login_procedure option is not executed for event
connections.
You can customize the default database option settings by creating a new procedure and setting
login_procedure to call the new procedure. This custom procedure needs to call either sp_login_environment
or detect when a TDS connection occurs (see the default sp_login_environment code) and call
sp_tsql_environment directly. Failure to do so can break TDS-based connections. You should not edit either
sp_login_environment or sp_tsql_environment.
A password expired error message with SQLSTATE 08WA0 can be signaled by a user defined login
procedure to indicate to a user that their password has expired. Signaling the error allows applications to
check for the error and process expired passwords. It is recommended that you use a login policy to implement
password expiry and not a login procedure that returns the expired password error message.
If you use the NewPassword=* connection parameter, signaling this error is required for the client libraries
to prompt for a new password. If the procedure signals SQLSTATE 28000 (invalid user ID or password) or
SQLSTATE 08WA0 (expired password), or the procedure raises an error with RAISERROR, the login fails
and an error is returned to the user. If you signal any other error or if another error occurs, then the user login
is successful and a message is written to the database server message log.
See also
● “post_login_procedure option [database]” on page 503
● “sp_login_environment system procedure” [SQL Anywhere Server - SQL Reference]
● “sp_tsql_environment system procedure” [SQL Anywhere Server - SQL Reference]
Example
The following example shows how you can disallow a connection by signaling the INVALID_LOGON
error.
CREATE PROCEDURE DBA.login_check( )
BEGIN
DECLARE INVALID_LOGON EXCEPTION FOR SQLSTATE '28000';
// Allow a maximum of 3 concurrent connections
IF( DB_PROPERTY( 'ConnCount' ) > 3 ) THEN
SIGNAL INVALID_LOGON;
ELSE
CALL sp_login_environment;
END IF;
END
go
For more information about an alternate way to disallow connections, see “RAISERROR statement” [SQL
Anywhere Server - SQL Reference].
The following example shows how you can block connection attempts if the number of failed connections
for a user exceeds 3 within a 30 minute period. All blocked attempts during the block out period receive an
invalid password error and are logged as failures. The log is kept long enough for a DBA to analyze it.
CREATE TABLE DBA.ConnectionFailure(
pk INT PRIMARY KEY DEFAULT AUTOINCREMENT,
user_name CHAR(128) NOT NULL,
tm TIMESTAMP NOT NULL DEFAULT CURRENT TIMESTAMP
)
go
The following example shows how to signal the Password has expired message. It is recommended
that you use a login policy to implement password expiry notification.
For information about login policies, see “Managing login policies overview” on page 386.
Allowed values
Disabled, Fresh, Stale, N { Minute[s] | Hour[s] | Day[s] | Week[s] | Month[s] }
Default
Stale
Scope
Can be set for an individual connection, for an individual user, or for the PUBLIC group. Takes effect
immediately.
Remarks
The materialized_view_optimization option lets you specify the circumstances under which the optimizer
can use stale materialized views.
Data in a materialized view becomes stale when data in any of the base tables referenced by the materialized
view is updated. You should consider the acceptable degree of data staleness when deciding the refresh
frequency for the materialized view, as well as the time it takes to refresh the view, since the view is not
available for querying during the refresh process. You should also consider whether it is acceptable for the
database server to return results that may not reflect the current state of the database. You can choose from
the following settings for this option:
● Disabled Do not use materialized views for query optimization.
● Fresh Use a materialized view only if it is fresh (data in underlying tables has not been modified since
the view was last refreshed).
● Stale Use materialized views even if they are stale. This is the default setting.
● N { Minute[s] | Hour[s] | Day[s] | Week[s] | Month[s] } Use fresh and stale materialized views, as
long as the stale materialized views have been refreshed within the specified time period. Values specified
in minutes must be less than 231 minutes. The database server treats a week as 7 days and a month as 30
days.
When a query directly references a materialized view, the view is used regardless of staleness; the
materialized_view_optimization option has no effect in this case.
Allowed values
Integer, 0 to 100
Scope
Can be set for an individual connection or for the PUBLIC group. Changing the value takes effect
immediately.
Default
10
Description
Client statement caching reduces database requests and statement prepares when identical SQL statements
are prepared multiple times. When the same SQL text is prepared and dropped repeatedly, the client caches
the statement, leaving it prepared on the database server, even after it has been dropped by the application.
Caching the statement saves the database server the extra work of dropping and re-preparing the statement.
If a schema change occurs, a database option setting changes, or a DROP VARIABLE statement is executed,
the prepared statement is dropped automatically and is prepared again the next time the SQL statement is
executed, ensuring that a cached statement that could cause incorrect behavior is never reused.
This option specifies the maximum number of statements that can remain prepared (cached). Cached
statements are not counted toward the max_statement_count resource governor.
The setting of this option applies to connections made using embedded SQL, ODBC, OLE DB, ADO.NET,
and the iAnywhere JDBC driver. It does not apply to Open Client, jConnect, or HTTP connections.
Setting this option to 0 disables client statement caching. Increasing this value has the potential to improve
performance if the application is repeatedly preparing and dropping more than ten of the same SQL
statements. For example, if an application loops through twenty-five SQL statements, preparing and dropping
them each iteration through the loop, and each iteration each of these SQL statements have the exact same
text, setting this option to 25 may improve performance.
Increasing the value of this option increases memory use on the client and places more cache pressure on
the database server. If a significant number of cached statements cannot be reused because of schema changes
or option settings, statement caching is disabled automatically for the connection. If statement caching is
automatically turned off, the client periodically turns statement caching on again to re-evaluate the decision
and determine whether re-enabling statement caching would be beneficial.
See also
● “max_statement_count option [database]” on page 491
● ClientStmtCacheHits and ClientStmtCacheMisses properties: “Connection-level
properties” on page 538
● ClientStmtCacheHits and ClientStmtCacheMisses properties: “Server-level properties” on page 561
Allowed values
Integer
Default
50
Scope
Can be set for an individual connection or for the PUBLIC group. Takes effect immediately. DBA authority
required to set this option for any connection.
Remarks
This resource governor allows a DBA to limit the number of cursors per connection that a user can use. If
an operation would exceed the limit for a connection, an error is generated, indicating that the governor for
the resource has been exceeded.
If a connection executes a stored procedure, that procedure is executed under the permissions of the procedure
owner. However, the resources used by the procedure are assigned to the current connection.
You can remove resource limits by setting the option to 0 (zero).
Allowed values
Integer
Default
20
Scope
Can be set for an individual connection or for the PUBLIC group. Takes effect immediately. DBA authority
required to set this option for the PUBLIC group.
Remarks
This option specifies the maximum number of plans cached for each connection. The optimizer caches the
execution plan for queries, INSERT, UPDATE, and DELETE statements that are performed inside stored
procedures, functions, and triggers. After a statement in a stored procedure, stored function, or trigger is
executed several times by a connection, the optimizer builds a reusable plan for the statement.
Reusable plans do not use the values of host variables for selectivity estimation or rewrite optimizations. As
a result of this, the reusable plan can have a higher cost than if the statement was re-optimized. When the
cost of the reusable plan is close to the best observed cost for a statement, the optimizer adds the plan to the
plan cache.
The cache is cleared when you execute statements, such as CREATE TABLE and DROP TABLE, that
modify the table schema. Statements that reference declared temporary tables are not cached.
Setting this option to 0 disables plan caching.
See also
● “Plan caching” [SQL Anywhere Server - SQL Usage]
● max_plans_cached property: “Connection-level properties” on page 538
Allowed values
Critical, High, Above Normal, Normal, Below normal, Low, Background
Default
Normal
Scope
Can be set for an individual connection or for the PUBLIC group. Takes effect immediately. DBA authority
required.
If you set this option temporarily, that setting applies to the current connection only. Different connections
under the same user ID can have different settings for this option.
Remarks
The scheduling of different priority levels allows all requests to get some CPU time, regardless of the priority
level of the request. Higher priority requests get more time slices than lower priority ones.
See also
● “priority option [database]” on page 507
Allowed values
Integer
Default
0
Scope
Can be set for an individual connection or for the PUBLIC group. Takes effect immediately.
Remarks
The max_query_tasks option sets the maximum level of parallelism that can be used for any SQL statement.
The option sets the number of database server tasks that can be used to process a query in parallel. The
default value is 0, which allows the database server to use as many tasks as it chooses. Any other value for
the max_query_tasks option sets the maximum number of tasks allowed per query. Setting the
max_query_tasks option to 1 disables intra-query parallelism.
For more information about server tasks, threads, and query execution, see “Threading in SQL
Anywhere” on page 41 and “Setting the database server's multiprogramming level” on page 44.
The number of tasks the database server can use for all requests is limited by the threshold set using the -gn
option at startup. This number is a global maximum for all databases and connections serviced by that server.
The number of tasks used for a request is also limited by the number of logical processors available to the
database server. For example, setting the processor concurrency to 1 with the -gtc option disables intra-query
parallelism.
When enabled, intra-query parallelism is used to process SELECT statements that meet certain
qualifications. The presence of an exchange operator in the access plan for a query indicates that intra-query
parallelism was used.
You can override any temporary or public settings for this option within individual INSERT, UPDATE,
DELETE, SELECT, UNION, EXCEPT, and INTERSECT statements by including an OPTION clause in
the statement. See:
● “INSERT statement” [SQL Anywhere Server - SQL Reference]
● “UPDATE statement” [SQL Anywhere Server - SQL Reference]
● “DELETE statement” [SQL Anywhere Server - SQL Reference]
● “SELECT statement” [SQL Anywhere Server - SQL Reference]
● “UNION clause” [SQL Anywhere Server - SQL Reference]
● “EXCEPT clause” [SQL Anywhere Server - SQL Reference]
● “INTERSECT clause” [SQL Anywhere Server - SQL Reference]
See also
● “-gn server option” on page 183
● “-gt server option” on page 186
● “-gtc server option” on page 187
● “Parallelism during query execution” [SQL Anywhere Server - SQL Usage]
● max_query_tasks property: “Server-level properties” on page 561
Allowed values
Integer
Default
100
Scope
Can be set for an individual connection or for the PUBLIC group. Takes effect immediately. DBA authority
required to set this option for the PUBLIC group.
Remarks
Computation of a recursive common table expression aborts and an error is generated if the computation
fails to complete within the specified number of iterations. Recursive subqueries often increase geometrically
in the amount of resources required for each additional iteration. Set this option to limit the amount of time
and resources that will be consumed before infinite recursion is detected, yet permit your recursive common
table expressions to work as intended.
Setting this option to 0 disables recursive common table expressions.
See also
● “Common table expressions” [SQL Anywhere Server - SQL Usage]
Allowed values
Integer
Default
50
Scope
Can be set for an individual connection or for the PUBLIC group. Takes effect immediately. DBA authority
required to set this option for any connection.
Remarks
Applications that use prepared statements can receive the error "Resource governor for 'prepared statements'
exceeded" if the prepared statements are not explicitly dropped once they are no longer required. The
max_statement_count database option is a resource governor that allows a DBA to limit the number of
prepared statements used per connection. If an operation would exceed the limit for a connection, an error
is generated, indicating that the governor for the resource has been exceeded.
If a connection executes a stored procedure, that procedure is executed under the permissions of the procedure
owner. However, the resources used by the procedure are assigned to the current connection.
The database server maintains data structures for each prepared statement a connection creates. These
structures are only freed when the application signals to the database server that the prepared statements are
no longer needed or if the connection disconnects. To reduce the statement count for a connection, you must
execute the equivalent of a DROP STATEMENT request. The following table lists the commands you can
execute for the APIs supported by SQL Anywhere:
Interface Statement
ADO RecordSet.Close
Note
In Java and .NET, it is recommended that you drop statements explicitly. You should not rely on garbage
collection to perform this cleanup because the language routines do not issue server calls to deallocate the
statement resources. In addition, there is no guarantee of when the garbage collection routines will execute.
If a server needs to support more than the default number of prepared statements at any one time for any one
connection, then the max_statement_count setting should be set to a higher value. Note, however, that larger
numbers of active prepared statements consume additional server memory. You can disable the prepared
statement resource governor entirely by setting the max_statement_count option to 0 (zero), but this is not
recommended. Doing so makes the database server vulnerable to shutting down with an out-of-memory
condition for applications that do not properly free prepared statements.
See also
● “Preparing statements” [SQL Anywhere Server - Programming]
● “DROP STATEMENT statement [ESQL]” [SQL Anywhere Server - SQL Reference]
Allowed values
Integer [ k | m | g | p ]
Default
0
Scope
Can be set for a temporary option for the duration of the current connection or for the PUBLIC group. Takes
effect immediately. DBA authority required.
Remarks
This option allows you to specify the maximum amount of temporary file space a connection can use before
the request fails because it exceeds the temporary file space limit. The temp_space_limit_check option must
be set to On (the default) for the max_temp_space option to take effect.
The default value 0 indicates that there is no fixed limit on the amount of temporary file space a connection
can request. Any other value specifies the number of bytes of temporary file space a connection can use.
You can use k, m, or g to specify units of kilobytes, megabytes, or gigabytes, respectively. If you use p, the
argument is a percentage of the total amount of temporary file space available.
For connections that request temporary file space, the database server checks the limit against the setting of
the max_temp_space option to make sure the request is under the maximum size. If the connection requests
more temporary space than is allowed, the request fails and the error SQLSTATE_TEMP_SPACE_LIMIT
is generated.
Can be set for an individual connection or for the PUBLIC group. Takes effect immediately. DBA authority
required to set this option for the PUBLIC group.
See also
● “temp_space_limit_check option [database]” on page 524
● “sa_disk_free_space system procedure” [SQL Anywhere Server - SQL Reference]
Example
Set a 1 GB limit for a connection:
SET OPTION PUBLIC.max_temp_space = '1g';
Allowed values
Integer
The value is in bytes. For single-byte character sets, this is the same as the number of characters.
Default
0 characters
Scope
Can only be set for the PUBLIC group. Takes effect immediately. DBA authority required.
Remarks
This option allows the database administrator to impose a minimum length on all new passwords for greater
security. Existing passwords are not affected. Passwords have a maximum length of 255 bytes and are case
sensitive.
See also
● “verify_password_function option [database]” on page 532
Example
Set the minimum length for new passwords to 6 bytes.
SET OPTION PUBLIC.min_password_length = 6;
Allowed values
Integer, between 0 and 100 inclusive
Default
50
Remarks
This option controls the handling of two-digit years when converting from strings to dates or timestamps.
The nearest_century setting is a numeric value that acts as a rollover point. Two digit years less than the
value are converted to 20yy, while years greater than or equal to the value are converted to 19yy.
The historical SQL Anywhere behavior is to add 1900 to the year. Adaptive Server Enterprise behavior is
to use the nearest century, so for any year where value yy is less than 50, the year is set to 20yy.
Allowed values
String
Default
Empty string
Remarks
This option turns off individual keywords. This provides a way of ensuring that applications created with
older versions of the product are not broken by new keywords. If you have an identifier in your database
that is now a keyword, you can either add double quotes around the identifier in all applications or scripts,
or turn off the keyword using the non_keywords option.
The following statement prevents TRUNCATE and SYNCHRONIZE from being recognized as keywords:
SET OPTION non_keywords = 'TRUNCATE, SYNCHRONIZE';
Each new setting of this option replaces the previous setting. The following statement clears all previous
settings.
SET OPTION non_keywords =;
A side-effect of this option is that SQL statements that use a turned off keyword cannot be used: they produce
a syntax error.
See also
● “Keywords” [SQL Anywhere Server - SQL Reference]
odbc_describe_binary_as_varbinary [database]
Controls how the SQL Anywhere ODBC driver describes BINARY columns.
Allowed values
On, Off
Default
Off
Remarks
This option allows you to choose whether you want all BINARY and VARBINARY columns to be described
to your application as BINARY or VARBINARY. By default, the SQL Anywhere ODBC driver describes
both BINARY and VARBINARY columns as SQL_BINARY. When this option is set to On, the ODBC
driver describes BINARY and VARBINARY columns as SQL_VARBINARY. Regardless of the setting of
this option, it is not possible to distinguish between BINARY and VARBINARY columns.
It may be useful to turn this option On if you are using Delphi applications where BINARY columns are
always zero-padded, but VARBINARY columns are not. You can improve performance in Delphi by setting
this option to On so that all columns are treated as variable length data types.
See also
● “BINARY data type” [SQL Anywhere Server - SQL Reference]
● “VARBINARY data type” [SQL Anywhere Server - SQL Reference]
Allowed values
On, Off
Default
Off
Remarks
When a connection is opened, the SQL Anywhere ODBC driver uses the setting of this option to determine
how CHAR columns are described. If this option is set to Off (the default), then CHAR columns are described
as SQL_VARCHAR. If this option is set to On, then CHAR columns are described as SQL_CHAR.
VARCHAR columns are always described as SQL_VARCHAR.
The odbc_distingish_char_and_varchar option also controls whether NCHAR columns are described as
SQL_WCHAR or SQL_WVARCHAR. If this option is set to Off, then NCHAR columns are described as
SQL_WVARCHAR. If this option is set to On, then NCHAR columns are described as SQL_WCHAR.
NVARCHAR columns are always described as SQL_WVARCHAR.
See also
● “NCHAR data type” [SQL Anywhere Server - SQL Reference]
● “NVARCHAR data type” [SQL Anywhere Server - SQL Reference]
Allowed values
String (up to 128 bytes)
Default
Empty string
Scope
Can only be set for the PUBLIC group. Takes effect immediately. DBA authority required.
Remarks
You can store information in the header page of the database file and later extract the information by reading
the file directly from your application. This page is stored in the system dbspace file header. If you specify
a value for the OEM string that is longer than 128 bytes, an error is returned.
You may find it useful to store such information as schema versions, the application name, the application
version, and so on. Alternatively, without starting the database, an application could use the OEM string to
determine whether the database file is associated with the application, or design your application to use the
information to validate that the database file is intended for your application, by storing a string that the
application reads for validation purposes before using the database file. You could also extract metadata to
display to users.
To set the oem_string in the system dbspace file header, execute the following statement:
SET OPTION PUBLIC.oem_string=user-specified-string;
The user-specified-string value is stored both in the ISYSOPTIONS system table and the system dbspace file
header. You must define the string in the required character set before you specify it in a SET OPTION
statement because no translation is done on the string when it is supplied in the SET OPTION statement.
You can use the CSCONVERT function to convert the string to the required character set.
You can query the value of the oem_string in the following ways:
● Using the oem_string connection property:
SELECT CONNECTION_PROPERTY( 'oem_string' );
Caution
Applications cannot write directly to the OEM string in the database because it corrupts the database header
page.
On Windows, applications cannot read the file directly when a server has the database file loaded. The
database server has an exclusive lock on the file. However, on any supported Unix platform, applications
that have read permissions can read the file directly at any time. However, changes to the OEM string may
not show up in the file immediately. Issuing a checkpoint causes the database server to flush page 0 to disk,
and reflect the current OEM string value.
Should the database server fail between changing the OEM string and the next checkpoint, the file header
may not reflect the new OEM string value; the new OEM string value will be set correctly after the database
goes through recovery.
See also
● “CSCONVERT function [String]” [SQL Anywhere Server - SQL Reference]
Example
The following example encrypts the OEM string that contains information about the database file and stores
it in the database header file:
BEGIN
DECLARE @v VARCHAR(100);
SET @v = BASE64_ENCODE( ENCRYPT( 'database version 10', 'abc' ) );
EXECUTE IMMEDIATE 'SET OPTION PUBLIC.oem_string = ''' || @v || '''';
END;
You can retrieve the value of the OEM string using the following command:
SELECT DECRYPT(
BASE64_DECODE(
CONNECTION_PROPERTY( 'oem_string' ) ),'abc' )
Allowed values
Ignore, Warning, Error
Default
Ignore
Remarks
Controls what happens if an error is encountered during character conversion, as follows:
● Ignore Errors and warnings do not appear.
● Warning Reports substitutions and illegal characters as warnings. Illegal characters are not translated.
● Error Reports substitutions and illegal characters as errors.
When character set conversion is required between the client and the database, this option governs whether
to ignore, return a warning, or return an error, when illegal characters are detected, or when character
substitution is used.
Single-byte to single-byte converters are not able to report substitutions and illegal characters, and must be
set to Ignore.
This option does not control the behavior when lossy conversion takes place on the client. For example, SQL
statements from the client must be in, or converted to, the CHAR database character set. Suppose a Unicode
client application prepares a SQL statement, and that statement contains characters that cannot be represented
in the CHAR database character set. Substitution characters are used instead. However, because the lossy
conversion took place on the client, the database server is unaware of the lossy conversion.
See also
● “Comparisons between CHAR and NCHAR” [SQL Anywhere Server - SQL Reference]
● “Converting NCHAR to CHAR” [SQL Anywhere Server - SQL Reference]
● “Substitution characters” [SQL Anywhere Server - SQL Reference]
Allowed values
String (see below for allowed values)
Default
Conditional
Continue for jConnect connections
Remarks
This option controls error handling in stored procedures.
● Stop Stop execution immediately upon finding an error.
● Conditional If the procedure uses ON EXCEPTION RESUME, and the statement following the error
handles the error, continue, otherwise exit.
● Continue Continue execution, regardless of the following statement. If there are multiple errors, the
first error encountered in the stored procedure is returned.
Both the Conditional and Continue settings for on_tsql_error are used for Adaptive Server Enterprise
compatibility, with Continue most closely simulating Adaptive Server Enterprise behavior. The Conditional
setting is recommended, particularly when developing new Transact-SQL stored procedures, as it allows
errors to be reported earlier.
When this option is set to Stop or Continue, it supercedes the setting of the continue_after_raiserror option.
However, when this option is set to Conditional (the default), behavior following a RAISERROR statement
is determined by the setting of the continue_after_raiserror option.
See also
● “CREATE PROCEDURE statement” [SQL Anywhere Server - SQL Reference]
● “CREATE PROCEDURE statement [T-SQL]” [SQL Anywhere Server - SQL Reference]
● “Transact-SQL procedure language overview” [SQL Anywhere Server - SQL Usage]
● “continue_after_raiserror option [compatibility]” on page 462
Allowed values
First-row, All-rows
Default
All-rows
Remarks
The optimization_goal option controls whether SQL Anywhere optimizes SQL data manipulation language
(DML) statements for response time or total resource consumption.
If the option is set to All-rows (the default), then SQL Anywhere optimizes a query to choose an access plan
with the minimal estimated total retrieval time. Setting optimization_goal to All-rows may be appropriate
for applications that intend to process the entire result set, such as PowerBuilder DataWindow applications.
A setting of All-rows is also appropriate for insensitive (ODBC static) cursors since the entire result is
materialized when the cursor is opened. It may also be appropriate for scroll (ODBC keyset-driven) cursors,
since the intent of such a cursor is to permit scrolling through the result set.
If the option is set to First-row, SQL Anywhere chooses an access plan that is intended to reduce the time
to fetch the first row of the query's result, possibly at the expense of total retrieval time. In particular, the
SQL Anywhere optimizer will typically avoid, if possible, access plans that require the materialization of
results to reduce the time to return the first row. With this setting, the optimizer favors access plans that
utilize an index to satisfy a query's ORDER BY clause, rather than plans that require an explicit sorting
operation.
You can use the FASTFIRSTROW table hint in a query's FROM clause to set the optimization goal for a
specific query to First-row, without having to change the optimization_goal setting.
For more information about using the FASTFIRSTROW table hint, see “FROM clause” [SQL Anywhere
Server - SQL Reference].
You can override any temporary or public settings for this option within individual INSERT, UPDATE,
DELETE, SELECT, UNION, EXCEPT, and INTERSECT statements by including an OPTION clause in
the statement. See:
● “INSERT statement” [SQL Anywhere Server - SQL Reference]
● “UPDATE statement” [SQL Anywhere Server - SQL Reference]
● “DELETE statement” [SQL Anywhere Server - SQL Reference]
● “SELECT statement” [SQL Anywhere Server - SQL Reference]
● “UNION clause” [SQL Anywhere Server - SQL Reference]
● “EXCEPT clause” [SQL Anywhere Server - SQL Reference]
● “INTERSECT clause” [SQL Anywhere Server - SQL Reference]
Allowed values
0-15
Default
9
Remarks
The optimization_level option controls the amount of effort that the SQL Anywhere optimizer spends on
optimizing SQL data manipulation language (DML) statements. This option controls the maximum number
of alternative join strategies that the optimizer will consider for any SELECT block. The higher the setting
of optimization_level, the greater the maximum number of join strategies that the optimizer will consider.
If the option is set to 0, then the SQL Anywhere optimizer chooses the first access plan it considers for
execution, in effect avoiding any cost-based comparison of alternative plans. In addition, with level 0 some
semantic optimizations of nested queries are disabled. If this option is set to a value higher than 0, the
optimizer evaluates alternative strategies and chooses the one with the lowest expected cost. If this option
is set to a value greater than the default (9), the optimizer is more aggressive in its search for alternative
strategies, possibly resulting in much higher elapsed time spent in the optimization phase.
In typical scenarios, this option is temporarily set to lower levels (0, 1, or 2) when the application desires
faster OPEN times for a DML statement, and it is known that although the statement may be complex, the
query's execution time is very small, and hence the specific access plan chosen by the optimizer is less
consequential. It is not recommended that the PUBLIC setting of optimization_level be changed from its
default.
The effect of setting the optimization_level option is independent of the settings of the optimization_goal
and optimization_workload options.
Simple DML statements (single-block, single-table queries that contain equality conditions in the WHERE
clause that uniquely identify a specific row) are optimized heuristically and bypass the cost-based optimizer
altogether. The optimization of simple DML statements is not affected by the setting of the
optimization_level option. The count of the number of requests optimized through the optimizer bypass
mechanism is available as the QueryBypassed connection property.
For more information about the QueryBypassed connection property, see “Connection-level
properties” on page 538.
You can override any temporary or public settings for this option within individual INSERT, UPDATE,
DELETE, SELECT, UNION, EXCEPT, and INTERSECT statements by including an OPTION clause in
the statement. See:
● “INSERT statement” [SQL Anywhere Server - SQL Reference]
● “UPDATE statement” [SQL Anywhere Server - SQL Reference]
● “DELETE statement” [SQL Anywhere Server - SQL Reference]
● “SELECT statement” [SQL Anywhere Server - SQL Reference]
● “UNION clause” [SQL Anywhere Server - SQL Reference]
● “EXCEPT clause” [SQL Anywhere Server - SQL Reference]
● “INTERSECT clause” [SQL Anywhere Server - SQL Reference]
Allowed values
Mixed, OLAP
Default
Mixed
Scope
Can be set for the PUBLIC group only. DBA authority required.
Remarks
The optimization_workload option controls whether SQL Anywhere optimizes queries for a workload that
is a mix of updates and reads or predominantly read only.
If the option is set to Mixed (the default), SQL Anywhere chooses query optimization algorithms appropriate
for a workload that is a mixture of short inserts, updates, and deletes and longer running read-only queries.
If the option is set to OLAP, SQL Anywhere chooses algorithms appropriate for a workload that consists
for the most part of long-running queries, combined with batch updates. In particular, the optimizer may
choose to use the Clustered Hash Group By query execution algorithm.
When the option is set to OLAP, the Clustered Hash Group By algorithm is enabled. If the option is set to
Mixed (the default), it is disabled.
You can override any temporary or public settings for this option within individual INSERT, UPDATE,
DELETE, SELECT, UNION, EXCEPT, and INTERSECT statements by including an OPTION clause in
the statement. See:
● “INSERT statement” [SQL Anywhere Server - SQL Reference]
● “UPDATE statement” [SQL Anywhere Server - SQL Reference]
● “DELETE statement” [SQL Anywhere Server - SQL Reference]
● “SELECT statement” [SQL Anywhere Server - SQL Reference]
● “UNION clause” [SQL Anywhere Server - SQL Reference]
● “EXCEPT clause” [SQL Anywhere Server - SQL Reference]
● “INTERSECT clause” [SQL Anywhere Server - SQL Reference]
See also
● “ClusteredHashGroupBy algorithm (GrByHClust)” [SQL Anywhere Server - SQL Usage]
Allowed values
Integer, between 0-100
Default
10
Scope
Can be set for the PUBLIC group only. DBA authority required.
Remarks
The database server uses pages of virtual memory for the data structures needed to implement cursors. These
pages are kept locked in memory between fetch requests so they are readily available when the next fetch
request arrives.
To prevent these pages from occupying too much of the cache in low memory environments, a limit is placed
on the percentage of the cache allowed to be used for pinning cursors. You can use the
pinned_cursor_percent_of_cache option to adjust this limit.
The option value is specified as a percentage from 0 to 100, with a default of 10. Setting the option to 0
means that cursor pages are not pinned between fetch requests.
Allowed values
String
Default
post_login_procedure system procedure
Scope
DBA authority required.
Remarks
When the post_login_procedure option is set to anything other than an empty string, applications can call
the procedure specified by the option as part of the connection process to determine what messages should
be displayed to the user, if any. The option values should be of the form owner.function-name to prevent a
user from overriding the function.
The SQL Anywhere plug-in for Sybase Central, Interactive SQL, and dbisqlc call the procedure if this option
is set and display any messages returned by the procedure in a window. Other applications that are not
included with SQL Anywhere should be modified to call the procedure given by this option and display
messages if you need this functionality.
One case where an application may need to display a message on connection is to notify the user that their
password is about to expire if a password expiry system is implemented. This functionality could be used
to notify the user each time they connect if their password will expire in the next few days, and before it
actually expires.
The procedure specified by this option must return a result set with one or more rows and two columns. The
first column of type VARCHAR(255) returns the text of the message, or NULL if there is no message. The
second column of type INT returns the action type. Allowed values for actions are:
● 0 Display the message (if any).
● 1 Display the message and prompt the user for a password change.
● 2-99 Reserved.
● 100 and greater User defined.
The SQL Anywhere plug-in, dbisql, and dbisqlc display all non-NULL messages, regardless of the action
value. If the action is set to 1, then the SQL Anywhere plug-in and dbisql (but not dbisqlc) prompt the user
to change the password, and then set the new password to the user-specified value.
For an example that uses post_login_procedure and includes advanced password rules and implementing
password expiration, see Using a password verification function.
See also
● “login_procedure option [database]” on page 483
● “Increasing password security” on page 952
Example
The following example uses a procedure named p_post_login_check that warns users that their password is
about to expire and then prompts them to change their password.
CREATE PROCEDURE DBA.p_post_login_check( )
RESULT( message_text VARCHAR(255), message_action INT )
BEGIN
DECLARE message_text CHAR(255);
DECLARE message_action INT;
Allowed values
Integer, between 1 and 127, inclusive
Default
30
Scope
Can be set for the PUBLIC group only. Takes effect immediately.
Remarks
Precision is the total number of digits to the left and right of the decimal point. The scale option specifies
the minimum number of digits after the decimal point when an arithmetic result is truncated to the maximum
precision.
Multiplication, division, addition, subtraction, and aggregate functions can all have results that exceed the
maximum precision.
For example, when a DECIMAL(8,2) is multiplied with a DECIMAL(9,2), the result could require a
DECIMAL(17,4). If precision is 15, only 15 digits will be kept in the result. If scale is 4, the result will be
a DECIMAL(15,4). If scale is 2, the result will be a DECIMAL(15,2). In both cases, there is a possibility
of overflow.
Allowed values
Off, Conditional, Always
Default
Conditional
Scope
Can be set for an individual connection or for the PUBLIC group. Takes effect immediately.
Remarks
This option controls whether rows are fetched to the client side in advance of being made available to the
client application. Fetching a number of rows at a time, even when the client application requests rows one
at a time (for example, when looping over the rows of a cursor) can cut down on response time and improve
overall throughput by cutting down the number of requests to the database.
● Off means no prefetching is done.
● Conditional (the default) causes prefetching to occur unless the cursor type is SENSITIVE or the query
includes a proxy table.
● Always means prefetching is done even for sensitive cursor types and cursors that involve a proxy table.
The Always value must be used with caution, as it affects some cursor semantics. For example, it causes the
sensitive cursor to become asensitive. Old values may be fetched if the value was updated between the
prefetch and the application's fetch request. In addition, using prefetch on a cursor that involves a proxy table
can cause the error -668, Cursor is restricted to FETCH NEXT operations, if the client attempts to re-fetch
prefetch rows. A client may attempt to re-fetch prefetch rows after a rollback or on a fetch relative 0, if a
fetch column is re-bound or bound for the first time after the first fetch, or in some cases when GET DATA
is used.
The value sensitive cursor types include the ESQL SENSITIVE and SCROLL cursor types, and the ODBC
and OLE DB DYNAMIC and KEYSET cursor types.
The setting of the prefetch option is ignored by Open Client and jConnect connections.
If the DisableMultiRowFetch connection parameter is set to YES, the prefetch database option is ignored
and no prefetching is done.
This option previously accepted the value On. This value is now an alias for Conditional.
See also
● “Prefetching rows” [SQL Anywhere Server - Programming]
● “DisableMultiRowFetch connection parameter [DMRF]” on page 263
Allowed values
On, Off
Default
On
Scope
Can be set for the PUBLIC group only. DBA authority required.
Remarks
When preserve_source_format is On, the database server saves the formatted source from CREATE and
ALTER statements on procedures, views, triggers, and events, and puts it in the appropriate system view's
source column.
Unformatted source text is stored in the same system tables, in the columns proc_defn, trigger_defn, and
view_defn. However, these definitions are not easy to read in Sybase Central. The formatted source column
allows you to view the definitions with the spacing, comments, and case that you want.
This option can be turned off to reduce space used to save object definitions in the database. The option can
be set only for the user PUBLIC.
Allowed values
On, Off
Default
On
Remarks
Setting this option to On disallows updates to the primary key columns of tables that are part of a publication.
This option helps ensure data integrity, especially in a replication and synchronization environment.
Caution
It is strongly recommended that you do not set this option to Off in a synchronization or replication
environment.
Allowed values
Critical, High, Above Normal, Normal, Below Normal, Low, Background
Default
Normal
Scope
Can be set for an individual connection or for the PUBLIC group. Takes effect immediately.
If you set this option temporarily, the setting applies to the current connection only. Different connections
under the same user ID can have different settings for this option.
Remarks
The value of this option cannot be set higher than the value of the max_priority option.
See also
● “max_priority option [database]” on page 488
Allowed values
On, Off
Default
On
Remarks
When qualification is not needed in SQL Anywhere installations, messages will be slightly smaller with this
option set to Off.
See also
● “SQL Remote options” [SQL Remote]
Allowed values
-1, 0, positive integer
Default
-1
Remarks
When this option is set to -1 (the default) or any value less than 0, the request waits for a memory grant for
up to 50 times the estimated execution time for the request. If this option is set to 0, the request waits forever
for memory to be granted. Otherwise, the value is the maximum time, in milliseconds, that a request waits
for a memory grant.
See also
● “The memory governor” [SQL Anywhere Server - SQL Usage]
Allowed values
On, Off
Default
Off
Remarks
When this option is Off, dbremote quotes identifiers that require quotes by SQL Anywhere (as it has always
done).
When the option is On, all identifiers are quoted.
See also
● “SQL Remote options” [SQL Remote]
Allowed values
On, Off
Default
On
Off for Open Client and jConnect connections
Remarks
This option controls whether strings that are enclosed in double quotes are interpreted as identifiers (On) or
as literal strings (Off). The quoted_identifier option is included for Transact-SQL compatibility.
See “Setting options for Transact-SQL compatibility” [SQL Anywhere Server - SQL Usage].
Allowed values
On, Off
Default
On
Remarks
If read_past_deleted is On (the default), sequential scans at isolation levels 1 and 2 skip uncommitted deleted
rows. If Off, sequential scans block on uncommitted deleted rows at isolation levels 1 and 2 (until the deleting
transaction commits or rolls back). This option changes server behavior at isolation levels 1 and 2.
For most purposes, this option should be left On. If set to Off, the blocking behavior depends on the plan
chosen by the optimizer (if there is an index that could possibly be used).
Allowed values
Integer, in minutes
Default
2
Scope
Can be set for the PUBLIC group only. DBA authority required. Takes effect when server is restarted.
Remarks
This option is used with the checkpoint_time option to decide when checkpoints should be done.
SQL Anywhere uses a heuristic to estimate the recovery time based on the operations that have been
performed since the last checkpoint, and the includes both the estimated recovery time and the estimated
checkpoint time for the database. Thus, the recovery time is not exact.
See also
● “The automatic recovery process” on page 871
● “checkpoint_time option [database]” on page 457
● “-gr server option” on page 184
● “How the database server decides when to checkpoint” on page 872
Allowed values
Integer, in seconds
Default
15
Remarks
This option affects web service client procedures and functions. If more time than the specified number of
seconds passes without activity, the procedure or function times out.
Allowed values
On, Off
Default
Off
Remarks
This option is only used by the SQL Anywhere Replication Agent. When it is set to On, the entire database
is set to act as a primary site in a Replication Server installation. All changes to the database are sent to
Replication Server by the Replication Agent.
See also
● “Replicating an entire database” on page 1042
Allowed values
Stored procedure name
Default
No procedure
Remarks
For SQL Remote, the replication_error option allows you to specify a stored procedure to be called by the
Message Agent when a SQL error occurs. By default, no procedure is called.
The procedure must have a single argument of type CHAR, VARCHAR, or LONG VARCHAR. The
procedure is called once with the SQL error message and once with the SQL statement that causes the error.
In some circumstances (such as foreign key violations), the SQL statement that caused the error is not
available, so the stored procedure can only be called once.
Although the option allows you to track and monitor SQL errors in replication, you must still design them
out of your setup; this option is not intended to resolve such errors.
See also
● “SQL Remote options” [SQL Remote]
● “replication_error_piece option [SQL Remote]” on page 511
Allowed values
Stored procedure name
Default
No procedure
Remarks
If an error occurs and replication_error is defined, then the replication_error procedure is called with the full
error string.
If replication_error and replication_error_piece are both defined, then the error is broken up into VARCHAR
pieces. replication_error is called with the first piece and replication_error_piece is called repeatedly with
the remaining pieces.
See also
● “replication_error option [SQL Remote]” on page 511
● “SQL Remote options” [SQL Remote]
Allowed values
Integer, 0 through 86400 (one day), in seconds
Default
0
Remarks
When this option is set to 0, requests do not time out.
Any request that takes longer than approximately request_timeout seconds (wall-clock time, not CPU time)
is interrupted and an error is returned to the user. The error returned is SQLE_REQUEST_TIMEOUT:
"Request interrupted due to timeout". If a request is blocked, and the blocking_timeout option is set to 0,
then the request can remain blocked for a maximum of request_timeout seconds before returning a blocking
error (for example, SQLE_LOCKED: "User '%1' has the row in '%2' locked").
User and public values 1 to 14 are not allowed. This prevents users from being locked out of the database
server if connecting takes a long time (for example, because of a complex login procedure).
This option can be used with both database client and HTTP/HTTPS requests. Note that setting the option
in a stored procedure or HTTP/HTTPS request has no effect on the current request since the option value at
the beginning of the request is used.
Setting the request_timeout public option should be done with caution as this can cause applications that
have long running requests (such as dbvalid, dbbackup, and dbunload) to fail. Also, applications that do not
use significant server resources, but that can block on another user can fail when request_timeout is set. One
way to address these types of problems is to set the request_timeout option only for certain applications in
the login procedure based on a connection's APPINFO value.
Setting this option may not prevent applications from using significant server resources if each request
evaluates quickly, for example when fetching a result set containing many rows.
See also
● “blocking_timeout option [database]” on page 456
● “AppInfo connection parameter [APP]” on page 249
Allowed values
On, Off
Default
Off
Scope
Can be set as a temporary option only, for the duration of the current connection.
Remarks
This option indicates whether date, time, and timestamp values are returned to applications as a date or time
data type or as a string.
When this option is set to On, the database server converts the date, time, or timestamp value to a string
before it is sent to the client to preserve the timestamp_format, date_format, or time_format option setting.
Sybase Central and Interactive SQL automatically turn the return_date_time_as_string option On.
See also
● “date_format option [compatibility]” on page 466
● “time_format option [compatibility]” on page 524
● “timestamp_format option [compatibility]” on page 526
rollback_on_deadlock [database]
Controls how transactions are treated when a deadlock occurs.
Allowed values
On, Off
Default
On
Scope
Can be set by any user and can be set for the PUBLIC group, as well as individual connections. Takes effect
immediately.
Remarks
When this option is set to On, a transaction is automatically rolled back if it encounters a deadlock. The
rollback happens after the current request completes. If this option is set to Off, SQL Anywhere automatically
rolls back the statement that encountered the deadlock, and returns an error to that transaction indicating
which form of deadlock occurred. Note that rolling back the statement likely would not release any of the
locks acquired by the statement.
For more information about deadlocks, see “Deadlock” [SQL Anywhere Server - SQL Usage].
Allowed values
On, Off
Default
Off
Scope
Can be set for an individual connection or for the PUBLIC group. Takes effect immediately.
Remarks
If this option is set to Off, the row count is usually only an estimate. If this option is set to On, the row count
is always accurate.
Caution
When row_counts is set to On, it may take significantly longer to execute queries. In fact, it will usually
cause SQL Anywhere to execute the query twice, doubling the execution time.
Allowed values
On, Off
Default
On
Remarks
If you are storing the message link parameters externally, rather than in the database, you may not want to
save the passwords. You can prevent the passwords from being saved by setting this option to Off.
See also
● “SQL Remote options” [SQL Remote]
Allowed values
Integer, between 0 and 127, inclusive, and less than the value specified for the precision database option
Default
6
Scope
Can be set for the PUBLIC group only. Takes effect immediately.
Remarks
Multiplication, division, addition, subtraction, and aggregate functions can all have results that exceed the
maximum precision.
See also
● “precision option [database]” on page 504
secure_feature_key [database]
Allows you to enable features for the connection that were secured using the database server -sf option.
Allowed values
String
Default
NULL
Scope
Can be set as a temporary option only, for the duration of the current connection.
Remarks
You can specify features that cannot be used by databases running on a server by including the -sf option
when you start the database server. The -sk server option lets you specify a key that can be used to re-enable
all secured (disabled) features for a connection and gives that connection authority to change the features
that are secured for all databases running on the database server. When you set the value of the
secure_feature_key temporary option to the value specified by -sk when the database server was started,
then all features are re-enabled for that database connection, and on that connection you can use the
sa_server_option system procedure to control access to database features.
If the secure_feature_key option is set to any value other than the one specified by -sk, no error is given, and
the features specified by -sf remain disabled for the connection.
See also
● “-sk server option” on page 211
● “-sf server option” on page 207
● “sa_server_option system procedure” [SQL Anywhere Server - SQL Reference]
● “Specifying secured features” on page 956
Example
The following command starts a database server named secure_server with access to the request log and all
remote data access features disabled. The key specified by the -sk option can be used later to enable these
features for a specific database connection.
dbsrv11 -n secure_server -sf request_log,remote -sk j978kls12 testdb.db
Setting the secure_feature_key option to the value specified by -sk for a database running on the
secure_server database server enables access to the request log and remote data access features for that
connection:
SET TEMPORARY OPTION secure_feature_key = 'j978kls12';
Allowed values
Internal, collation_name, or collation_id
Default
Internal
Remarks
When the value of this option is Internal, the ORDER BY clause remains unchanged.
When the value of this option is set to a valid collation name or collation ID, CHAR or NCHAR string
expressions in the ORDER BY clause are treated as if the SORTKEY function had been invoked. String
expressions that use other string data types, such as BINARY, UUID, XML, or VARBIT are not modified.
See also
● “SORTKEY function [String]” [SQL Anywhere Server - SQL Reference]
Example
Set the sort collation to binary:
SET TEMPORARY OPTION sort_collation='binary';
Having the sort collation set to binary transforms the following queries:
SELECT Name, ID
FROM Products
ORDER BY Name, ID;
SELECT name, ID
FROM Products
ORDER BY 1, 2;
SELECT Name, ID
FROM Products
ORDER BY SORTKEY(Name, 'binary'), ID;
Allowed values
● Off
● SQL:1992/Entry
● SQL:1992/Intermediate
● SQL:1992/Full
● SQL:1999/Core
● SQL:1999/Package
● SQL:2003/Core
● SQL:2003/Package
● Ultralite
Default
Off
Remarks
This option flags as an error any SQL that is not part of the specified standard. For example, specifying SQL:
2003/Package causes the database server to flag syntax that is not full SQL/2003 syntax.
The default behavior, Off, turns error flagging off.
For compatibility with previous SQL Anywhere versions, the following values are also accepted, and are
mapped as specified below:
● E This option corresponds to SQL:1992/Entry.
● I This option corresponds to SQL:1992/Intermediate.
● F This option corresponds to SQL:1992/Full.
● W This option corresponds with Off.
See also
● “sa_ansi_standard_packages system procedure” [SQL Anywhere Server - SQL Reference]
Allowed values
● Off
● SQL:1992/Entry
● SQL:1992/Intermediate
● SQL:1992/Full
● SQL:1999/Core
● SQL:1999/Package
● SQL:2003/Core
● SQL:2003/Package
● Ultralite
Default
Off
Remarks
This option flags any SQL that is not part of a specified standard as a warning. For example, specifying SQL:
2003/Package causes the database server to flag syntax that is not full SQL/2003 syntax.
The default behavior, Off, turns warning flagging off.
For compatibility with previous versions, the following values are also accepted, and are mapped as specified
below:
● E This option corresponds to SQL:1992/Entry.
● I This option corresponds to SQL:1992/Intermediate.
● F This option corresponds to SQL:1992/Full.
● W This option corresponds to Off.
See also
● “sa_ansi_standard_packages system procedure” [SQL Anywhere Server - SQL Reference]
● “SQLFLAGGER function [Miscellaneous]” [SQL Anywhere Server - SQL Reference]
● “sql_flagger_error_level option [compatibility]” on page 517
● “SQL preprocessor” [SQL Anywhere Server - Programming]
Allowed values
String (composed of the symbols listed below)
Default
YYYY/MM/DD
Remarks
The Message Agent uses this option when replicating columns that store a date. The format is a string using
the following symbols:
Symbol Description
MMM[m...] Character short form for months—as many characters as there are "m"s
Each symbol is substituted with the appropriate data for the date that is being formatted.
For symbols that represent character data (such as MMM), you can control the case of the output as follows:
● Type the symbol in all uppercase to have the format appear in all uppercase. For example, MMM produces
JAN.
● Type the symbol in all lowercase to have the format appear in all lowercase. For example, mmm produces
jan.
● Type the symbol in mixed case to have SQL Anywhere choose the appropriate case for the language that
is being used. For example, in English, typing Mmm produces May, while in French it produces mai.
If the character data is multibyte, the length of each symbol reflects the number of characters, not the number
of bytes. For example, the 'mmm' symbol specifies a length of three characters for the month.
For symbols that represent numeric data, you can control zero-padding with the case of the symbols:
The option is a string build from the following symbols:
● Type the symbol in same-case (such as MM or mm) to allow zero padding. For example, yyyy/mm/dd
could produce 2002/01/01.
● Type the symbol in mixed case (such as Mm) to suppress zero padding. For example, yyyy/Mm/Dd could
produce 2002/1/1.
See also
● “sr_time_format option [SQL Remote]” on page 520
● “sr_timestamp_format [SQL Remote]” on page 520
● “SQL Remote options” [SQL Remote]
Allowed values
String (composed of the symbols listed below)
Default
HH:NN:SS.SSSSS
Remarks
The Message Agent uses this option when replicating columns that store a time. The format is a string using
the following symbols:
Symbol Description
SS.ssssss Seconds and fractions of a second, up to six decimal places. Not all
platforms support timestamps to a precision of six places.
Each symbol is substituted with the appropriate data for the time that is being formatted. Any format symbol
that represents character rather than digit output can be put in uppercase, which causes the substituted
characters to also be in uppercase. For numbers, using mixed case in the format string suppresses leading
zeros.
Remarks
Using mixed case in the formatting string suppresses leading zeroes.
See also
● “sr_date_format option [SQL Remote]” on page 518
● “sr_timestamp_format [SQL Remote]” on page 520
● “SQL Remote options” [SQL Remote]
Allowed values
The format strings are taken from the sr_date_format option combined with sr_time_format option settings.
Default
yyyy/mm/dd hh:nn:ss.Ssssss
Remarks
The Message Agent replicates datetime information using this option. The default setting is the
sr_date_format option setting combined with the sr_time_format option setting.
See also
● “sr_date_format option [SQL Remote]” on page 518
● “sr_time_format option [SQL Remote]” on page 520
● “SQL Remote options” [SQL Remote]
Allowed values
On, Off
Default
On
Remarks
If the truncated characters consist only of spaces, no exception is raised. The setting of On corresponds to
ANSI/ISO SQL/2003 behavior. When this option is set to Off, the exception is not raised and the character
string is silently truncated.
String truncation may occur in several places. For example, using INSERT, UPDATE, CAST, or assignment
to a variable may truncate a string if the declared destination type is too short.
See also
● “Character data types” [SQL Anywhere Server - SQL Reference]
Allowed values
On, Off
Default
On
Remarks
When the option is set to On, operations from remote databases on rows with a SUBSCRIBE BY value that
is NULL or an empty string assume that the remote user is subscribed to the row. When it is set to Off, the
remote user is assumed not to be subscribed to the row.
The only limitation of this option is that it will lead to errors if a remote user really does want to INSERT
(or UPDATE) a row with a NULL or empty subscription expression (for information held only at the
consolidated database). This is reasonably obscure and can be worked around by assigning a subscription
value in your installation that belongs to no remote user.
See also
● “SQL Remote options” [SQL Remote]
● “Using the subscribe_by_remote option with many-to-many relationships” [SQL Remote]
Allowed values
On, Off
Default
On
Remarks
If the subsume_row_locks option is On (the default) then whenever a table t is locked exclusively with LOCK
TABLE t IN EXCLUSIVE MODE, the database server no longer acquires individual row locks for t.
This can result in a significant performance improvement if extensive updates are made to t in a single
transaction, especially if t is large relative to cache size. It also allows for atomic update operations that are
larger than the lock table can currently handle (approximately 2-4 million rows).
When this option is On, keyset cursors over a table locked in this fashion will return row changed warnings
for every row in the cursor, if any row in the database has been modified. Note that the database server could
turn an updatable cursor with an ORDER BY into a keyset cursor as a result.
Allowed values
On, Off
Default
Off
Remarks
When the database server is started with the -z option, debugging information appears in the database server
messages window, including debugging information about the TDS protocol.
The suppress_tds_debugging option restricts the debugging information about TDS that appears in the
database server messages window. When this option is set to Off (the default) TDS debugging information
appears in the database server messages window.
Allowed values
On, Off
Default
Off
Remarks
The synchronize_mirror_on_commit option allows fine-grained control over when database changes are
assured to have been sent to a mirror server when running in asynchronous or asyncfullpage mode. The
option is Off by default. When set to On, each COMMIT causes any changes recorded in the transaction log
to be sent to the mirror server, and an acknowledgement to be sent by the mirror server to the primary server
once the changes are received by the mirror server. The option can be set for specific transactions using SET
TEMPORARY OPTION. It may also be useful to set the option for specific applications by examining the
APPINFO string in a login procedure. This allows mirroring behavior to be tailored to meet the needs of
different applications.
See also
● “Introduction to database mirroring” on page 914
Allowed values
On, Off
Default
Off
Remarks
By default, this option is set to Off and empty strings are returned as a string containing one blank character
for TDS connections. When this option is set to On, empty strings are returned as NULL strings for TDS
connections. Non-TDS connections distinguish empty strings from NULL strings.
Allowed values
On, Off
Default
On
Scope
Can be set for the PUBLIC group only. DBA authority required.
Remarks
When temp_space_limit_check is set to On (the default), if a connection requests more than its quota of
temporary file space, then the request fails and the error SQLSTATE_TEMP_SPACE_LIMIT is returned.
When this option is set to Off, the database server does not check the amount of temporary file space used
by a connection. If a connection requests more than its quota of temporary space when this option is set to
Off, a fatal error can occur.
The temporary file space quota for a connection is the minimum of the following two thresholds:
1. the maximum amount of temporary file space permitted for each connection as specified by the setting
of the max_temp_space option
2. the maximum potential size of the temporary file divided by the number of connections
This threshold is used only if the temporary file has grown to 80% or more of its maximum size, which is
determined by the amount of free space remaining on the device as reported by the operating system. When
a connection requests more temporary file space than the quota allows, that connection's current request fail
with SQLSTATE 54W05 (TEMP_SPACE_LIMIT).
You can specify a hard limit on the amount of temporary file space used by a connection with the
max_temp_space option.
See also
● “sa_disk_free_space system procedure” [SQL Anywhere Server - SQL Reference]
● “max_temp_space option [database]” on page 492
Allowed values
String (composed of the symbols listed below)
Default
HH:NN:SS.sss
Scope
Can be set for an individual connection or for the PUBLIC group. Takes effect immediately.
Remarks
The format is a string using the following symbols:
Symbol Description
SS.ssssss Seconds and fractions of a second, up to six decimal places. Not all
platforms support timestamps to a precision of six places.
Each symbol is substituted with the appropriate data for the time that is being formatted. Any format symbol
that represents character rather than digit output can be put in uppercase, which causes the substituted
characters to also be in uppercase. For numbers, using mixed case in the format string suppresses leading
zeros.
See also
● “date_format option [compatibility]” on page 466
● “timestamp_format option [compatibility]” on page 526
Allowed values
Integer (for example, 300)
Negative integer enclosed in quotation marks (for example, '-300')
String representing a time in hours and minutes, preceded by + or - and enclosed in quotation marks (for
example, '+5:00', or '-5:00')
Default
If the client is connecting via embedded SQL, ODBC, OLE DB, ADO, or ADO.NET, the default value is
set according to the client's time zone. If the client is connecting via jConnect or Open Client, the default is
based on the database server's time zone.
Remarks
The time_zone_adjustment option value is the same value as that returned by SELECT
CONNECTION_PROPERTY( 'TimeZoneAdjustment' );. The value represents the number of
minutes that must be added to the Coordinated Universal Time (UTC) to display time local to the connection.
See also
● TimeZoneAdjustment property: “Connection-level properties” on page 538
Allowed values
String (composed of the symbols listed below)
Default
YYYY-MM-DD HH:NN:SS.SSS
For Open Client and JDBC connections the default is set to YYYY-MM-DD HH:NN:SS.SSS
Scope
Can be set for an individual connection or for the PUBLIC group. Takes effect immediately.
Remarks
The format is a string using the following symbols:
Symbol Description
MMM[m...] Character short form for months—as many characters as there are "m"s
Symbol Description
SS.ssssss Seconds and fractions of a second, up to six decimal places. Not all
platforms support timestamps to a precision of six places.
Each symbol is substituted with the appropriate data for the date that is being formatted.
For symbols that represent character data (such as MMM), you can control the case of the output as follows:
● Type the symbol in all uppercase to have the format appear in all uppercase. For example, MMM produces
JAN.
● Type the symbol in all lowercase to have the format appear in all lowercase. For example, mmm produces
jan.
● Type the symbol in mixed case to have SQL Anywhere choose the appropriate case for the language that
is being used. For example, in English, typing Mmm produces May, while in French it produces mai.
If the character data is multibyte, the length of each symbol reflects the number of characters, not the number
of bytes. For example, the 'mmm' symbol specifies a length of three characters for the month.
For symbols that represent numeric data, you can control zero-padding with the case of the symbols:
● Type the symbol in same-case (such as MM or mm) to allow zero padding. For example, yyyy/mm/dd
could produce 2002/01/01.
● Type the symbol in mixed case (such as Mm) to suppress zero padding. For example, yyyy/Mm/Dd could
produce 2002/1/1.
See also
● “date_format option [compatibility]” on page 466
● “time_format option [compatibility]” on page 524
Allowed values
On, Off
Default
Off
Scope
Can be set for the PUBLIC group only. DBA authority required. This option should not be enabled for
databases already containing timestamp data.
Remarks
A TIMESTAMP value is precise to six decimal places in SQL Anywhere. However, to maintain
compatibility with other software, which may truncate the TIMESTAMP value to three decimal places, you
can set the truncate_timestamp_values option to On to limit the number of decimal places SQL Anywhere
stores. The default_timestamp_increment option determines the number of decimal places to which the
TIMESTAMP value is truncated.
For MobiLink synchronization, if you are going to set this option, it must be set prior to performing the first
synchronization.
If the database server finds TIMESTAMP values with a higher resolution than that specified by the
combination of truncate_timestamp_values and default_timestamp_increment, an error is reported.
In most cases, unloading the database and then reloading it into a new database in which the
truncate_timestamp_values and default_timestamp_increment values have been set is the easiest solution to
ensure the proper TIMESTAMP values are used. However, depending on the type of TIMESTAMP columns
in your table, you can also do the following:
● If the TIMESTAMP columns are defined with DEFAULT TIMESTAMP or DEFAULT UTC
TIMESTAMP (so that the value is automatically updated by the database server when the row is
modified), you must delete all the rows in the table before the truncate_timestamp_values option is
changed. You can delete the rows using the DELETE or TRUNCATE TABLE statement.
● If the TIMESTAMP column is defined with a value other than DEFAULT TIMESTAMP or DEFAULT
UTC TIMESTAMP, you can execute an UPDATE statement that casts the values to a string and then
back to a TIMESTAMP. For example,
UPDATE T
SET ts = CAST( DATEFORMAT( ts, 'yyyy/mm/dd hh:nn:ss.ss' )
AS TIMESTAMP );
Note that this process may lose more precision than is necessary. The format string to use depends on
the number of digits of precision to be kept.
See also
● “default_timestamp_increment option [database] [MobiLink client]” on page 470
Example
Setting the default_timestamp_increment option to 100000 causes truncation after the first decimal place in
the seconds component, allowing a value such as '2000/12/05 10:50:53:700' to be stored.
Allowed values
On, Off
Default
Off
Remarks
Support for Transact-SQL outer joins is deprecated. Setting this option to On allows you to use Transact-
SQL outer joins.
Allowed values
On, Off
Default
Off
On for Open Client and jConnect connections
Remarks
When this option is set to On, you can use the @ sign instead of the colon as a prefix for host variable names
in embedded SQL. This is implemented primarily for Transact-SQL compatibility.
Allowed values
0, 1, 2, 3
Default
0
Remarks
The isolation level specified by the updatable_statement_isolation option is used by updatable statements
when the isolation_level option is set to readonly-statement-snapshot. The following values are accepted:
● 0 Allow dirty reads, non-repeatable reads, and phantom rows.
● 1 Prevent dirty reads. Allow non-repeatable reads and phantom rows.
● 2 Prevent dirty reads and non-repeatable reads. Allow phantom rows.
See also
● “isolation_level option [compatibility]” on page 478
● “Snapshot isolation” [SQL Anywhere Server - SQL Usage]
● “Isolation levels and consistency” [SQL Anywhere Server - SQL Usage]
● “Choosing isolation levels” [SQL Anywhere Server - SQL Usage]
Allowed values
On, Off
Default
On
Remarks
The database server collects statistics during normal query execution and uses the gathered statistics to self-
tune the column statistics. You can set the update_statistics option Off to disable the gathering of statistics
during query execution.
Under normal circumstances, it should not be necessary to turn this option off.
The update_statistics option does not affect changes to statistics as a result of updates to data (LOAD/
INSERT/UPDATE/DELETE). To control whether statistics are updated based on these statements, use the
collect_statistics_on_dml_updates database option.
The difference between the collect_statistics_on_dml_updates option and the update_statistics option is that
the update_statistics option compares the actual number of rows that satisfy a predicate with the number of
rows that are estimated to satisfy the predicate, and then updates the estimates accordingly. The
collect_statistics_on_dml_updates option modifies the column statistics based on the values of the specific
rows that are inserted, updated, or deleted.
See also
● “collect_statistics_on_dml_updates option [database]” on page 459
● “Updating column statistics” [SQL Anywhere Server - SQL Usage]
Allowed values
Enabled, Disabled, Override-Magic
Default
Override-Magic
Scope
Can be set for an individual connection or for the PUBLIC group. Takes effect immediately.
Remarks
SQL Anywhere allows you to specify user selectivity estimates can improve the optimizer's performance
when the database server is unable to accurately predict the selectivity of a predicate. However, user
selectivity estimates should be used only in appropriate circumstances. For example, it may be useful to
supply a selectivity estimate for a predicate that involves one or more functions if the Override-Magic
selectivity estimate used by the optimizer is significantly different from the actual selectivity.
If you have used selectivity estimates that are inaccurate as a workaround to performance problems where
the software-selected access plan was poor, it is recommended that you set this option to Disabled. The
database server may not select an optimal plan if you use inaccurate estimates.
For more information about user selectivity estimates, see “Explicit selectivity estimates” [SQL Anywhere
Server - SQL Reference].
When a user selectivity estimate is supplied with a predicate, the estimate is respected or ignored based on
the setting of this option. The following values are accepted:
● Enabled All user-supplied selectivity estimates are respected. You can also use On to turn on this
option.
● Override-Magic A user selectivity estimate is respected and used only if the optimizer would
otherwise choose to use its last-resort, heuristic value (also called the magic value).
● Disabled All user estimates are ignored and magic values are used when no other estimate data is
available. You can also use Off to turn off this option.
You can override any temporary or public settings for this option within individual INSERT, UPDATE,
DELETE, SELECT, UNION, EXCEPT, and INTERSECT statements by including an OPTION clause in
the statement. See:
● “INSERT statement” [SQL Anywhere Server - SQL Reference]
● “UPDATE statement” [SQL Anywhere Server - SQL Reference]
● “DELETE statement” [SQL Anywhere Server - SQL Reference]
● “SELECT statement” [SQL Anywhere Server - SQL Reference]
● “UNION clause” [SQL Anywhere Server - SQL Reference]
● “EXCEPT clause” [SQL Anywhere Server - SQL Reference]
● “INTERSECT clause” [SQL Anywhere Server - SQL Reference]
Allowed values
On, Off
Default
Off
Remarks
This option is used by SQL Remote only. When it is set to On, messages that contain updates published by
the local database are sent with all column values included, and a conflict in any column triggers a RESOLVE
UPDATE trigger at the subscriber database.
Example
The following statement sets the verify_all_columns option to Off in SQL Anywhere, for all users:
SET OPTION PUBLIC.verify_all_columns = 'Off';
See also
● “SQL Remote options” [SQL Remote]
Allowed values
String
Default
Empty string (no function is called when a password is set).
Scope
DBA authority required.
Remarks
The function specified by the verify_password_function is called automatically when a non-NULL password
is created or set. To prevent a user from overriding the function, set the option value to owner.function-
name. A user must have a password to be able to connect to the database. Passwords are case sensitive and
they cannot:
● begin with white space, single quotes, or double quotes
● end with white space
● contain semicolons
● be longer than 255 bytes in length
When passwords are created or changed, they are converted to UTF-8 before being hashed and stored in the
database. If the database is unloaded and reloaded into a database with a different character set, existing
passwords continue to work. If the database server cannot convert from the client's character set to UTF-8,
then it is recommended that the password be composed of 7-bit ASCII characters as other characters may
not work correctly.
You can use any of the following statements to set a password:
● CREATE USER
● ALTER USER
● GRANT
After validating the statement used to create or set the password, the function is called to verify the password
using the specified rules. If the password conforms to the specified rules, the function must return NULL to
indicate success, and the invoking statement executes. Otherwise, an error is indicated by setting an error or
returning a non-NULL string. If a non-NULL string is returned, it is included in the error to the user as the
reason for failure.
The password verification function takes two parameters: user-name VARCHAR(128) and new-pwd
VARCHAR(255). It returns a value of type VARCHAR(255). It is recommended that you execute an ALTER
FUNCTION function-name SET HIDDEN statement on the password verification function to ensure that it
cannot be stepped through using the debugger. If the verify_password_function option is set, specifying
more than one user ID and password with a GRANT CONNECT statement is not allowed.
For more information about password rules, see “Use password verification” on page 953.
See also
● “min_password_length option [database]” on page 493
● “CREATE USER statement” [SQL Anywhere Server - SQL Reference]
● “CREATE FUNCTION statement” [SQL Anywhere Server - SQL Reference]
● “ALTER FUNCTION statement” [SQL Anywhere Server - SQL Reference]
● “ALTER USER statement” [SQL Anywhere Server - SQL Reference]
● “GRANT statement” [SQL Anywhere Server - SQL Reference]
● “Increasing password security” on page 952
● “NewPassword connection parameter [NEWPWD]” on page 275
Example
The following example defines a table and a function and sets some login policy options. Together they
implement advanced password rules that include requiring certain types of characters in the password,
disallowing password reuse, and expiring passwords. The function is called by the database server with the
verify_password_function option when a user ID is created or a password is changed. The application can
call the procedure specified by the post_login_procedure option to report that the password should be
changed before it expires.
The code for this sample is also available in the following location: samples-dir\SQLAnywhere\SQL
\verify_password.sql. (For information about samples-dir, see “Samples directory” on page 336.)
-- only DBA should have permissions on this table
CREATE TABLE DBA.t_pwd_history(
pk INT DEFAULT AUTOINCREMENT PRIMARY KEY,
user_name CHAR(128), -- the user whose password is set
pwd_hash CHAR(32) ); -- hash of password value to detect
-- duplicate passwords
RETURN( NULL );
END;
Allowed values
Integer, in bytes
Default
1000
Remarks
This option is used by SQL Remote only. If the data type of a column is longer than the threshold, old values
for the column are not verified when an UPDATE is replicated. This keeps the size of SQL Remote messages
down, but has the disadvantage that conflicting updates of long values are not detected.
See also
● “SQL Remote options” [SQL Remote]
Allowed values
On, Off
Default
Off
Scope
Can be set for an individual connection or for the PUBLIC group. Takes effect immediately.
Remarks
If this option is set to On, the database does not check foreign key integrity until the next COMMIT statement.
Otherwise, all foreign keys that are not created with the check_on_commit option are checked as they are
inserted, updated or deleted.
Allowed values
NULL or hostname-string
Default
NULL
Scope
Can be set for the PUBLIC group only. Takes effect immediately. DBA authority required.
Remarks
Webservices Description Language Documents (WSDLs) are exported by DISH services. These are XML
documents that contain descriptions of the available SOAP services. The URL of the targetNameSpace and
the soapAction operations within this XML document contain a hostname. When this option is set to NULL,
the default value, the hostname is that of the computer on which the database server is running. If this option
is set to a string value, the string is used as the hostname instead. This option is intended for use when
developing web service client applications that will, when deployed, target a host other than the one used
for development.
Database properties
Contents
Understanding database properties .......................................................................... 538
Accessing properties
Each type of property can be accessed by supplying its name as an argument to a system function.
To access connection properties
● Use the CONNECTION_PROPERTY system function: the following statement returns the number of
pages that have been read from file by the current connection.
SELECT CONNECTION_PROPERTY ( 'DiskRead' );
See also
● “CONNECTION_PROPERTY function [System]” [SQL Anywhere Server - SQL Reference]
● “DB_PROPERTY function [System]” [SQL Anywhere Server - SQL Reference]
● “PROPERTY function [System]” [SQL Anywhere Server - SQL Reference]
Connection-level properties
The following table lists properties available for each connection.
Examples
To retrieve the value of a connection property
● Use the CONNECTION_PROPERTY system function. The following statement returns the number of
pages that have been read from file by the current connection.
SELECT CONNECTION_PROPERTY ( 'DiskRead' );
See also
● “CONNECTION_PROPERTY function [System]” [SQL Anywhere Server - SQL Reference]
● “sa_conn_activity system procedure” [SQL Anywhere Server - SQL Reference]
● “Server-level properties” on page 561
● “Database-level properties” on page 574
Descriptions
Property Description
ansi_update_constraints Returns a value indicating the range of updates that are permit-
ted. See “ansi_update_constraints option [compatibili-
ty]” on page 452.
ansinull Returns a value that indicates how NULL values are interpreted.
See “ansinull option [compatibility]” on page 453.
Property Description
AppInfo Returns information about the client that made the connection.
For HTTP connections, this includes information about the
browser. For connections using older versions of jConnect or
Open Client, the information may be incomplete.
The API value can be DBLIB, ODBC, OLEDB, ADO.NET, iA-
nywhereJDBC, PHP, PerlDBD, or DBEXPRESS.
For more information about the values returned for other types
of connections, see “AppInfo connection parameter
[APP]” on page 249.
auditing_options This property is reserved for system use. Do not change the set-
ting of this option.
Property Description
BytesReceivedUncomp Returns the number of bytes that would have been received dur-
ing client/server communications if compression was disabled.
This value is the same as the value for BytesReceived if com-
pression is disabled.
BytesSentUncomp Returns the number of bytes that would have been sent during
client/server communications if compression was disabled. This
value is the same as the value for BytesSent if compression is
disabled.
CacheRead Returns the number of database pages that have been looked up
in the cache.
CacheReadIndInt Returns the number of index internal-node pages that have been
read from the cache.
CacheReadIndLeaf Returns the number of index leaf pages that have been read from
the cache.
CacheReadTable Returns the number of table pages that have been read from the
cache.
CarverHeapPages Returns the number of heap pages used for short-term purposes
such as query optimization.
Property Description
checkpoint_time Returns the maximum time, in minutes, that the database server
runs without doing a checkpoint. See “checkpoint_time option
[database]” on page 457.
cis_rowset_size Returns the number of rows that are returned from remote servers
for each fetch. See “cis_rowset_size option [data-
base]” on page 458.
ClientStmtCacheHits Returns the number of prepares that were not required for this
connection because of the client statement cache. This is the
number of additional prepares that would be required if client
statement caching was disabled. See “max_client_state-
ments_cached option [database]” on page 486.
Property Description
Commit Returns the number of Commit requests that have been handled.
CommLink Returns the communication link for the connection. This is one
of the network protocols supported by SQL Anywhere, or local
for a same-computer connection.
CommNetworkLink Returns the communication link for the connection. This is one
of the network protocols supported by SQL Anywhere. Values
include SharedMemory and TCPIP. The CommNetworkLink
property always returns the name of the link, regardless of
whether it is same-computer or not.
CommProtocol Returns TDS for Open Client and jConnect connections, HTTP
for HTTP connections, and CmdSeq for ODBC, embedded SQL,
OLE DB, ADO.NET, and iAnywhere JDBC driver connections.
cooperative_commit_timeout Returns the time, in milliseconds, that the database server waits
for other connections to fill a page of the log before writing to
disk. See “cooperative_commit_timeout option [data-
base]” on page 463.
Property Description
Cursor Returns the number of declared cursors that are currently being
maintained by the server.
CursorOpen Returns the number of open cursors that are currently being
maintained by the server.
date_format Returns a string indicating the format for dates retrieved from
the database. See “date_format option [compatibili-
ty]” on page 466.
Property Description
delayed_commit_timeout Returns the time, in milliseconds, that the database server waits
to return control to an application following a COMMIT. See
“delayed_commit_timeout option [database]” on page 470.
DiskRead Returns the number of pages that have been read from disk.
DiskReadIndInt Returns the number of index internal-node pages that have been
read from disk.
DiskReadIndLeaf Returns the number of index leaf pages that have been read from
disk.
DiskReadTable Returns the number of table pages that have been read from disk.
DiskWaitRead Returns the number of times the database server waited for an
asynchronous read.
DiskWaitWrite Returns the number of times the database server waited for an
asynchronous write.
DiskWrite Returns the number of modified pages that have been written to
disk.
Property Description
escape_character This property is reserved for system use. Do not change the set-
ting of this option.
exclude_operators This property is reserved for system use. Do not change the set-
ting of this option.
ExprCacheAbandons Returns the number of times that the expression cache was aban-
doned because the hit rate was too low.
ExprCacheDropsToReadOnly Returns the number of times that the expression cache dropped
to read-only status because the hit rate was low.
ExprCacheInserts Returns the number of values inserted into the expression cache.
ExprCacheResumesOfReadWrite Returns the number of times that the expression cache resumed
read-write status because the hit rate increased.
ExprCacheStarts Returns the number of times that the expression cache was star-
ted.
first_day_of_week Returns the number that is used for the first day of the week,
where 7=Sunday and 1=Monday. See “first_day_of_week op-
tion [database]” on page 474.
Property Description
for_xml_null_treatment Returns Omit if elements and attributes that contain NULL val-
ues are omitted from the result and Empty if empty elements or
attributes are generated for NULL values when the FOR XML
clause is used in a query. See “for_xml_null_treatment option
[database]” on page 475.
force_view_creation This property is reserved for system use. Do not change the set-
ting of this option.
global_database_id Returns the starting value used for columns created with DE-
FAULT GLOBAL AUTOINCREMENT. See “global_data-
base_id option [database]” on page 476.
HashForcedPartitions Returns the number of times that a hash operator was forced to
partition because of competition for memory.
HashWorkTables Returns the number of work tables created for hash-based oper-
ations.
HeapsCarver Returns the number of heaps used for short-term purposes such
as query optimization..
HeapsQuery Returns the number of heaps used for query processing (hash and
sort operations).
Property Description
HttpServiceName Returns the service name origin for a web application. The prop-
erty is useful for error reporting and control flow. An empty
string is returned when this property is selected from a stored
procedure that did not originate from an HTTP request or if the
connection is currently inactive waiting to continue an HTTP
session.
IdleTimeout Returns the idle timeout value of the connection. See “Idle con-
nection parameter” on page 269.
IndAdd Returns the number of entries that have been added to indexes.
IndLookup Returns the number of entries that have been looked up in in-
dexes.
integrated_server_name Returns the name of the Domain Controller server used for look-
ing up Windows user group membership for integrated logins.
See “integrated_server_name option [database]” on page 477.
java_location Returns the path of the Java VM for the database if one has been
specified. See “java_location option [database]” on page 479.
java_main_userid Returns the name of the database user whose connection can be
used for installing classes and other Java-related administrative
tasks. See “java_main_userid option [database]” on page 480.
java_vm_options Returns the command line options that the database server uses
when it launches the Java VM. See “java_vm_options option
[database]” on page 480.
LastPlanText Returns the long text plan of the last query executed on the con-
nection. You control the remembering of the last plan by setting
using the RememberLastPlan option of the sa_server_option
system procedure, or using the -zp server option. See “-zp server
option” on page 231.
LastReqTime Returns the time at which the last request for the specified con-
nection started.
Property Description
LastStatement Returns the most recently prepared SQL statement for the current
connection. See “-zl server option” on page 228.
The LastStatement value is set when a statement is prepared, and
is cleared when a statement is dropped. Only one statement string
is remembered for each connection.
If sa_conn_activity reports a non-empty value for a connection,
it is most likely the statement that the connection is currently
executing. If the statement had completed, it would likely have
been dropped and the property value would have been cleared.
If an application prepares multiple statements and retains their
statement handles, the LastStatement value does not reflect what
a connection is currently doing.
When client statement caching is enabled, and a cached state-
ment is reused, this property returns an empty string.
LivenessTimeout Returns the liveness timeout period for the current connection.
See “LivenessTimeout connection parameter
[LTO]” on page 273.
lock_rejected_rows This property is reserved for system use. Do not change the set-
ting of this option.
LockName Returns a 64-bit unsigned integer value representing the lock for
which a connection is waiting.
Property Description
LogFreeCommit Returns the number of redo free commits. A redo free commit
occurs when a commit of the transaction log is requested but the
log has already been written (so the commit was done for free.)
login_procedure Returns the name of the stored procedure used to set compati-
bility options at startup. See “login_procedure option [data-
base]” on page 483.
LoginTime Returns the date and time the connection was established.
LogWrite Returns the number of pages that have been written to the trans-
action log.
max_query_tasks Returns the maximum number of requests that the database serv-
er can use to process a query. See “max_query_tasks option
[database]” on page 489.
Property Description
MessageReceived Returns the string that was generated by the MESSAGE state-
ment that caused the WAITFOR statement to be interrupted.
Otherwise, an empty string is returned.
min_password_length Returns the minimum length for new passwords in the database.
See “min_password_length option [database]” on page 493.
nearest_century Returns a value that indicates how two-digit years are interpreted
in string-to-date conversions. See “nearest_century option [com-
patibility]” on page 494.
non_keywords Returns a list of keywords, if any, that are turned off so they can
be used as identifiers. See “non_keywords option [compatibili-
ty]” on page 494.
odbc_describe_binary_as_varbina- Returns Off if the SQL Anywhere ODBC driver describes both
ry BINARY and VARBINARY columns as SQL_BINARY and
returns On if the ODBC driver describes BINARY and VAR-
BINARY columns as SQL_VARBINARY. See “odbc_de-
scribe_binary_as_varbinary [database]” on page 495.
oem_string Returns the string stored in the header page of the database file.
See “oem_string option [database]” on page 496.
Property Description
optimization_level Returns a value between 0 and 15. This number is used to control
the amount of effort made by the SQL Anywhere query optimizer
to find an access plan for a SQL statement. See “optimiza-
tion_level option [database]” on page 500.
optimization_workload Returns a value indicating the amount of effort made by the SQL
Anywhere query optimizer to find an access plan for a SQL
statement. See “optimization_workload option [data-
base]” on page 501.
OSUser Returns the operating system user name associated with the cli-
ent process. If the client process is impersonating another user
(or the set ID bit is set on Unix), the impersonated user name is
returned. An empty string is returned for version 10.0.1 and ear-
lier clients, as well as for HTTP and TDS clients.
PacketsReceivedUncomp Returns the number of packets that would have been received
during client/server communications if compression was disa-
bled. (This value is the same as the value for PacketsReceived if
compression is disabled.)
PacketsSentUncomp Returns the number of packets that would have been sent during
client/server communications if compression was disabled.
(This value is the same as the value for PacketsSent if compres-
sion is disabled.)
Property Description
pinned_cursor_percent_of_cache Returns the percentage of the cache that can be used for pinning
cursors. See “pinned_cursor_percent_of_cache option [data-
base]” on page 502.
post_login_procedure Returns the name of the procedure whose result set contains
messages that should be displayed by applications when a user
connects. See “post_login_procedure option [data-
base]” on page 503.
precision Returns the decimal and numeric precision setting. See “preci-
sion option [database]” on page 504.
prevent_article_pkey_update Returns On if updates are not allowed to the primary key columns
of tables involved in publications, otherwise returns Off. See
“prevent_article_pkey_update option [database] [MobiLink cli-
ent]” on page 506.
Property Description
QueryHeapPages Returns the number of cache pages used for query processing
(hash and sort operations).
Query JHToJNLOptUsed Returns the number of times a hash join was converted to a nested
loops join.
QueryLowMemoryStrategy Returns the number of times the server changed its execution
plan during execution as a result of low memory conditions. The
strategy can change because less memory is now available than
the optimizer estimated, or because the execution plan required
more memory than the optimizer estimated.
QueryMemGrantFailed Returns the total number of times a request waited for query
memory, but failed to get it.
QueryMemGrantRequested Returns the total number of times any request attempted to ac-
quire query memory.
QueryMemGrantWaited Returns the total number of times any request waited for query
memory.
QueryMemGrantWaiting Returns the current number of requests waiting for query mem-
ory.
QueryOptimized Returns the number of requests that have been fully optimized.
QueryReused Returns the number of requests that have been reused from the
plan cache.
QueryRowsMaterialized Returns the number of rows are written to work tables during
query processing.
Property Description
recovery_time Returns the maximum length of time, in minutes, that the data-
base server will take to recover from system failure. See
“recovery_time option [database]” on page 509.
RecursiveIterationsHash Returns the number of times recursive hash join used a hash
strategy.
RecursiveIterationsNested Returns the number of times recursive hash join used a nested
loops strategy.
RecursiveJNLMisses Returns the number of index probe cache misses for recursive
hash join.
remote_idle_timeout Returns the time, in seconds, of inactivity that web service client
procedures and functions will tolerate. See “remote_idle_time-
out option [database]” on page 510.
ReqCountBlockContention Returns the number of times the connection waited for atomic
access, or NULL if the -zt option was not specified. See “-zt
server option” on page 234.
ReqCountBlockIO Returns the number of times the connection waited for I/O to
complete, or NULL if the -zt option was not specified. See “-zt
server option” on page 234.
ReqCountBlockLock Returns the number of times the connection waited for a lock, or
NULL if the -zt option was not specified. See “-zt server op-
tion” on page 234.
Property Description
ReqCountUnscheduled Returns the number of times the connection waited for schedul-
ing, or NULL if the -zt option was not specified. See “-zt server
option” on page 234.
ReqStatus Returns the status of the request. It can be one of the following
values:
● Idle The connection is not currently processing a request.
● Unscheduled* The connection has work to do and is
waiting for a worker thread.
● BlockedIO* The connection is blocked waiting for an I/
O.
● BlockedContention* The connection is blocked waiting
for access to shared database server data structures.
● BlockedLock The connection is blocked waiting for a
locked object.
● Executing The connection is executing a request.
The values marked with an asterisk (*) are only returned when
logging of request timing information has been turned on for the
database server using the -zt server option. If request timing in-
formation is not being logged (the default), they values are
reported as Executing.
For more information, see “-zt server option” on page 234.
ReqTimeBlockContention Returns the amount of time spent waiting for atomic access, or
NULL if the RequestTiming server property is set to Off. See “-
zt server option” on page 234.
ReqTimeBlockIO Returns the amount of time spent waiting for I/O to complete, or
NULL if the -zt option was not specified. See “-zt server op-
tion” on page 234.
ReqTimeBlockLock Returns the amount of time spent waiting for a lock, or NULL if
the -zt option was not specified. See “-zt server op-
tion” on page 234.
ReqTimeUnscheduled Returns the amount of unscheduled time, or NULL if the -zt op-
tion was not specified. See “-zt server option” on page 234.
Property Description
rollback_on_deadlock Returns After when referential integrity actions are executed af-
ter the UPDATE or DELETE, and Before if they are executed
before the UPDATE or DELETE. See “rollback_on_deadlock
[database]” on page 513.
row_counts Returns On if the row count is always accurate, and Off if the
row count is usually an estimate. See “row_counts option [da-
tabase]” on page 514.
scale Returns the decimal and numeric scale for the connection. See
“scale option [database]” on page 515.
secure_feature_key Stores the key that is used to enable and disable features for a
database server. Selecting the value of this property always re-
turns an empty string.
SessionID Returns the session ID for the connection if one has been defined,
otherwise, returns an empty string.
SessionLastTime Returns the time of the last request for the HTTP session.
Property Description
SortSortedRuns Returns the number of sorted runs created during run formation.
sql_flagger_error_level Returns one of the following values to indicate which SQL that
is not part of a specified set of SQL/2003 is flagged as an error:
● E Flag syntax that is not entry-level SQL/2003 syntax
● I Flag syntax that is not intermediate-level SQL/2003 syn-
tax
● F Flag syntax that is not full-SQL/2003 syntax
● W Allow all supported syntax
sql_flagger_warning_level Returns one of the following values to indicate which SQL that
is not part of a specified set of SQL/2003 is flagged as a warning:
● E Flag syntax that is not entry-level SQL/2003 syntax
● I Flag syntax that is not intermediate-level SQL/2003 syn-
tax
● F Flag syntax that is not full-SQL/2003 syntax
● W Allow all supported syntax
Property Description
tds_empty_string_is_null Returns On if empty strings are returned as NULL for TDS con-
nections, and returns Off if a string containing one blank char-
acter is returned for TDS connections. See “tds_emp-
ty_string_is_null option [database]” on page 523.
TempTablePages Returns the number of pages in the temporary file used for tem-
porary tables.
time_format Returns the string format used for times retrieved from the da-
tabase. See “time_format option [compatibility]” on page 524.
timestamp_format Returns the number of minutes that must be added to the Coor-
dinated Universal Time (UTC) to display time local to the
connection. See “timestamp_format option [compatibili-
ty]” on page 526.
TimeZoneAdjustment Returns the number of minutes that must be added to the Coor-
dinated Universal Time (UTC) to display time local to the
connection. See “time_zone_adjustment option [data-
base]” on page 525.
TransactionStartTime Returns a string containing the time the database was first modi-
fied after a COMMIT or ROLLBACK, or an empty string if no
modifications have been made to the database since the last
COMMIT or ROLLBACK.
Property Description
tsql_variables Returns On if you can use the @ sign instead of the colon as a
prefix for host variable names in embedded SQL, otherwise, re-
turns Off. See “tsql_variables option [compatibili-
ty]” on page 529.
update_statistics This property is reserved for system use. Do not change the set-
ting of this option.
upgrade_database_capability This property is reserved for system use. Do not change the set-
ting of this option.
user_estimates Returns one of the following values that controls whether selec-
tivity estimates in query predicates are respected or ignored by
the query optimizer:
● Enabled All user-supplied selectivity estimates are re-
spected. You can also use On to turn on this option.
● Override-Magic A user selectivity estimate is respected
and used only if the optimizer would otherwise choose to use
its last-resort, heuristic value (also called the magic value).
● Disabled All user estimates are ignored and magic values
are used when no other estimate data is available. You can
also use Off to turn off this option.
Property Description
verify_password_function Returns the name of the function used for password verification
if one has been specified. See “verify_password_function option
[database]” on page 532.
wait_for_commit Returns On if the database does not check foreign key integrity
until the next COMMIT statement. Otherwise, returns Off and
all foreign keys that are not created with the check_on_commit
option are checked as they are inserted, updated or deleted. See
“wait_for_commit option [database]” on page 535.
Server-level properties
The following table lists properties that apply across the server as a whole.
Examples
To retrieve the value of a server property
● Use the property system function. For example, the following statement returns the number of cache
pages used for global server data structures:
SELECT PROPERTY ( 'MainHeapPages' );
See also
● “PROPERTY function [System]” [SQL Anywhere Server - SQL Reference]
● “Connection-level properties” on page 538
● “Database-level properties” on page 574
Descriptions
Property Description
ActiveReq Returns the number of server threads that are currently handling a re-
quest.
BuildChange Reserved.
BuildClient Reserved.
BuildProduction Returns Yes if the database server is compiled for production use or
returns No if the database server is a debug build.
BuildReproducible Reserved.
BytesReceivedUncomp Returns the number of bytes that would have been received during cli-
ent/server communications if compression was disabled. (This value is
the same as the value for BytesReceived if compression is disabled.)
BytesSentUncomp Returns the number of bytes that would have been sent during client/
server communications if compression was disabled. (This value is the
same as the value for BytesSent if compression is disabled.)
CacheAllocated Returns the number of cache pages that have been allocated for server
data structures.
CacheFile Returns the number of cache pages used to hold data from database
files.
CacheFileDirty Returns the number of cache pages that are dirty (needing a write).
Property Description
CachePanics Returns the number of times the cache manager has failed to find a page
to allocate.
CacheReplacements Returns the number of pages in the cache that have been replaced.
CacheScavenges Returns the number of times the cache manager has scavenged for a
page to allocate.
CacheScavengeVisited Returns the number of pages visited while scavenging for a page to
allocate.
CacheSizingStatistics Returns Yes if the server is displaying cache sizing statistics when the
cache is resized, otherwise, returns No. See “-cs server op-
tion” on page 165.
CarverHeapPages Returns the number of heap pages used for short-term purposes such
as query optimization.
CharSet Returns the CHAR character set in use by the database server.
ClientStmtCacheHits Returns the number of prepares that were not required because of the
client statement cache. This is the number of additional prepares that
would be required if client statement caching was disabled. See
“max_client_statements_cached option [database]” on page 486.
ClientStmtCacheMisses Returns the number of statements in the client statement cache that were
prepared again. This is the number of times a cached statement was
considered for reuse, but could not be reused because of a schema
change, a database option setting, or a DROP VARIABLE statement.
See “max_client_statements_cached option [database]” on page 486.
CommandLine Returns the command line that was used to start the database server.
If the encryption key for a database was specified using the -ek option,
the key is replaced with a constant string of asterisks in the value re-
turned by this property.
Property Description
ConnsDisabled Returns Yes or No to indicate the current setting of the server option
to disable new connections. See “sa_server_option system proce-
dure” [SQL Anywhere Server - SQL Reference].
ConsoleLogFile Returns the name of the file where database server messages are logged
if the -o option was specified, otherwise returns an empty string. See
“-o server option” on page 197 and “Logging database server ac-
tions” on page 34.
ConsoleLogMaxSize Returns the maximum size in bytes of the file used to log database
server messages. See “-os server option” on page 199.
DebuggingInformation Returns Yes if the server is displaying diagnostic messages for trou-
bleshooting, and No otherwise. See “-z server option” on page 227.
DefaultCollation Returns the collation that would be used for new databases if none is
explicitly specified.
DefaultNcharCollation Returns the name of the default NCHAR collation on the server com-
puter (UCA if ICU is installed, and UTF8BIN otherwise).
DiskReadHintScatterLimit Returns the imposed limit on the size (in bytes) of a scatter read hint.
DiskRetryReadScatter Returns the number of disk read retries for scattered reads.
EventTypeDesc Returns the system event type description associated with a given event
type ID.
EventTypeName Returns the system event type name associated with a given event type
ID.
ExchangeTasks Returns the number of tasks currently being used for parallel execution
of queries.
ExchangeTasksCompleted Returns the total number of internal tasks that have been used for intra-
query parallelism since the database server started. See “Parallelism
during query execution” [SQL Anywhere Server - SQL Usage].
Property Description
FipsMode Returns Yes if the -fips option was specified when the database server
was started, and No otherwise.
FirstOption Returns the number that represents the first connection property that
corresponds to a database option.
FunctionName Returns the name of the function identified by the value specified by
the function-number (which is a positive integer):
SELECT PROPERTY ( 'FunctionName', function-number );
HeapsCarver Returns the number of heaps used for short-term purposes such as query
optimization.
HeapsQuery Returns the number of heaps used for query processing (hash and sort
operations).
HttpAddresses Returns a semicolon delimited list of the TCP/IP addresses the server
is listening to for HTTP connections. For example:
(::1):80;127.0.0.1:80
Property Description
HttpNumActiveReq Returns the number of HTTP connections that are actively processing
an HTTP request. An HTTP connection that has sent its response is not
included.
HttpNumConnections Returns the number of HTTP connections that are currently open within
the database server. They may be actively processing a request or wait-
ing in a queue of long lived (keep-alive) connections.
HttpNumSessions Returns the number of active and dormant HTTP sessions within the
database server.
HttpPorts Returns the HTTP port numbers for the web server as a comma de-
limited list.
HttpsAddresses Returns a semicolon delimited list of the TCP/IP addresses the server
is listening to for HTTPS connections. For example:
(::1):443;127.0.0.1:443
HttpsNumActiveReq Returns the number of secure HTTPS connections that are actively
processing an HTTPS request. An HTTPS connection that has sent its
response is not included.
HttpsNumConnections Returns the number of HTTPS connections that are currently open
within the database server. They may be actively processing a request
or waiting in a queue of long lived (keep-alive) connections.
HttpsPorts Returns the HTTPS port numbers for the web server as a comma de-
limited list.
IdleTimeout Returns the default idle timeout. See “-ti server option” on page 213.
IsRuntimeServer Returns Yes if connected to the limited desktop runtime database serv-
er, and No otherwise.
LastConnectionProperty Returns the number that represents the last connection property.
Property Description
LastDatabaseProperty Returns the number that represents the last database property.
LastOption Returns the number that represents the last connection property that
corresponds to a database option.
LastServerProperty Returns the number that represents the last server property.
LicenseType Returns the license type. Can be networked seat (per-seat) or CPU-
based.
LivenessTimeout Returns the client liveness timeout default. See “-tl server op-
tion” on page 214.
LockedCursorPages Returns the number of pages used to keep cursor heaps pinned in mem-
ory.
MachineName Returns the name of the computer running a database server. Typically,
this is the computer's host name.
MainHeapBytes Returns the number of bytes used for global server data structures.
MainHeapPages Returns the number of pages used for global server data structures.
MapPhysicalMemoryEng Returns the number of database page address space windows mapped
to physical memory in the cache using Address Windowing Extensions.
Property Description
MaxMessage Deprecated. Returns the current maximum line number that can be re-
trieved from the database server messages window. This represents the
most recent message displayed in the database server messages win-
dow.
Message, linenumber Deprecated. Returns a line from the database server messages window,
prefixed by the date and time the message appeared. The second pa-
rameter specifies the line number.
The value returned by PROPERTY( "message" ) is the first line
of output that was written to the database server messages window.
Calling PROPERTY( "message", n ) returns the n-th line of
server output (with zero being the first line). The buffer is finite, so as
messages are generated, the first lines are dropped and may no longer
be available in memory. In this case, NULL is returned.
MessageCategoryLimit Returns the minimum number of messages of each severity and cate-
gory that can be retrieved using the sa_server_messages system pro-
cedure. The default value is 400. See “sa_server_messages system
procedure” [SQL Anywhere Server - SQL Reference].
MessageText, linenumber Deprecated. Returns the text associated with the specified line number
in the database server messages window, without a date and time prefix.
The second parameter specifies the line number.
MessageTime, linenumber Deprecated. Returns the date and time associated with the specified line
number in the database server messages window. The second parameter
specifies the line number.
MessageWindowSize Deprecated. Returns the maximum number of lines that can be retrieved
from the database server messages window.
Property Description
MultiProgrammingLevel Returns the maximum number of concurrent tasks the server can proc-
ess. Requests are queued if there are more concurrent tasks than this
value. This can be changed with the -gn server option. See “-gn server
option” on page 183.
Name Returns the alternate name of the server used to connect to the database
if one was specified, otherwise, returns the real server name. See “-sn
database option” on page 243.
NativeProcessorArchitecture Returns a string that identifies the native processor type on platforms
where a processor can be emulated (such as X86 on Win64). In all other
cases, it returns the same value as property( 'ProcessorArchitecture' ).
Values can include:
● 32-bit Windows, except Windows Mobile, - X86
● Windows Mobile - ARM
● 64-bit Windows - X86_64
● Solaris - SPARC or X86_64
● AIX - PPC
● MAC OS - X86 or X86_64
● HP - IA64
● Linux - X86 or X86_64
NumLogicalProcessors Returns the number of logical processors (including cores and hyper-
threads) enabled on the server computer.
NumLogicalProcessorsUsed Returns the number of logical processors the database server will use.
On Windows, use the -gtc option to change the number of logical pro-
cessors used. See “-gtc server option” on page 187.
NumPhysicalProcessors Returns the number of physical processors enabled on the server com-
puter. This value is NumLogicalProcessors divided by the number of
cores or hyperthreads per physical processor. On some non-Windows
platforms, cores or hyperthreads may be counted as physical process-
ors.
Property Description
NumPhysicalProcessorsUsed Returns the number of physical processors the database server will use.
The personal server is limited to one processor on some platforms. On
Windows, you can use the -gt option to change the number of physical
processors used by the network database server. See “-gt server op-
tion” on page 186.
OmniIdentifier This property is reserved for system use. Do not change the setting of
this option.
PacketsReceivedUncomp Returns the number of packets that would have been received during
client/server communications if compression was disabled. (This value
is the same as the value for PacketsReceived if compression is disa-
bled.)
PacketsSentUncomp Returns the number of packets that would have been sent during client/
server communications if compression was disabled. (This value is the
same as the value for PacketsSent if compression is disabled.)
PageSize Returns the size of the database server cache pages. This can be set
using the -gp option, otherwise, it is the maximum database page size
of the databases specified on the command line.
PeakCacheSize Returns the largest value the cache has reached in the current session,
in kilobytes.
Platform Returns the operating system on which the software is running. For
example, if you are running on Windows 2000, this property returns
Windows2000.
PlatformVer Returns the operating system on which the software is running, includ-
ing build numbers, service packs, and so on. For example, it could
return Windows 2000 Build 2195 Service Pack 3.
ProcessCPU Returns CPU usage for the database server process. Values are in sec-
onds. This property is supported on Windows and Unix. This property
is not supported on Windows Mobile.
The value returned for this property is cumulative since the database
server was started. The value will not match the instantaneous value
returned by applications such as the Windows Task Manager or the
Windows Performance Monitor.
Property Description
ProcessCPUSystem Returns system CPU usage for the database server process CPU. This
is the amount of CPU time that the database server spent inside the
operating system kernel. Values are in seconds. This property is sup-
ported on Windows and Unix. This property is not supported on
Windows Mobile.
The value returned for this property is cumulative since the database
server was started. The value will not match the instantaneous value
returned by applications such as the Windows Task Manager or the
Performance Monitor.
ProcessCPUUser Returns user CPU usage for the database server process. Values are in
seconds. This excludes the amount of CPU time that the database server
spent inside the operating system kernel. This property is supported on
Windows and Unix. This property is not supported on Windows Mo-
bile.
The value returned for this property is cumulative since the database
server was started. The value will not match the instantaneous value
returned by applications such as the Windows Task Manager or the
Performance Monitor.
ProcessorArchitecture Returns a string that identifies the processor type. Values can include:
● 32-bit Windows (except Windows Mobile) - X86
● 64-bit Windows - X86_64
● Windows Mobile - ARM
● Solaris - SPARC or X86_64
● AIX - PPC
● MAC OS - X86
● HP - IA64
● Linux - X86 or X86_64
Property Description
ProfileFilterUser Returns the name of the user being monitored if procedure profiling for
a specific user is turned on. Otherwise, returns an empty string. You
control procedure profiling by user with the sa_server_option proce-
dure. See “sa_server_option system procedure” [SQL Anywhere Server
- SQL Reference].
QueryHeapPages Returns the number of cache pages used for query processing (hash and
sort operations).
QueryMemActiveEst Returns the database server's estimate of the steady state average of the
number of requests actively using query memory.
QueryMemActiveMax Returns the maximum number of requests that are actively allowed to
use query memory.
QueryMemExtraAvail Returns the amount of memory available to grant beyond the base
memory-intensive grant.
QueryMemGrantExtra Returns the number of query memory pages that can be distributed
among active memory intensive beyond QueryMemGrantBaseMI.
QueryMemGrantFailed Returns the total number of times a request waited for query memory,
but failed to get it.
QueryMemGrantRequested Returns the total number of times any request attempted to acquire
query memory.
QueryMemGrantWaited Returns the total number of times any request waited for query memory.
QueryMemGrantWaiting Returns the current number of requests waiting for query memory.
QueryMemPages Returns the amount of memory that is available for query execution
algorithms, expressed as a number of pages.
QueryMemPercentOfCache Returns the amount of memory that is available for query execution
algorithms, expressed as a percent of maximum cache size.
Property Description
QuittingTime Returns the shutdown time for the server. If none is specified, the value
is none.
RememberLastPlan Returns Yes if the server is recording the last query optimization plan
returned by the optimizer. See “-zp server option” on page 231.
RememberLastStatement Returns Yes if the server is recording the last statement prepared by
each connection, and No otherwise. See “-zl server op-
tion” on page 228.
RemoteCapability Returns the remote capability name associated with a given capability
ID.
Req Returns the number of times the server has been entered to allow it to
handle a new request or continue processing an existing request.
RequestFilterConn Returns the ID of the connection that logging information is being fil-
tered for, otherwise, returns -1.
RequestFilterDB Returns the ID of the database that logging information is being filtered
for, otherwise, returns -1.
RequestLogFile Returns the name of the request logging file. An empty string is returned
if there is no request logging. See “sa_server_option system proce-
dure” [SQL Anywhere Server - SQL Reference].
RequestLogMaxSize Returns the maximum size of the request log file. See “-zs server op-
tion” on page 233.
RequestLogNumFiles Returns the number of request log files being kept. See “sa_server_op-
tion system procedure” [SQL Anywhere Server - SQL Reference].
RequestTiming Returns Yes if request timing is turned on, and No otherwise. Request
timing is turned on using the -zt database server option. See “-zt server
option” on page 234.
Property Description
SendFail Returns the number of times that the underlying communications pro-
tocols have failed to send a packet.
ServerName Returns the name of the server for the current connection. You can use
this value to determine which of the operational servers is currently
acting as primary in a database mirroring configuration. See “Intro-
duction to database mirroring” on page 914.
StartDBPermission Returns the setting of the -gd server option, which can be one of DBA,
all, or none. See “-gd server option” on page 179.
TcpIpAddresses Returns a semicolon delimited list of the TCP/IP addresses the server
is listening to for Command Sequence and TDS connections. For ex-
ample:
(::1):2638;127.0.0.1:2638
TempDir Returns the directory in which temporary files are stored by the server.
TimeZoneAdjustment Returns the number of minutes that must be added to the Coordinated
Universal Time (UTC) to display time local to the server.
UnschReq Returns the number of requests that are currently queued up waiting
for an available server thread.
WebClientLogFile Returns the name of the web service client log file. See “-zoc server
option” on page 230.
WebClientLogging Returns a value that indicates whether web service client information
is being logged to a file. See “-zoc server option” on page 230.
Database-level properties
The following table lists properties available for each database on the server.
Examples
To retrieve the value of a database property
● Use the DB_PROPERTY system function. For example, the following statement returns the page size
of the current database:
SELECT DB_PROPERTY ( 'PageSize' );
See also
● “DB_PROPERTY function [System]” [SQL Anywhere Server - SQL Reference]
● “DB_EXTENDED_PROPERTY function [System]” [SQL Anywhere Server - SQL Reference]
● “Server-level properties” on page 561
● “Connection-level properties” on page 538
Descriptions
Property Description
AccentSensitive Returns the status of the accent sensitivity feature. Returns Yes if the
database is accent sensitive, No if it is not, or FRENCH if it is using
French sensitivity rules.
AlternateMirrorServerName Returns the alternate mirror server name associated with the database
if one was specified. See “-sm database option” on page 242.
AlternateServerName Returns the alternate server name associated with the database if one
was specified. See “-sn database option” on page 243.
AuditingTypes Returns the types of auditing currently enabled. See “auditing option
[database]” on page 454
Property Description
CacheHits Returns the number of database page lookups satisfied by finding the
page in the cache.
CacheRead The number of database pages that have been looked up in the cache.
CacheReadIndInt Returns the number of index internal-node pages that have been read
from the cache.
CacheReadIndLeaf Returns the number of index leaf pages that have been read from the
cache.
CacheReadTable Returns the number of table pages that have been read from the cache.
Capabilities Returns the capability bits enabled for the database. This property is
primarily for use by technical support.
CaseSensitive Returns the status of the case sensitivity feature. Returns On if the
database is case sensitive. Otherwise, it returns Off. In case sensitive
databases, data comparisons are case sensitive. This setting does not
affect the case sensitivity of identifiers. Passwords are always case
sensitive. See “Case sensitivity” [SQL Anywhere Server - SQL Us-
age].
CatalogCollation Returns the identifier for the collation used for the catalog. This
property has extensions that you can specify when querying the
property value. See “DB_EXTENDED_PROPERTY function [Sys-
tem]” [SQL Anywhere Server - SQL Reference].
Property Description
CheckpointLogPagesWritten Returns the number of checkpoint log pages that have been written.
CheckpointLogSavePreimage Returns the number of pre-images of database pages that are being
added to the checkpoint log.
CheckpointUrgency Returns the time that has elapsed since the last checkpoint, as a per-
centage of the checkpoint time setting of the database.
Checksum Returns On if database page checksums are enabled for the database.
Otherwise, returns Off. Checksums are always present for critical
pages.
ChkptFlush Returns the number of ranges of adjacent pages written out during a
checkpoint.
CleanablePagesCleaned Returns the number of database pages cleaned since database server
startup.
CleanableRowsCleaned Returns the number of shadow table rows deleted since database
server startup.
Collation Returns the collation used by the database. For a list of available
collations, see “Supported and alternate collations” on page 374.
This property has extensions that you can specify when querying the
property value. See “DB_EXTENDED_PROPERTY function [Sys-
tem]” [SQL Anywhere Server - SQL Reference].
CommitFile Returns the number of times the server has forced a flush of the disk
cache. On Windows, the disk cache doesn't need to be flushed if
unbuffered (direct) I/O is used.
Property Description
CurrentRedoPos Returns the current offset in the transaction log file where the next
database operation is to be logged.
CurrIO Returns the current number of file I/Os that were issued by the server
but haven't yet completed.
CurrRead Returns the current number of file reads that were issued by the serv-
er, but haven't yet completed.
CurrWrite Returns the current number of file writes that were issued by the
server, but haven't yet completed.
DBFileFragments Returns the number of database file fragments. This property is sup-
ported on Windows.
DiskRead Returns the number of pages that have been read from disk.
DiskReadIndInt Returns the number of index internal-node pages that have been read
from disk.
DiskReadIndLeaf Returns the number of index leaf pages that have been read from disk.
DiskReadTable Returns the number of table pages that have been read from disk.
DiskRetryReadScatter Returns the number of disk read retries for scattered reads.
Property Description
DiskWaitRead Returns the number of times the database server waited for an asyn-
chronous read.
DiskWaitWrite Returns the number of times the database server waited for an asyn-
chronous write.
DiskWrite Returns the number of modified pages that have been written to disk.
DriveType Returns the type of drive on which the database file is located. The
value is one of the following: CD, FIXED, RAMDISK, REMOTE,
REMOVABLE, or UNKNOWN.
On Unix, depending on the version of Unix and the type of drive, it
may not be possible to determine the drive type. In these cases UN-
KNOWN is returned.
This property has extensions that you can specify when querying the
property value. See “DB_EXTENDED_PROPERTY function [Sys-
tem]” [SQL Anywhere Server - SQL Reference].
Encryption Returns the type of encryption used for database or table encryption,
one of None, Simple, AES, AES256, AES_FIPS, or AES256_FIPS.
EncryptionScope Returns the part of the database, if any, that can be encrypted. The
value is one of the following: TABLE, DATABASE, or NONE.
TABLE indicates that table encryption is enabled. DATABASE in-
dicates that the whole database is encrypted. NONE indicates that
table encryption is not enabled, and the database is not encrypted.
ExprCacheAbandons Returns the number of time that the expression cache was completely
abandoned because the hit rate was too low.
ExprCacheDropsToReadOnly Returns the number of times that the expression cache dropped to
read-only status because the hit rate was low.
Property Description
ExprCacheInserts Returns the number of values inserted into the expression cache.
ExprCacheResumesOfRead- Returns the number of times that the expression cache resumed read-
Write write status because the hit rate increased.
ExprCacheStarts Returns the number of times the expression cache was started.
ExtendDB Returns the number of pages by which the database file has been
extended.
ExtendTempWrite Returns the number of pages by which temporary files have been
extended.
File Returns the file name of the database root file, including path. This
property has extensions that you can specify when querying for prop-
erty value. See “DB_EXTENDED_PROPERTY function [Sys-
tem]” [SQL Anywhere Server - SQL Reference].
FileSize Returns the file size of the system dbspace, in pages. This property
has extensions that you can specify when querying for property value.
See “DB_EXTENDED_PROPERTY function [System]” [SQL Any-
where Server - SQL Reference].
FreePages Returns the number of free pages in the system dbspace. The Free-
Pages property is only supported on databases created with version
8.0.0 or later.
This property has extensions that you can specify when querying for
property value. See “DB_EXTENDED_PROPERTY function [Sys-
tem]” [SQL Anywhere Server - SQL Reference].
FullCompare Returns the number of comparisons that have been performed beyond
the hash value in an index.
HashForcedPartitions Returns the number of times that a hash operator was forced to par-
tition because of competition for memory.
Property Description
HasEndianSwapFix Returns a value indicating whether the database supports both big-
endian and little endian UTF-16 encoding on all platforms, regardless
of the endianness of the platform. Possible values are On or Off.
HashWorkTables Returns the number of work tables created for hash-based operations.
IdentitySignature Reserved.
IdleCheck Returns the number of times that the server's idle thread has become
active to do idle writes, idle checkpoints, and so on.
IdleWrite Returns the number of disk writes that have been issued by the serv-
er's idle thread.
IndAdd Returns the number of entries that have been added to indexes.
IndLookup Returns the number of entries that have been looked up in indexes.
Property Description
JavaVM Returns the Java VM the database server uses to execute Java in the
database.
LogFileFragments Returns the number of log file fragments. This property is supported
on Windows.
LogFreeCommit Returns the number of Redo Free Commits. A Redo Free Commit
occurs when a commit of the transaction log is requested but the log
has already been written (so the commit was done for free).
LogMirrorName Returns the file name of the transaction log mirror, including path.
LogName Returns the file name of the transaction log, including path.
LogWrite Returns the number of pages that have been written to the transaction
log.
LTMTrunc Returns the minimal confirmed log offset for the Replication Agent.
Property Description
NcharCollation Returns the name of the collation used for NCHAR data. This prop-
erty has extensions that you can specify when querying the property
value. See “DB_EXTENDED_PROPERTY function [Sys-
tem]” [SQL Anywhere Server - SQL Reference].
NextScheduleTime Returns the next scheduled execution time for a specified event;
query this property using the DB_EXTENDED_PROPERTY func-
tion. See “DB_EXTENDED_PROPERTY function [System]” [SQL
Anywhere Server - SQL Reference].
OptionWatchAction Returns the action that is taken when an attempt is made to set a
database option that is included in the OptionWatchList property. See
“sa_server_option system procedure” [SQL Anywhere Server - SQL
Reference].
OptionWatchList Returns the list of database options being monitored by the database
server. See “sa_server_option system procedure” [SQL Anywhere
Server - SQL Reference].
PageRelocations Returns the number of relocatable heap pages that have been read
from the temporary file.
Property Description
ProcedurePages Returns the number of relocatable heap pages that have been used
for procedures.
QueryBypassed Returns the number of requests reused from the plan cache.
QueryCachedPlans Returns the number of cached execution plans across all connections.
QueryJHToJNLOptUsed Returns the number of times a hash join was converted to a nested
loops join.
QueryLowMemoryStrategy Returns the number of times the server changed its execution plan
during execution as a result of low memory conditions. The strategy
can change because less memory is available than the optimizer es-
timated, or because the execution plan required more memory than
the optimizer estimated.
QueryRowsMaterialized Returns the number of rows written to work tables during query pro-
cessing.
ReceivingTracingFrom Returns the name of the database from which the tracing data is
coming. Returns a blank string if tracing is not attached.
Property Description
RecursiveIterationsHash Returns the number of times recursive hash join used a hash strategy.
RecursiveIterationsNested Returns the number of times recursive hash join used a nested loops
strategy.
RecursiveJNLMisses Returns the number of index probe cache misses for recursive hash
join.
RecursiveJNLProbes Returns the number of times recursive hash join attempted an index
probe.
RelocatableHeapPages Returns the number of pages used for relocatable heaps (cursors,
statements, procedures, triggers, views, and so on.).
RemoteTrunc Returns the minimal confirmed log offset for the SQL Remote Mes-
sage Agent.
SendingTracingTo Returns the connection string where the tracing data is being sent.
Returns a blank string if tracing is not attached.
Property Description
SortSortedRuns Returns the number of sorted runs created during run formation.
SyncTrunc Returns the minimal confirmed log offset for the MobiLink client
dbmlsync executable.
TempFileName Returns the file name of the database temporary file, including path.
TempTablePages Returns the number of pages in the temporary file used for temporary
tables.
TriggerPages Returns the number of relocatable heap pages used for triggers.
VersionStorePages Returns the number of pages in the temporary file that are being used
for the row version store when snapshot isolation is enabled.
ViewPages Returns the number of relocatable heap pages used for views.
XPathCompiles Returns the number of times any XPath query (using the openxml
procedure) was compiled by the database server since database server
startup.
Physical limitations
Contents
SQL Anywhere size and number limitations .............................................................. 588
Item Limitation
Database size 13 files per database. For each file, the largest
file allowed by operating system and file sys-
tem
Field size 2 GB
File size for NTFS, HP-UX 11.0 and later, Solaris 2.6 ● 512 GB for 2 KB pages
and later, Linux 2.4 and later) ● 1 TB for 4 KB pages
● 2 TB for 8 KB pages
Item Limitation
Maximum cache size (AWE cache) (Windows 2000 100% of all available memory - 128 MB
Professional, Windows 2000 Server, Windows 2000
Advanced Server, Windows 2000 Datacenter Server,
Windows XP Home Edition, Windows XP Professio-
nal, Windows Server 2003 Web Edition, Windows
Server 2003 Standard Edition, Windows Server 2003
Enterprise Edition, Windows Server 2003 Datacenter
Edition )
Maximum cache size (Windows Mobile) Limited by available memory on the device
Maximum cache size (Unix—Solaris, x86 Linux, AIX, 2 GB for 32-bit servers
HP)
Maximum cache size (Win 64) Limited by physical memory on 64-bit servers
Maximum cache size (Itanium HP-UX) Limited by physical memory on 64-bit servers
Number of nullable constants per table min( 45000, ( page size - overhead ) * 8 )
Item Limitation
Strings 2 GB
Identifiers (including user IDs, table names, and column 128 bytes
names)
Contents
Using Sybase Central ................................................................................................ 594
Using Interactive SQL ................................................................................................ 612
Using text completion ................................................................................................ 658
Using the fast launcher option ................................................................................... 661
Using the SQL Anywhere Console utility ................................................................... 662
Checking for software updates .................................................................................. 665
Plug-ins
Each product is managed by a separate plug-in. The plug-ins for these products must be registered and loaded
before you can use the products in Sybase Central. When you install a product, its plug-in is automatically
registered and loaded.
SQL Anywhere 11 includes Sybase Central plug-ins for the following products:
● SQL Anywhere databases
● UltraLite databases
● MobiLink synchronization
● QAnywhere messaging
The plug-in files are found in the following location in your SQL Anywhere 11 installation:
MobiLink 11 install-dir\java\mlplugin.jar
UltraLite 11 install-dir\java\ulplugin.jar
QAnywhere 11 install-dir\java\qaplugin.jar
For more information about using the plug-ins included with SQL Anywhere 11, see:
● SQL Anywhere: “Using the SQL Anywhere plug-in” on page 607
● MobiLink: “MobiLink models” [MobiLink - Getting Started]
● UltraLite: “Creating an UltraLite database from Sybase Central” [UltraLite - Database Management
and Reference] and “Working with UltraLite databases” [UltraLite - Database Management and
Reference]
● QAnywhere: “QAnywhere plug-in” [QAnywhere]
3. On the Identification tab, select ODBC Data Source Name, and then in the box below, type SQL
Anywhere 11 Demo.
4. Click OK to connect.
Note
The following steps assume that you have already sourced the SQL Anywhere utilities. See “Setting
environment variables on Unix and Mac OS X” on page 312.
To start Sybase Central and connect to the sample database (Unix command line)
1. In a terminal session, enter the following command:
scjview
The following steps can be used if you are using a version of Linux that supports the Linux Applications
menu and if you chose to install the menu items when you installed SQL Anywhere 11.
To start Sybase Central and connect to the sample database (Linux Applications menu)
1. From the Applications menu, choose SQL Anywhere 11 » Sybase Central.
Sybase Central opens.
2. In the Welcome To Sybase Central window, click View And Edit The Schema Or Perform
Maintenance On A Database.
If the Welcome To Sybase Central window does not appear, choose Connections » Connect With
SQL Anywhere 11.
The Connect window appears.
3. On the Identification tab, select ODBC Data Source Name and then type SQL Anywhere 11 Demo.
The main Sybase Central window is split into two vertically-aligned panes.
Left pane
You can choose whether you want the left pane to display the:
● Folders pane displays a hierarchical view of database objects.
Folders shows only the containers in the object tree; it does not show objects that are not containers of
other objects. For example, the left pane may show a Columns folder (a container), but not the columns
themselves because they are items, and appear in the right pane instead.
● Tasks pane displays a task list for the currently-selected database object.
● Search pane allows you to search for objects in a plug-in.
Right pane
The right pane shows the contents of the currently selected container. The right pane has tabs that display
the contents of the container that is selected in the left pane, as well as other information about the selected
container.
You can configure the columns that appear on a tab in the right pane by choosing View » Choose
Columns.
To view the Tasks, Folders, or Search pane
1. Start Sybase Central.
2. From the View menu, choose Tasks, Folders, or Search to view the task list, folders list, or search
feature respectively.
You can change the appearance of the right pane in the Options window (accessed through the Tools menu).
Once you connect to a database or database server, you can administer it by navigating and selecting its
objects in the main window.
Toolbar
The main window toolbar provides you with buttons for common commands. To show or hide the toolbar,
from the View menu, choose Toolbars » Standard Toolbars. With the main toolbar, you can:
● navigate through the object folders
● connect to or disconnect from a database, database server, or product plug-in
● show the Tasks, Folders, or Search pane
● access the Connection Profiles window (also accessible from the Tools menu)
● refresh the view of the current folder
● cut, copy, paste, and delete objects
● undo or redo actions
● view the properties window for a selected object
Status bar
The status bar, which appears at the bottom of the main window, shows a brief summary of menu commands
as you navigate through the menus. To show or hide the status bar, choose View » Status Bar.
Note
Connection profiles are specific to Sybase Central. If you are building an ODBC application, you can achieve
functionality similar to connection profiles using ODBC data sources. See “Saving connection parameters
in ODBC data sources” on page 77.
● Search Dynamic Properties (Connections, Statistics, Locks) Select this option to include
dynamic properties, such as connected users, SQL Remote statistics, table locks, and table page usage
information in the search.
F11 Opens the Connection menu if there are multiple plug-ins loa-
ded. If only one plug-in is loaded, pressing F11 opens the
Connection window for that plug-in.
Beyond the standard text editing functions, the Code Editor provides the following functionality:
● a toolbar and status bar
● automatic syntax highlighting
● language-sensitive indenting
● the ability to find and replace text
● the ability to open from and save to files (the availability of this functionality depends on the plug-in
you are using)
● the ability to print the code
● text completion when typing code
You can customize the display characteristics of the Code Editor using the Options window. This window
lets you change settings for the foreground and background colors, as well as the overall Code Editor
appearance. All changes you make persist between sessions.
To set Code Editor settings when editing on the SQL tab
1. From the File menu, choose Customize Editor.
2. Configure the settings on the various tabs. Click OK.
Alt+F4 Closes the Code Editor (if a separate window) or closes Sybase
Central if you are editing text in the right pane of Sybase Cen-
tral.
Ctrl+] Moves the cursor to the matching brace. Use this shortcut to
match parentheses, braces, brackets, and angle brackets.
Ctrl+End Moves the cursor to the bottom of the Code Editor window.
Ctrl+F Opens the Find/Replace window where you can search for and
replace the specified text if you have not searched for text in
the current window. Otherwise, this searches for the next oc-
currence of the specified text.
Ctrl+G Opens the Go To window where you can specify the line loca-
tion you want to go to within the Code Editor window.
Ctrl+Home Moves the cursor to the top of the Code Editor window.
Ctrl+N Clears the contents of the Code Editor window and closes the
current file (if any). This shortcut cannot be used from the
SQL tab in the right pane of Sybase Central.
Ctrl+O Opens a file when the Code Editor is open as a separate window.
This shortcut cannot be used from the SQL tab in the right pane
of Sybase Central.
Ctrl+P Prints the contents of the Code Editor window. You can con-
figure the appearance of the printed text: from the Tools menu,
choose Options, and then click the Print tab.
Ctrl+Shift+] Extends the selection to the matching brace. Use this shortcut
to match parentheses, braces, brackets, and angle brackets.
Ctrl+Shift+Period (.) Increases the line indentation of selected text in the Code Editor
window. If no text is selected, the indentation is applied to the
current line.
Ctrl+Shift+Comma (,) Decreases the line indentation of selected text in the Code Ed-
itor window. If no text is selected, the indentation is applied to
the current line.
Ctrl+Minus Sign (-) Adds and removes the double-hyphen (--) SQL comment indi-
cator.
To turn existing text into comments, select the text in the Code
Editor window and press Ctrl+minus sign. The double-hyphen,
SQL comment indicator is added to the start of the lines that
contain the selected text.
If no text is selected, the comment indicator is added to the start
of the current line.
To remove a comment indicator, select the text and press Ctrl
+minus sign.
See “Comments” [SQL Anywhere Server - SQL Reference].
Ctrl+Forward Slash (/) Adds and removes the double-slash (//) SQL comment indica-
tor.
To turn existing text into comments, select the text in the Code
Editor window and press Ctrl+forward slash. The double-slash,
SQL comment indicator is added to the start of the lines that
contain the selected text.
If no text is selected, the comment indicator is added to the start
of the current line.
To remove a comment indicator, select the text and press Ctrl
+forward slash.
See “Comments” [SQL Anywhere Server - SQL Reference].
F3 Opens the Find/Replace window where you can search for and
replace the specified text if you have not searched for text in
the current window. Otherwise, this searches for the next oc-
currence of the specified text.
Home Move the cursor to the start of the current line or to the start of
the text on the current line.
Page Down Moves the cursor to the end of the current page.
Shift+F3 Opens the Find/Replace window where you can search for and
replace the specified text if no text is selected. If text is selected,
finds the previous occurrence of the selected text.
Shift+F10 Displays the popup menu for the area that has focus.
This keyboard shortcut is an alternative to right-clicking an
area.
Shift+Home Extends the selection to the start of the text on the current line.
Shift+Left Arrow Extends the selection one character to the left of the currently
selected character(s).
Shift+Right Arrow Extends the selection one character to the right of the currently
selected character(s).
You can filter these messages to show only a certain type or number, or choose to show only messages from
a particular plug-in. You can also save messages to a file or clear all messages from the list.
When you are working in Sybase Central, you can access the Log Viewer through the Tools menu.
To open the Log Viewer
1. In Sybase Central, choose Tools » Log Viewer.
The Sybase Central Log Viewer appears, showing the current messages (if any exist).
2. Use the View menu to configure the types of messages that are logged.
See also
● “Connecting from Sybase Central, Interactive SQL, or the SQL Anywhere Console utility” on page 78
● “Working with database objects” [SQL Anywhere Server - SQL Usage]
● “Creating a Windows Mobile database using Sybase Central” on page 1064
● Articles
● Check constraints
● Columns
● Dbspaces
● Directory access servers
● Domains
● Events
● External logins
● Foreign keys
● Indexes
● Login mappings (integrated logins and Kerberos logins)
● Login policies
● Maintenance plans
● Maintenance plan reports
● Message types
● MobiLink users
● Primary keys
● Procedures and functions
● Publications
● Remote servers
● Schedules
● SQL Remote subscriptions
● Synchronization subscriptions
● System triggers
● Text indexes
● Text configuration objects
● Tables
● Triggers
● Unique constraints
● Users and groups
● Views
● Web services
When you rearrange objects in the diagram, the changes persist between Sybase Central sessions. Double-
clicking a table takes you to the column definitions for that table.
The tables that appear in the diagram are subject to the filtering set for the database. Filtering is done by
owner.
To change the tables included in the entity-relationship diagram
1. Select the database in the left pane of Sybase Central, and then choose File » Configure Owner
Filter.
Select the database users whose tables you want to see in the entity-relationship diagram, and then click
OK.
2. Choose File » Filter Objects By Owner.
3. Click the ER Diagram tab in the right pane.
The entity-relationship diagram appears.
4. Choose File » Choose ER Diagram Tables.
The Choose ER Diagram Tables window appears. This window lets you further customize the tables
that appear in the entity-relationship diagram.
Use the Add and Remove buttons to customize the tables that appear in the Selected Tables list.
See also
● “Entity-relationship diagrams” [SQL Anywhere Server - SQL Usage]
Note
You must initiate the retrieval of MobiLink and QAnywhere information; otherwise, these nodes appear
as unknowns (greyed-out). See MobiLink, QAnywhere, and Notifiers below.
● Health And Statistics Located on the right, this pane displays statistics and information relating to
the overall status of the database. The following collapsible panes are available:
○ Statistics Displays general statistics, such as the number of pages read and written to disk. It
displays a warning if there are any unscheduled requests. Click the warning to learn more.
○ Dbspaces Displays a table listing all dbspaces. It displays a warning if a dbspace has less than
10% of free disk space remaining, or if a dbspace file cannot be found. Click the warning to learn
more.
○ Transaction Logs Displays information for the transaction log and the mirror transaction log, if
applicable. This pane appears only when the database has a transaction log. It displays a warning if
a log file has less than 10% of free disk space remaining. Click the warning to learn more.
○ Connected Users Displays connected user and transaction statistics. Shows a table of the top 5
transaction times, if there are any. It shows a table of all blocked connections, if there are any. Displays
a warning if there are any blocked connections. Click the warning to learn more.
○ Database Mirroring Displays information for the primary, arbiter, and mirror servers and for the
mirroring system. This pane appears only when database mirroring is being used. It displays a
warning if the arbiter or mirror server is disconnected. Click the warning to learn more.
○ Remote Servers Displays a table of the remote servers used by the database. This pane appears
only when a remote server exists. It displays a warning if a remote server is disconnected or a remote
server cannot establish a connection. Click the warning to learn more.
Note
For JDBC remote servers, a warning appears that a connection has been disconnected or lost only if
the JDBC remote server attempts to access a proxy object. See “Configuration notes for JDBC
classes” [SQL Anywhere Server - SQL Usage].
○ MobiLink, QAnywhere, And Notifiers Displays statistics for MobiLink, QAnywhere, and
Notifiers. This pane only appears when MobiLink tables and views exist in the database.
Note
You must click the Refresh button to refresh the information in this pane. Unlike the information in
the other panes, the information in this pane is not refreshed when you choose View » Refresh (or
click the Refresh toolbar icon). You must refresh this information separately because refreshing
could affect the database's performance.
○ SQL Remote Users Displays a table of all SQL Remote users, as well as their most recent send
and receive times. This pane only appears when the database has SQL Remote users.
Documenting a database
You can generate documentation about objects in a SQL Anywhere database using the Database
Documentation Wizard. The generated documentation contains information about the following database
objects:
● procedures
● functions
● triggers
● events
● views
In addition to the object definitions, the documentation also shows the dependencies and references for each
object. For example, documentation for the procedure dbo.sa_migrate_data includes the tables that it
updates, inserts into, and deletes from, as well as the name of the procedure that calls it. You can choose to
include object comments and systems procedures in the documentation.
The generated documentation is saved to HTML files, which makes it easy to navigate and review. This
documentation is useful for documenting and reviewing your system.
To generate database documentation
1. In Sybase Central, connect to the database you want to generate documentation for.
2. From the Tools menu, choose SQL Anywhere 11 » Generate Database Documentation.
The Database Documentation Wizard appears.
3. Follow the instructions in the wizard.
Interactive SQL is available on Windows, Solaris, Linux, and Mac OS X, see SQL Anywhere Supported
Platforms and Engineering Status.
dbisql
If you do not include the -c option, which specifies the connection parameters for the database, or if you
supply insufficient connection parameters, the Connect window appears, where you can enter connection
information for the database. See “Connection parameters” on page 248.
To start Interactive SQL and connect to the sample database, run the following command:
For information about the supported options, see “Interactive SQL utility (dbisql)” on page 716.
Tip
You can also access Interactive SQL from within Sybase Central in the following ways:
● Selecting a database, and choosing Open Interactive SQL from the File menu.
● Right-clicking a database, and choosing Open Interactive SQL.
● Right-clicking a stored procedure, and choosing Execute From Interactive SQL. Interactive SQL opens
with a CALL to the procedure in the SQL Statements pane and executes the stored procedure.
● Right-clicking a table or view and choosing View Data In Interactive SQL. Interactive SQL opens with
a SELECT * FROM table-name and executes the query.
dbisql
The following steps can be used if you are using a version of Linux that supports the Linux desktop icons
and if you chose to install them when you installed SQL Anywhere 11.
To start Interactive SQL (Linux desktop icons)
1. From the Applications menu, choose SQL Anywhere 11 » Interactive SQL
Interactive SQL opens, and the Connect window appears.
2. Enter the connection information for your database in the Connect window.
Note
The following steps assume that you have already sourced the SQL Anywhere utilities. See “Setting
environment variables on Unix and Mac OS X” on page 312.
● Results The Results pane has two tabs: Results and Messages. The tabs appear at the bottom of the
Results pane.
The Results tab displays the results of commands that you execute. For example, if you use SQL
statements to search for specific data in the database, the Results tab displays the columns and rows that
match the search criteria in the pane above. You can edit the result set on the Results tab. See “Editing
result sets in Interactive SQL” on page 629.
The Messages tab displays messages from the database server about the SQL statements that you execute
in Interactive SQL.
Results of graphical plans for SQL Anywhere databases and text plans for UltraLite databases are
displayed in separate Plan Viewer window(s). See “Viewing graphical plans in Interactive
SQL” on page 627.
When you are connected to a database from Interactive SQL, the title bar displays connection information,
as follows:
For example, if you connect to the sample database using the SQL Anywhere 11 Sample ODBC data source,
the title bar contains the following information:
You can configure settings for the tabs and panes in Interactive SQL using the Options window.
To customize Interactive SQL
1. In Interactive SQL, choose Tools » Options.
The Options window appears.
2. In the left pane, click a tab and specify the options that you want.
See also
● “Troubleshooting unexpected symbols when viewing data” on page 357
To execute SQL statements individually, for example when debugging, you can use Single Step from the
SQL menu. Single Step executes a specified statement and then selects the next statement to be executed.
To execute the next statement, run Single Step again.
To execute SQL statements one at a time
1. Type your queries in the SQL Statements pane.
2. Place your cursor in the statement that you want to execute.
3. From the SQL menu, choose Single Step or press Shift+F9 to execute the specified statement.
When the SQL statement executes, the next SQL statement is selected.
4. To execute the selected SQL statement, press Shift+F9.
5. Repeat the previous step until there are no more selected statements to execute.
You can also click the Execute Statements button to execute the statements in the SQL Statements pane.
This button can be set to execute all SQL statements or only execute the selected statements.
To configure the Execute Statements toolbar button
1. From the Tools menu, choose Options.
2. Click Toolbar
To execute all SQL statements, select Execute All Statement(s). This is the default setting.
To execute only the selected SQL statements, select Execute Selected Statement(s).
See also
● “Configuring the administration tools” [SQL Anywhere Server - Programming]
Results processing
By default, Interactive SQL shows the first result set of the most-recently executed statement.
To see all the result sets
1. From Tools, choose Options, choose one of the following:
● SQL Anywhere » Results.
● UltraLite » Results.
2. Choose Show All Result Sets.
3. Choose Show results from each statement.
4. Click OK
Tip
You can press F9 to execute only the selected text in the SQL Statements pane.
You can press Shift+F9 to execute only the selected statement in the SQL Statements pane and select the
next statement for execution.
See also
● “Troubleshooting unexpected symbols when viewing data” on page 357
See “Running SQL command files in Interactive SQL” [SQL Anywhere Server - SQL Usage].
For more information about using Interactive SQL with command files, see:
● “Using SQL command files” [SQL Anywhere Server - SQL Usage]
● “Running SQL command files in Interactive SQL” [SQL Anywhere Server - SQL Usage]
Using favorites
In Interactive SQL, you can store frequently-used SQL command files and connections in a favorites list. A
favorites list is specific to a single user and cannot be seen by other users.
To open a favorite
● From the Favorites menu, choose the favorite you want to open.
Recalling commands
When you execute a command, Interactive SQL automatically saves it in a history list that persists between
Interactive SQL sessions. Interactive SQL maintains a record of up to 50 of the most recent commands.
You can view the entire list of commands in the Command History window. To access the Command
History window, press Ctrl+H, or click the Open A List Of Past SQL Statements button on the toolbar.
The most recent commands appear at the bottom of the list. To recall a command, select it and then click
OK. It appears in the SQL Statements pane of Interactive SQL. You can select multiple commands from
the Command History window.
You can also recall commands without the Command History window. Use the Recall Previous SQL
Statement and Recall Next SQL Statement icons in the toolbar to scroll back and forward through your
commands, or press Alt+Right Arrow and Alt+Left Arrow, respectively.
Note
If you execute a SQL statement that contains password information (CREATE USER, GRANT REMOTE
DBA, CONNECT, or CREATE EXTERNLOGIN), the password information appears in the Command
History window for the duration of the current Interactive SQL session.
When the command history is viewed in subsequent Interactive SQL sessions, passwords are replaced with ...
in any of these statements that contain password information. For example, if you execute the following
statement in Interactive SQL:
CREATE USER testuser
IDENTIFIED BY testpassword;
the following statement appears in the Command History window in subsequent Interactive SQL sessions:
CREATE USER testuser
IDENTIFIED BY ...;
Logging commands
With the Interactive SQL logging feature, you can record commands as you execute them. Interactive SQL
continues to record commands until you stop the logging process, or until you end the current session. The
recorded commands are stored in a log file so you can use the commands again.
To begin logging Interactive SQL commands
1. From the SQL menu, choose Start Logging.
2. In the Save As window, specify a location and name for the log file. For example, name the file
mylogs.sql.
3. Click Save when finished.
Tips
You can also start and stop logging by typing in the SQL Statements pane. To start logging, type and execute
START LOGGING 'c:\filename.sql', where c:\filename.sql is the path, name, and extension of the log file.
You only need to include the single quotation marks if the path contains embedded spaces. To stop logging
Interactive SQL commands, type and execute STOP LOGGING.
Once you start logging, all commands that you try to execute are logged, including ones that do not execute
properly.
Inserting comments
Comments are used to attach explanatory text to SQL statements or statement blocks. The database server
does not execute comments. SQL Anywhere supports the following types of comments: -- (double hyphen), //
(double slash), and /* ... */ (slash-asterisk). See “Comments” [SQL Anywhere Server - SQL Reference].
To add or remove comment indicators
● To turn existing text into comments, select the text in the SQL Statements pane and press Ctrl+Minus
Sign(-) to add double hyphen comment indicators or Ctrl+Forward Slash(/) to add double slash comment
indicators. The SQL comment indicator is added to the beginning of each line with selected text.
If no text is selected, the comment indicator is added to the beginning of the current line.
To remove a comment indicator, select the text and press Ctrl+Minus Sign(-) to remove double hyphen
comment indicators or Ctrl+Forward Slash(/)to remove double slash comment indicators.
In the Lookup Table Name and Lookup Procedure Name windows, you can enter the first few characters
of the table or procedure you are looking for. The list is narrowed to include only those items that start with
the text you entered.
You can use the SQL wildcard characters '%' (percent sign) and '_' (underscore) to help narrow your search.
'%' matches any string of zero or more characters, while '_' matches any one character.
For example, to list all the tables that contain the word profile, type %profile%.
If you want to search for a percent sign or underscore within a table name, you must prefix the percent sign
or underscore with an escape character. The escape character for the iAnywhere JDBC driver is '~' (tilde).
Tip
Interactive SQL supports text completion for database object names when you type in the SQL
Statements pane, which can be used as an alternative to looking up table and procedure names. See “Using
text completion” on page 658.
You can also use text completion to find object names, including tables, columns, and procedures. See
“Using text completion” on page 658.
The Query Editor provides a series of tabs that guide you through the components of a SQL query, most of
which are optional. The tabs are presented in the order that SQL queries are usually built:
Tab Description
Tables tab Use this tab to specify the tables in your query.
Joins tab Use this tab to specify a join strategy for combining the data in the tables. If you include
more than one table in your query, you should specify a join strategy for combining
the data in the tables. If you do not specify a join strategy for tables you added in the
Tables tab, the Query Editor suggests one; if there is a foreign key relationship between
the tables, it generates a join condition based on that relationship, or it suggests a cross
product. When you open queries, the Query Editor accepts exactly the join strategy
that you specified (and an unspecified JOIN is not defaulted to KEY JOIN, as it would
be otherwise in SQL Anywhere).
Columns tab Use this tab to specify the columns in your result set. If you do not specify columns,
all columns appear.
WHERE tab Use this tab to specify conditions for restricting the rows in your result set.
GROUP BY tab Use this tab to group rows in the result set.
HAVING tab Use this tab to restrict the rows in your result set based on group values.
Window Description
Expression Editor Use the Expression Editor to build search conditions or define computed columns.
Derived Table Use this window, which is nearly identical to the main Query Editor, to create derived
tables and subqueries.
Each component of the Query Editor has context-sensitive online help that describes how to use the tab, and
provides links into the SQL Anywhere documentation that explain relevant concepts and usage.
You do not need to use SQL code to create queries with the Query Editor. However, you can use SQL with
the Query Editor in the following ways:
● You can create a query in the SQL Statements pane in Interactive SQL, and import it into the Query
Editor by highlighting the code before you open the editor.
● At any time while using the Query Editor, you can click SQL at the bottom of the window to see the
SQL code for the query you are building. You can directly edit the code, and the fields are automatically
updated in the Query Editor.
You can configure the Query Editor from Interactive SQL or Sybase Central so that the SQL is fully
formed, meaning that all table and column names fully qualified and names are quoted. This extra
formatting is not normally necessary, but it ensures that the SQL works in all situations. You can also
choose to get a list of tables on startup.
To configure the Query Editor
● From the Tools menu, choose Options » SQL Anywhere, and then click the Query Editor tab.
The Query Editor builds SQL Anywhere SELECT statements. It is not designed to create views, although
you can create them in Interactive SQL and reference them in the Query Editor. Nor was it designed to create
UPDATE statements or other non-SELECT SQL statements. It creates a single SELECT statement, so it
does not build unions or intersects of SELECT statements. In addition, the Query Editor does not support
Transact-SQL syntax.
See also
● For an introduction to selecting data, see “Querying data” [SQL Anywhere Server - SQL Usage].
● For reference documentation, see “SELECT statement” [SQL Anywhere Server - SQL Reference].
2. Click Open.
3. Select a plan file (.saplan), and then click Open.
See also
● “Reading graphical plans” [SQL Anywhere Server - SQL Usage]
You can also add a header or footer and configure other formatting options in the Interactive SQL
Options window.
To add a header
1. Open the Interactive SQL Options window.
Choose Tools » Options.
2. On the Editor page click the Print tab.
3. In the Header field, specify the text that you want to appear in the header. You can also click the right
arrow and choose items to include in the header.
When editing fails, an Interactive SQL error message appears explaining the error, and the database table
values remain unchanged.
4. Enter the new value. If you want to change other values in the row, press Tab or Shift+Tab to move to
the other values.
5. Press Enter to update the database once you are done editing values in the row.
You can press the Esc key to cancel the change that was made to the selected value.
6. Execute a COMMIT statement to make your changes to the table permanent.
1. From the Tools menu, choose Options, and then choose SQL Anywhere or UltraLite.
2. Ensure that Scrollable Table is selected and select Disable Editing.
3. Click OK.
4. Execute a query.
You must execute a new query for the changes to table editing to take effect.
Inserting rows into the database from the Interactive SQL result set
Interactive SQL allows you to add new rows to a table. You tab between columns in the result set to add
values to the row. You must have INSERT permission on the table to add new rows.
To insert a new row into the result set
1. Right-click the result set and choose Add Row.
A new blank row appears with a blinking cursor in the first value in the row.
2. Enter the new value and then press Tab to move to the next column.
You cannot enter invalid data types into a column. For example, you cannot enter a string into a column
that accepts the INT data type.
Repeat this step until all the column values are added.
3. Press Enter to update the database.
If the result set contains a computed column and you do not specify a value for the computed column, the
value is calculated when the database is updated. However, if you specify a value for the computed column,
the database is updated with the specified value, and a value is not calculated for the computed column.
An alternative to inserting new rows from the result set in Interactive SQL is to add rows using the INPUT
statement with the PROMPT clause. When the PROMPT clause is specified, Interactive SQL prompts you
for the value for each column in the table. For example, to add a new row to the Products table and be
prompted for the values for each column, you would execute the following statement in Interactive SQL:
INPUT INTO Products PROMPT;
You can also change these options from the Interactive SQL Options menu, by choosing Import/Export.
If these options are set to their defaults, the copied data is comma-delimited and all of the strings are enclosed
in single quotes.
● Click a column-header in the Results tab, to sort the results by that column.
When the Results tab does not contain the entire result set, you are prompted to fetch the remaining
results. Otherwise, only the currently fetched results are sorted.
Tip
If the SQLCONNECT environment variable is set, or if you are already connected to a SQL Anywhere
database, the database server attempts to use this information to connect to a database before it prompts
you for information. Likewise, if the ULCONNECT environment variable is set, or if you are already
connected to an UltraLite database, the database server attempts to use this information to connect to a
database before it prompts you for information in. If these attempts fail, or if you are not already connected
to a database, the Connect window appears.
2. In the Connect window, enter the connection information for your database, and click OK to connect.
The connection information (including the database name, your user ID, and the database server name)
appears in the Interactive SQL title bar.
You can also connect to or disconnect from a database with the Connect and Disconnect items in the
SQL menu, or by executing a CONNECT or DISCONNECT statement.
If the underlying source control program does not support an action, its corresponding menu item is disabled.
For example, Visual SourceSafe supports all of these actions, but using a custom (command line) source
control system does not support opening a source control project, or running a source control manager.
For more information about the supported actions, see:
● “Opening source control projects from Interactive SQL” on page 635
● “Checking files out from Interactive SQL” on page 635
● “Checking in files from Interactive SQL” on page 637
● “Additional source control actions” on page 637
You should be familiar with the operations of your source control program before attempting to use it from
Interactive SQL.
bold in this list have commands defined for them, while actions in plain font do not have a command
defined.
If you do not specify a command line for an action, the item in the File » Source Control menu is
disabled.
Tip
You can export your source control command lines to an external file by clicking Export in the Custom
Source Control Options window (accessed by choosing Tools » Options, and then clicking
Configure on the Source Control pane). You can later read these commands back in by clicking
Import in this window. This may be useful if you need to configure Interactive SQL source control
command lines on several computers.
Once you open a file in Interactive SQL, there are two ways you can check the file out: modifying its contents
in the SQL Statements pane, or using the command on the File menu.
When you configure the source control options for Interactive SQL, if you select Automatically Check Out
Files When Editor Contents Are Modified, Interactive SQL attempts to check out a file when you modify
its contents in the SQL Statements pane.
To check out a file using the Interactive SQL File menu
1. Choose File » Open, and then browse to the file you want to open.
The file status appears on the status bar at the bottom of the Interactive SQL window. The status is one
of Checked In, Checked Out, or Not Controlled. Files that are checked in are assumed to be read-only,
and Read-Only appears in the Interactive SQL title bar. The file in the following example is checked
in:
2. Check out the file by choosing File » Source Control » Check Out.
Depending on which source control product you are using, you may be prompted for a comment or other
options as part of the check out procedure.
Caution
If you are using a SCC-compliant source control system, the status is always accurate. However, if you use
the custom source control system, the status is based on whether the file is read-only or not. A read-only file
is assumed to be checked in, but no assumptions are made about editable files because they could be either
checked out or not controlled.
Key(s) Description
Alt+Left Arrow Displays the previous SQL statement in the history list.
Alt+Right Arrow Displays the next SQL statement in the history list.
Key(s) Description
Ctrl+C In the Results pane, copies the selected row(s) and column headings to the
clipboard.
In the SQL Statements pane, copies the selected text to the clipboard.
Ctrl+G Moves the cursor to the specified line in the SQL Statements pane.
Ctrl+L Deletes the current line from the SQL Statements pane and puts the line onto
the clipboard.
Ctrl+N Clears the contents of the Interactive SQL window and closes the current file
(if any).
Ctrl+P Prints the contents of the SQL Statements pane; from the Tools menu, choose
Options, then choose Editor, and then click the Print tab.
Ctrl+S Saves the contents of the SQL Statements pane to the specified file.
Key(s) Description
Ctrl+] Moves the cursor to the matching brace. Use this shortcut to match parentheses,
braces, brackets, and angle brackets.
Ctrl+Shift+] Extends the selection to the matching brace. Use this shortcut to match paren-
theses, braces, brackets, and angle brackets.
Ctrl+Minus Sign (-) Adds and removes the double-hyphen (--) SQL comment indicator.
To turn existing text into comments, select the text in the SQL Statements
pane and press Ctrl+minus sign. The SQL comment indicator is added to the
beginning of each line in the selection.
If no text is selected, the comment indicator is added to the beginning of the
current line.
To remove a comment indicator, select the text and press Ctrl+minus sign.
See “Comments” [SQL Anywhere Server - SQL Reference].
Ctrl+Forward Slash (/) Adds and removes the double-slash (//) SQL comment indicator.
To turn existing text into comments, select the text in the SQL Statements
pane and press Ctrl+forward slash. The SQL comment indicator is added to
the beginning of each line in the selection.
If no text is selected, the comment indicator is added to the beginning of the
current line.
To remove a comment indicator, select the text and press Ctrl+forward slash.
See “Comments” [SQL Anywhere Server - SQL Reference].
Ctrl+Up Arrow Selects the SQL statement preceding the statement that contains the cursor in
the SQL Statements pane.
Ctrl+Down Arrow Selects the SQL statement following the statement that contains the cursor in
the SQL Statements pane.
Ctrl+Period (.) Selects the entire SQL statement containing the cursor in the SQL State-
ments pane.
Ctrl+Comma (,) Selects the line containing the cursor in the SQL Statements pane.
Key(s) Description
Ctrl+Shift+Period (.) Increases the line indentation of selected text in the SQL Statements pane.
If no text is selected, the indentation is applied to the current line.
You can change the number of spaces that are indented; from the Tools menu,
choose Options, then choose Editor, and then click the Tabs tab.
Ctrl+Shift+Comma (,) Decreases line indentation of selected text in the SQL Statements pane.
If no text is selected, the indentation is applied to the current line.
You can change the number of spaces that are indented; from the Tools menu,
choose Options, then choose Editor, and then click the Tabs tab.
F2 Edits the selected value in the result set. You can tab from column to column
within the row.
Shift+F5 Opens the Plan Viewer for the specified statement in the SQL Statements
pane. The specified statement is not executed; to execute the statement in the
Plan Viewer, click Get Plan.
Key(s) Description
Shift+F9 Executes the selected SQL statement, and then selects the next statement. This
shortcut allows you to step through a series of SQL statements. See “Executing
SQL statements from Interactive SQL” on page 616.
Shift+F10 Displays the shortcut menu for the area that has focus.
This keyboard shortcut is an alternative to right-clicking an area.
F11 Opens the Connect window if Interactive SQL is not connected to a database.
Home Moves the cursor to the start of the current line or to the first word on the current
line.
Shift+Home Extends the selection to the start of the text on the current line.
Syntax 2
SET PERMANENT
Syntax 3
SET
Description
Syntax 1 stores the specified Interactive SQL option.
See also
● “SET OPTION statement [Interactive SQL]” [SQL Anywhere Server - SQL Reference]
Allowed values
On, Off
Default
Off
Remarks
If auto_commit is On, a database COMMIT is performed after each successful statement.
By default, a COMMIT or ROLLBACK is performed only when the user issues a COMMIT or ROLLBACK
statement or a SQL statement that causes an automatic commit (such as the CREATE TABLE statement).
See also
● “SET OPTION statement [Interactive SQL]” [SQL Anywhere Server - SQL Reference]
Allowed values
On, Off
Default
On
Remarks
If auto_refetch is On, the current query results that appear on the Results tab in the Interactive SQL
Results pane are refetched from the database after any INSERT, UPDATE, or DELETE statement.
Depending on how complicated the query is, this may take some time. For this reason, it can be turned off.
See also
● “SET OPTION statement [Interactive SQL]” [SQL Anywhere Server - SQL Reference]
Allowed values
On, Off
Default
On
Remarks
Set this option according to your preference.
See also
● “SET OPTION statement [Interactive SQL]” [SQL Anywhere Server - SQL Reference]
Allowed values
String
Default
Semicolon (;)
Remarks
In general, there is no need to change the command delimiter. You should leave it as a semicolon.
An alternative to using a semicolon or another string as a statement delimiter is to enter the separator go on
a line by itself, at the beginning of the line. See “Introduction to batches” [SQL Anywhere Server - SQL
Usage].
Specifying go on its own line at the beginning of the line is always recognized as a command delimiter, even
if you set the command_delimiter option to a different value.
The command_delimiter value can be any string of characters with the following restrictions:
● If the delimiter contains any one of & (ampersand), * (asterisk), @ (at sign), : (colon), . (period), =
(equals), ( (left parentheses), ) (right parentheses), or | (vertical bar), the delimiter must not contain any
other character. For example, * is a valid delimiter, but ** is not.
● You should not use an existing keyword as a command separator. See “Keywords” [SQL Anywhere
Server - SQL Reference].
● The command delimiter can be any sequence of characters (including numbers, letters, and punctuation),
but it cannot contain embedded blanks. As well, it can contain a semicolon, but only as the first character.
If the command delimiter is set to a string beginning with a character that is valid in identifiers, the
command delimiter must be preceded by a space. The command delimiter is case sensitive. You must
enclose the new command delimiter in single quotation marks. When the command delimiter is a
semicolon (the default), no space is required before the semicolon.
See also
● “Interactive SQL utility (dbisql)” on page 716
● “SET OPTION statement [Interactive SQL]” [SQL Anywhere Server - SQL Reference]
Examples
The following example sets the command delimiter to a tilde:
You can also use the Interactive SQL -d option to set the command delimiter without including a SET
OPTION command_delimiter statement in a .sql file. For example, if you have a script file named test.sql
that uses tildes (~) as the command delimiter, you could run:
Allowed values
On, Off
Default
On
Remarks
Controls whether a COMMIT or ROLLBACK is done when you leave Interactive SQL. When
commit_on_exit is set to On, a COMMIT is done.
See also
● “SET OPTION statement [Interactive SQL]” [SQL Anywhere Server - SQL Reference]
Allowed values
Identifier or string
Default
Use system code page (empty string)
Scope
Can be set as a temporary option only, for the duration of the current connection.
Remarks
This option is used to specify the code page to use when reading or writing files. It cannot be set permanently.
The default code page is the default code page for the platform you are running on. On English Windows
computers, the default code page is 1252.
Interactive SQL determines the code page that is used for a particular INPUT, OUTPUT, or READ statement
as follows, where code page values occurring earlier in the list take precedence over those occurring later
in the list:
● the code page specified in the ENCODING clause of the INPUT, OUTPUT, or READ statement
● the code page specified with the default_isql_encoding option (if this option is set)
● the default code page for the computer Interactive SQL is running on
For more information about code pages and character sets, see “International language and character set
tasks” on page 369.
See also
● “READ statement [Interactive SQL]” [SQL Anywhere Server - SQL Reference]
● “INPUT statement [Interactive SQL]” [SQL Anywhere Server - SQL Reference]
● “OUTPUT statement [Interactive SQL]” [SQL Anywhere Server - SQL Reference]
● “Overview of character sets, encodings, and collations” on page 353
● “SET OPTION statement [Interactive SQL]” [SQL Anywhere Server - SQL Reference]
Example
Set the encoding to UTF-16 (for reading Unicode files):
SET TEMPORARY OPTION default_isql_encoding = 'UTF-16';
Allowed values
On, Off
Default
On
Remarks
This option is most useful when you use the READ statement to execute an Interactive SQL command file.
Logging must be turned on for this option to take effect. See “START LOGGING statement [Interactive
SQL]” [SQL Anywhere Server - SQL Reference].
See also
● “SET OPTION statement [Interactive SQL]” [SQL Anywhere Server - SQL Reference]
Allowed values
String (see below for allowed values)
Default
TEXT
Remarks
Allowable input formats are:
● TEXT Input lines are assumed to be text characters, one row per line, with values separated by commas.
Alphabetic strings can be enclosed in apostrophes (single quotes) or quotation marks (double quotes).
Strings containing commas must be enclosed in either single or double quotes. If single or double quotes
are used, double the quote character to use it within the string. Optionally, you can use the DELIMITED
BY clause to specify a different delimiter string than the default, which is a comma (,).
Three other special sequences are also recognized. The two characters \n represent a newline character,
\\ represents a single backslash character, and the sequence \xDD, where DD is the hexadecimal
representation of a character, represents the character with hexadecimal code DD.
● FIXED Input lines are in fixed length format.
See also
● “INPUT statement [Interactive SQL]” [SQL Anywhere Server - SQL Reference]
● “SET OPTION statement [Interactive SQL]” [SQL Anywhere Server - SQL Reference]
Allowed values
On, Off, Prompt
Default
Prompt
Remarks
This option controls whether the database server can read files on the client computer. On means reading is
allowed. Off means reading is not allowed. Prompt means prompt the user for the action to take.
This option is stored on a per-connection basis and persists only for the duration of the connection. You can
set this option using the SET TEMPORARY OPTION statement. If you omit the TEMPORARY keyword,
Interactive SQL reports an error.
This option allows a data file to be read without user intervention in cases where LOAD TABLE is executed
from a stored procedure or trigger.
READCLIENTFILE authority is required to read a file on a client computer.
See also
● “Accessing data on client computers” [SQL Anywhere Server - SQL Usage]
● “READCLIENTFILE authority” on page 396
● “READ_CLIENT_FILE function [String]” [SQL Anywhere Server - SQL Reference]
● “SET OPTION statement [Interactive SQL]” [SQL Anywhere Server - SQL Reference]
● “LOAD TABLE statement” [SQL Anywhere Server - SQL Reference]
● “allow_read_client_file option [database]” on page 448
● “allow_write_client_file option [database]” on page 449
● “isql_allow_write_client_file option [Interactive SQL]” on page 649
● “Security of client side data” [SQL Anywhere Server - SQL Usage]
Allowed values
On, Off, Prompt
Default
Prompt
Remarks
This option controls whether the database server can write to files on the client computer. On means writing
is allowed. Off means writing is not allowed. Prompt means prompt the user for the action to take.
This option is stored on a per-connection basis and persists only for the duration of the connection. You can
set this option using the SET TEMPORARY OPTION statement. If you omit the TEMPORARY keyword,
Interactive SQL reports an error.
WRITECLIENTFILE authority is required to write a file on a client computer.
See also
● “Accessing data on client computers” [SQL Anywhere Server - SQL Usage]
● “WRITECLIENTFILE authority” on page 397
● “WRITE_CLIENT_FILE function [String]” [SQL Anywhere Server - SQL Reference]
● “SET OPTION statement [Interactive SQL]” [SQL Anywhere Server - SQL Reference]
● “UNLOAD statement” [SQL Anywhere Server - SQL Reference]
● “allow_write_client_file option [database]” on page 449
● “allow_read_client_file option [database]” on page 448
● “isql_allow_read_client_file option [Interactive SQL]” on page 648
● “Security of client side data” [SQL Anywhere Server - SQL Usage]
Allowed values
On, Off
Default
On
Remarks
This boolean option controls whether SQL statements are timed or not. If you set the option to On, the time
of execution appears in the Messages pane after you execute a statement. If you set the option to Off, the
time does not appear.
You can also set this option on the Messages tab of the Options window.
See also
● “SET OPTION statement [Interactive SQL]” [SQL Anywhere Server - SQL Reference]
Allowed values
Any single character
Default
A backslash ( \ )
Remarks
When Interactive SQL exports strings that contain unprintable characters (such as a carriage return), it
converts each unprintable character into a hexadecimal format and precedes it with an escape character. The
character you specify for this setting is used in the output if your OUTPUT statement does not contain an
ESCAPE CHARACTER clause. This setting is used only if you are exporting to an text file.
See also
● “isql_quote option [Interactive SQL]” on page 652
● “SET OPTION statement [Interactive SQL]” [SQL Anywhere Server - SQL Reference]
Example
Create a table that contains one string value with an embedded carriage return (denoted by the "\n" in the
INSERT statement). Then export the data to c:\escape.txt with a # sign as the escape character.
'one#x0Atwo'
The pound sign (#) is the escape character and x0A is the hexadecimal equivalent of the \n character.
The start and end characters (in this case, single quotation marks) depend on the isql_quote setting.
Allowed values
String
Default
A comma (,)
Remarks
Controls the default string used for separating (or delimiting) values in data exported to text files. If an
OUTPUT statement does not contain a DELIMITED BY clause, the value of this setting is used.
See also
● “isql_quote option [Interactive SQL]” on page 652
● “SET OPTION statement [Interactive SQL]” [SQL Anywhere Server - SQL Reference]
● “isql_escape_character option [Interactive SQL]” on page 650
Example
The first example sets the field separator to a colon in the data exported to c:\Employees.txt.
'Whitney': 'Fran'
'Cobb':'Matthew'
'Chin':'Philip'
'Jordan':'Julie'
The start and end characters (in this case, single quotation marks) depend on the isql_quote setting.
The next example sets the field separator to a tab in the data exported to c:\Employees.txt.
Surname GivenName
'Whitney' 'Fran'
'Cobb' 'Matthew'
'Chin' 'Philip'
'Jordan' 'Julie'
The start and end characters (in this case, single quotation marks) depend on the isql_quote setting. The
escape character (in this case the backslash) depends on the isql_escape_character setting.
Allowed values
ALL or a non-negative integer
Default
500
Remarks
This option lets you specify the maximum number of rows that appear in the Results pane. You can also set
the value for this option in the Options window in Interactive SQL.
Caution
Interactive SQL can run out of memory when displaying large result sets. If this problem occurs, Interactive
SQL reports the problem but will not display the result set.
See also
● “SET OPTION statement [Interactive SQL]” [SQL Anywhere Server - SQL Reference]
Allowed values
LAST, ALL, NONE
Default
LAST
Remarks
The isql_print_result_set option takes effect only when you run Interactive SQL as a command line program
(for example, when running a .sql file).
This option allows you to specify which result set(s) are printed when a .sql file is run.
You can choose one of the following print options:
● LAST Prints the result set from the last statement in the file.
● ALL Prints result sets from each statement in the file which returns a result set.
● NONE Does not print any result sets.
Although this option has no effect when Interactive SQL is running in windowed mode, you can still view
and set the option in windowed mode. Choose Tools » Options. On the Results tab, select the appropriate
action under Console Mode.
See also
● “SET OPTION statement [Interactive SQL]” [SQL Anywhere Server - SQL Reference]
Controls the default string that begins and ends all strings in data exported to text files.
Allowed values
String
Default
A single apostrophe (')
Remarks
Controls the default string that begins and ends all strings in data exported to text files. If an OUTPUT
statement does not contain a QUOTE clause, this value is used by default.
See also
● “isql_field_separator option [Interactive SQL]” on page 650
● “SET OPTION statement [Interactive SQL]” [SQL Anywhere Server - SQL Reference]
Example
To change the default string that begins and ends all strings to a double quote character.
SET OPTION isql_quote='"';
SELECT Surname, GivenName FROM Employees WHERE EmployeeID < 150;
OUTPUT TO c:\Employees.txt FORMAT TEXT;
The separator characters (in this case, commas) depend on the isql_field_separator setting.
Allowed values
On, Off
Default
Off
Remarks
Set this option to On if you want Interactive SQL to display multiple result sets in the Results pane when
you execute a procedure that returns multiple SELECT statements.
Each result set appears on a separate tab in the Results pane. By default, Interactive SQL does not display
multiple result sets. The setting of this option also applies to Interactive SQL when it is running as a command
line program.
See also
● “SET OPTION statement [Interactive SQL]” [SQL Anywhere Server - SQL Reference]
Allowed values
String
Default
(NULL)
Remarks
Set this option according to your preference. Note that this value is not used when saving result sets to a file.
The value used when saving to a file is specified by the output_nulls option.
See also
● “SET OPTION statement [Interactive SQL]” [SQL Anywhere Server - SQL Reference]
● “output_nulls option [Interactive SQL]” on page 656
Allowed values
String (see below for allowed values)
Default
Prompt
Remarks
Controls what happens if an error is encountered while executing statements, as follows:
● Stop Interactive SQL stops executing statements.
● Prompt Interactive SQL prompts the user to see if they want to continue.
● Continue The error is ignored and Interactive SQL continues executing statements.
● Exit Interactive SQL shuts down.
● Notify_Continue The error is reported, and the user is prompted to press Enter or click OK to
continue.
● Notify_Stop The error is reported and the user is prompted to press Enter or click OK to stop executing
statements.
● Notify_Exit The error is reported and the user is prompted to press Enter or click OK to shut down
Interactive SQL.
When you are executing a .sql file, the values Stop and Exit are equivalent. If you specify either of these
values, Interactive SQL shuts down.
See also
● “SET OPTION statement [Interactive SQL]” [SQL Anywhere Server - SQL Reference]
Allowed values
String (see below for allowed values)
Default
TEXT
Remarks
The valid output formats are:
● TEXT The output is a TEXT format file with one row per line in the file. All values are separated by
commas, and strings are enclosed in apostrophes (single quotes). The delimiter and quote strings can be
changed using the DELIMITED BY and QUOTE clauses. If All is specified in the QUOTE clause, then
all values (not just strings) are quoted.
Three other special sequences are also used. The two characters \n represent a newline character; \\
represents a single backslash character, and the sequence \xDD represents the character with hexadecimal
code DD.
● FIXED The output is fixed format, with each column having a fixed width. The width for each column
can be specified using the COLUMN WIDTH clause. If this clause is omitted, the width for each column
is computed from the data type for the column, and is large enough to hold any value of that data type.
No column headings are output in this format.
● HTML The output is in HTML format.
● SQL The output is an Interactive SQL INPUT statement required to recreate the information in the
table.
● XML The output is an XML file encoded in UTF-8 and containing an embedded DTD. Binary values
are encoded in CDATA blocks with the binary data rendered as 2-hex-digit strings.
See also
● “SET OPTION statement [Interactive SQL]” [SQL Anywhere Server - SQL Reference]
Allowed values
Non-negative integer
Default
0 (no truncation)
Remarks
This option controls the maximum length of column values when Interactive SQL exports data to an external
file (using output redirection with the OUTPUT statement). This option affects only the TEXT, HTML, and
SQL output formats.
See also
● “SET OPTION statement [Interactive SQL]” [SQL Anywhere Server - SQL Reference]
Allowed values
String
Default
Empty string
Remarks
This option controls the way NULL values are written by the OUTPUT statement. Every time a NULL value
is found in the result set, the string from this option is returned instead. This option affects only the TEXT,
HTML, FIXED, and SQL output formats.
See also
● “SET OPTION statement [Interactive SQL]” [SQL Anywhere Server - SQL Reference]
Allowed values
Integer
Default
256
Remarks
The truncation_length option limits the length of displayed column values. The unit is in characters. A value
of 0 means that column values are not truncated. The default truncation length is 256.
See also
● “SET OPTION statement [Interactive SQL]” [SQL Anywhere Server - SQL Reference]
If you open the text completion window after SELECT, the list contains column names in the Employees
table, as well as stored procedures and SQL functions.
If you open the text completion window after FROM, the list contains only tables and stored procedures.
If you open the text completion window after the e in the WHERE clause, the list contains only columns in
the table whose alias is e.
To use text completion
1. In Interactive SQL, type the first letter of a database object name in the SQL Statements pane.
2. Press Ctrl+Space or Ctrl+Shift+Space.
A window appears listing the names of database objects that begin with the letter(s) you have typed so
far. In the following example, it shows all database objects that begin with the letter F.
If you do not see the object name you want, press Tab to view a complete list of database objects (based
on the filtering options you set—by default, all database objects appear in the list).
3. Select the object name from the list and then press Enter.
The object name appears in the SQL Statements pane.
You can configure the text completion settings from the Options window in Interactive SQL or when you
are in a text editor window in Sybase Central.
Key Description
Ctrl+P Shows only stored procedures and functions in the text completion list.
Key Description
Ctrl+S Changes the contents of the list to show or hide system objects.
Ctrl+Shift+Space Opens the text completion window. You can also use Ctrl+Space to open the
text completion window.
Escape Closes the text completion window without adding any text.
Tab Toggles between a list of all database object names and a list of names that
match what has been typed so far.
* For tables, inserts a comma separated list of columns, including data types.
For stored procedures, inserts the procedure name, followed by a comma-
separated list of parameter names and their data types.
" Completes the name, enclosing it in quotation marks, regardless of the setting
of the quoted_identifier option. See “quoted_identifier option [compatibili-
ty]” on page 509.
If you do not include the -c option, which specifies the connection parameters for the database, or if you
supply insufficient connection parameters, the Connect window appears, where you can enter connection
information for the database.
For information about the supported options, see “SQL Anywhere Console utility
(dbconsole)” on page 758.
The following command starts the SQL Anywhere Console utility and connects to the sample database:
dbconsole -c "UID=DBA;PWD=sql;DSN=SQL Anywhere 11 Demo"
The following steps can be used if you are using a version of Linux that supports the Linux desktop icons
and if you chose to install them when you installed SQL Anywhere 11.
To start the SQL Anywhere Console utility (Linux desktop icons)
1. From the Applications menu, choose SQL Anywhere 11 » DBConsole
The SQL Anywhere Console utility opens, and the Connect window appears.
2. Enter the connection information for your database in the Connect window.
Note
The following steps assume that you have already sourced the SQL Anywhere utilities. See “Setting
environment variables on Unix and Mac OS X” on page 312.
The SQL Anywhere Console utility opens, and the Connect window appears.
2. Enter the connection information for your database in the Connect window.
You can configure the information that appears in each pane using the Options window.
To customize the contents of the Connections pane
1. In the SQL Anywhere Console utility, choose File » Options.
The Options window appears.
2. Click Connection Viewer in the left pane.
3. On the Connection Viewer tab, select the properties you want to appear in the Connections pane.
dbsupport -iu
See also
● “Error reporting in SQL Anywhere” on page 71
● “Support utility (dbsupport)” on page 764
Contents
Administration utilities overview ................................................................................. 669
Backup utility (dbbackup) .......................................................................................... 672
Broadcast Repeater utility (dbns11) .......................................................................... 677
Certificate Creation utility (createcert) ....................................................................... 679
Certificate Viewer utility (viewcert) ............................................................................. 682
Data Source utility (dbdsn) ........................................................................................ 684
Erase utility (dberase) ................................................................................................ 696
File Hiding utility (dbfhide) ......................................................................................... 698
Histogram utility (dbhist) ............................................................................................ 700
Information utility (dbinfo) .......................................................................................... 702
Initialization utility (dbinit) ........................................................................................... 703
Interactive SQL utility (dbisql) .................................................................................... 716
Interactive SQL utility (dbisqlc) .................................................................................. 720
Key Pair Generator utility (createkey) ........................................................................ 722
Language Selection utility (dblang) ........................................................................... 723
Log Transfer Manager utility (dbltm) .......................................................................... 726
Log Translation utility (dbtran) ................................................................................... 731
Ping utility (dbping) .................................................................................................... 736
Rebuild utility (rebuild) ............................................................................................... 739
Script Execution utility (dbrunsql) .............................................................................. 740
Server Enumeration utility (dblocate) ........................................................................ 742
Server Licensing utility (dblic) .................................................................................... 745
Service utility (dbsvc) for Windows ............................................................................ 748
Service utility (dbsvc) for Linux .................................................................................. 754
SQL Anywhere Console utility (dbconsole) ............................................................... 758
Start Server in Background utility (dbspawn) ............................................................ 760
Stop Server utility (dbstop) ........................................................................................ 762
Support utility (dbsupport) ......................................................................................... 764
Transaction Log utility (dblog) ................................................................................... 773
See also
● “Using Sybase Central” on page 594
● “Using Interactive SQL” on page 612
The @data parameter can occur at any point in the command line, and parameters contained in the file are
inserted at that point. You can use @data multiple times on one command line to specify multiple
configuration files.
Utilities read the command line by expanding the specified configuration files and reading the entire
command line from left to right. If you specify options that are overridden by other options in the command
line, the option closer to the end of the line wins. In some cases, conflicting options result in an error.
Note
The Start Server in Background utility (dbspawn) does not expand configuration files specified by the @data
option.
If you want to protect passwords or other information in the configuration file, you can use the File Hiding
utility to obfuscate the contents of the configuration file.
For more information about obfuscating the contents of a configuration file, see “File Hiding utility
(dbfhide)” on page 698.
Example
The following configuration file holds a set of options for the Validation utility (dbvalid):
#Connect to the sample database as the user DBA with password sql
-c "UID=DBA;PWD=sql;DBF=samples-dir\demo.db"
#Perform an express check on each table
-fx
#Log output messages to the specified file
-o "c:\validationlog.txt
Syntax
configuration-file= text...
conditional :
#if condition
text
[ #elif condition
text
] ...
[ #else
text
] ...
#endif
Usage
To be treated as a directive, the first non-whitespace character on a line must be #. When a utility is
encountered in an #if or #elif directive, the lines that follow the directive are included until another
conditional directive is encountered. The #else directive handles the condition where the utility has not been
found in the preceding blocks. The #endif directive completes the conditional directive structure.
Blank spaces are not permitted anywhere within the list of tool names specified by tool=. You can nest
conditional directives. If an error occurs while parsing the configuration file, the utility reports that the
configuration file cannot be opened.
Example
The following configuration file can be used by dbping, dbstop, and dbvalid.
#if tool=dbping,dbstop,dbvalid
#always make tools quiet
-q
-c "UID=DBA;PWD=sql;ENG=myserver;DBN=mydb"
#if dbping
#make a database connection
-d
#elif tool=dbstop
#don't ask
-y
#else
#must be dbvalid
#use WITH EXPRESS CHECK
-fx
#endif
#endif
Syntax
dbbackup [ options ] target-directory
Option Description
@data Reads in options from the specified environment variable or configuration file. See “Using
configuration files” on page 669.
If you want to protect passwords or other information in the configuration file, you can use
the File Hiding utility to obfuscate the contents of the configuration file. See “File Hiding
utility (dbfhide)” on page 698.
-b block- Specifies the maximum block size (in number of pages) to be used to transfer pages from
size the database server to dbbackup. The dbbackup utility tries to allocate this number of pages;
if it fails, it repeatedly reduces this value by half until the allocation succeeds. The default
size is 128 pages.
-c "key- Specifies connection parameters. The user ID must have DBA authority or REMOTE DBA
word=val- authority to connect to the database. See “Connection parameters” on page 248.
ue; ..."
For example, the following command backs up the sample database running on the server
sample_server, connecting as the DBA user, into the SQLAnybackup directory:
dbbackup -c "ENG=sample_server;DBN=demo;UID=DBA;PWD=sql"
SQLAnybackup
-d Backs up the main database files only, without backing up the transaction log file, if one
exists.
Option Description
-k check- Specifies how dbbackup processes the database files before writing them to the destination
point-log- directory. The choice of whether to apply pre-images during a backup, or copy the check-
copy-option point log as part of the backup, has performance implications. If the -s option is specified
to perform the backup on the server, the default setting for -k is auto; otherwise, the default
setting is copy.
auto The database server checks the amount of available disk space on the volume hosting
the backup directory. If there is at least twice as much disk space available as the size of the
database at the start of the backup, then the backup proceeds as if copy was specified.
Otherwise, it proceeds as if nocopy was specified. This setting can only be used if -s is also
specified.
copy The backup reads the database files without applying pre-images for any modified
pages. The checkpoint log in its entirety, as well as the system dbspace, is copied to the
backup directory. The next time the database is started, the database server automatically
recovers the database to its state as of the checkpoint at the start of the backup.
Because page pre-images do not have to be written to the temporary file, using this option
can provide better backup performance and reduce internal server contention for other con-
nections that are operating during a backup. However, since the backup copy of the database
file includes the checkpoint log, which has pre-images of any pages modified since the start
of the backup, the backed-up copy of the database files may be larger than the database files
at the time the backup started. The copy option should be used when disk space in the
destination directory is not an issue.
nocopy The checkpoint log is not copied as part of the backup. This option causes pre-
images of modified pages to be saved in the temporary file so that they can be applied to
the backup as it progresses. The backup copies of the database files will be the same size
as the database when the backup operation commenced. The backup copies may actually
be slightly smaller because the checkpoint log is not present in this copy. This option results
in smaller backed up database files, but the backup may proceed more slowly, and possibly
decrease performance of other operations in the database server. It is useful in situations
where space on the destination drive is limited.
recover The database server copies the checkpoint log (as with the copy option), but
applies the checkpoint log to the database when the backup is complete. This restores the
backed up database files to the same state (and size) that they were in at the start of the
backup operation. This option is useful if space on the backup drive is limited (it requires
the same amount of space as the copy option for backing up the checkpoint log, but the
resulting file size is smaller). This setting can only be used if -s is also specified.
Option Description
-l filename Enables a secondary system to be brought up rapidly in the event of a server crash. A live
backup does not stop. It continues running while the server runs. It runs until the primary
server becomes unavailable. At that point, it shuts down, but the backed up log file is intact
and can be used to bring a secondary system up quickly. See “Differences between live
backups and transaction log mirrors” on page 866 and “Making a live back-
up” on page 884.
If you specify -l, then you cannot use -s to create an image back up on the server.
-n Changes the naming convention of the backup transaction log file to yymmddxx.log, where
xx are sequential letters ranging from AA to ZZ and yymmdd represents the current year,
month, and day. This option is used in conjunction with -r.
The backup copy of the transaction log file is stored in the directory specified in the com-
mand, and with the yymmddxx.log naming convention. This allows backups of multiple
versions of the transaction log file to be kept in the same backup directory.
You can also use both the -x option and the -n option to rename the log copy. For example
dbbackup -c "UID=DBA;PWD=sql" -x -n mybackupdir
-q Does not display output messages. This option is available only when you run this utility
from a command prompt.
-r Renames the transaction log and starts a new transaction log. It forces a checkpoint and
causes the following three steps to occur:
1. The current working transaction log file is copied and saved to the directory specified
in the command.
2. The current transaction log remains in its current directory, but is renamed using the
format yymmddxx.log, where xx are sequential characters starting at AA and running
through to ZZ, and yymmdd represents the current year, month, and day. This file is then
no longer the current transaction log.
3. A new transaction log file is generated that contains no transactions. It is given the name
of the file that was previously considered the current transaction log, and is used by the
database server as the current transaction log.
Do not use this option if you are using database mirroring. See “Database mirroring and
transaction log files” on page 935.
Option Description
-s Creates an image backup on the server using the BACKUP DATABASE statement. If you
specify the -s option, the -l option (to create a live backup of the transaction log) cannot be
used. The directory specified is relative to the server's current directory, so it is recommen-
ded that you specify a full pathname. In addition, the server must have write permissions
on the specified directory. When -s is specified, the Backup utility does not display progress
messages and does not prompt you when it overwrites existing files. If you want to be
prompted when an attempt is made to overwrite an existing file, do not specify -s or -y. You
must specify -s if you specify the -k recover option.
-t Creates a backup that can be used as an incremental backup since the transaction log can
be applied to the most recently backed up copy of the database file(s).
-x Backs up the existing transaction log, deletes the original log, and then starts a new trans-
action log. Do not use this option if you are using database mirroring. See “Database
mirroring and transaction log files” on page 935.
Caution
Using this option can result in a database that cannot be recovered from media failure. You
should only use this option when data loss is acceptable.
-xo Deletes the current transaction log and starts a new one. This operation does not perform a
backup; its purpose is to free up disk space in non-replication environments. Do not use this
option if you are using database mirroring. See “Database mirroring and transaction log
files” on page 935.
-y Creates the backup directory or replaces a previous backup file in the directory without
confirmation. If you want to be prompted when an attempt is made to overwrite an existing
file, do not specify -s or -y.
target-di- Specifies the directory the backup files are copied to. If the directory does not exist, it is
rectory created. However, the parent directory must exist. By default, the Backup utility creates a
client-side backup of the database files. You can specify -s to create a backup on the server
using the BACKUP DATABASE statement.
Remarks
The Backup utility makes a backup copy of all the files for a single database. A simple database consists of
two files: the main database file and the transaction log. More complicated databases can store tables in
multiple files, with each file as a separate dbspace. All backup file names are the same as the database file
names. The image backup created by the Backup utility consists of a separate file for each file that is backed
up.
For more information about making archive backups (a single file that contains both the database file and
the transaction log), see “Making archive backups” on page 861.
Using the Backup utility on a running database is equivalent to copying the database files when the database
is not running. You can use the Backup utility to back up the database while other applications or users are
using it.
If neither of the options -d or -t are used, all database files are backed up.
By default, the Backup utility creates a client-side backup of the database files. You can specify -s to create
a backup on the server using the BACKUP DATABASE statement.
For information about performing server-side backups, see “BACKUP statement” [SQL Anywhere Server -
SQL Reference].
Caution
Backup copies of the database and transaction log must not be changed in any way. If there were no
transactions in progress during the backup, or if you specified BACKUP DATABASE WITH
CHECKPOINT LOG RECOVER or WITH CHECKPOINT LOG NO COPY, you can check the validity of
the backup database using read-only mode or by validating a copy of the backup database.
However, if transactions were in progress, or if you specified BACKUP DATABASE WITH CHECKPOINT
LOG COPY, the database server must perform recovery on the database when you start it. Recovery modifies
the backup copy, which is not desirable.
In addition to dbbackup, you can access the Backup utility in the following ways:
● From Sybase Central, using the Create Backup Images Wizard. See “Making image
backups” on page 856.
● From Interactive SQL, using the BACKUP DATABASE statement. See “BACKUP statement” [SQL
Anywhere Server - SQL Reference].
For more information about recommended backup procedures, see “Backup and data
recovery” on page 847.
Exit codes are 0 (success) or non-zero (failure).
For more information about exit codes, see “Software component exit codes” [SQL Anywhere Server -
Programming].
Syntax
dbns11 [ options ] [ address ... ]
Options
Option Description
@data Use this option to read in options from the specified environment variable or configuration
file. See “Using configuration files” on page 669.
If you want to protect passwords or other information in the configuration file, you can use
the File Hiding utility to obfuscate the contents of the configuration file. See “File Hiding
utility (dbfhide)” on page 698.
-ap port Specify the port number used by the database server. The default port number is 2638.
-m ip Specify the IP address of the computer the DBNS process is running on. This parameter is
required for computers with more than one IP address. This address must be an IPv4 address.
-o file Write the output that appears in the Broadcast Repeater Messages window to the named file.
-p port Use this option to specify the port number used by the DBNS Broadcast repeater. The default
is 3968. If there is a firewall between the subnets, then you must open the port number used
by the Broadcast Repeater utility for TCP connections between DBNS processes, in addition
to opening port 2638 for standard client-server communications.
-s When you start the Broadcast Repeater with this option specified, the new DBNS process
checks if another DBNS process is already running on that subnet, and returns an error before
shutting down if another DBNS process is found.
-x host Specify this option to shut down the DBNS process running on specified host. You can specify
an IP address or host name.
-z When running in debug mode, a line appears in the Broadcast Repeater messages window for
each SQL Anywhere broadcast packet that is received or forwarded. Debug mode should only
be used when there are connectivity problems because of the verbosity of the debugging output.
address Use this option to specify the IP address or host name of other computers that are, or will be,
running DBNS processes. This allows the DBNS processes to detect each other and exchange
information about known database servers and other DBNS processes.
Remarks
The Broadcast Repeater allows SQL Anywhere clients to find SQL Anywhere database servers running on
other subnets and through firewalls where UDP broadcasts normally do not reach, without using the HOST
connection parameter or LDAP.
The address can be either an IP address or a computer name. Use spaces to separate multiple addresses.
This utility is available on all 32-bit and 64-bit Windows platforms, as well as all supported Unix platforms.
The clients and database server must be running SQL Anywhere 9.0.2 or later to use the Broadcast Repeater.
Caution
It is recommended that you do not run the dbns11 utility on the same computer as a SQL Anywhere database
server because it is possible that dbns11 or the database server may not receive UDP broadcasts.
See also
● “Locating a database server using the Broadcast Repeater utility” on page 109
Example
Suppose you want to allow computers on the subnets 10.50.83.255 and 10.50.125.255 to connect using
broadcasts. You need to a computer on the 10.50.83.255 subnet (Computer A at 10.50.83.114) and one
computer on the 10.50.125.255 subnet (Computer B at 10.50.125.103).
On each of these two computers, run dbns11, passing the IP address of the other computer. Execute the
following command on Computer A:
dbns11 10.50.125.103
If either computer has more than one IP address, you must also specify the local IP address using the -m
option. For example, on Computer A, you would use the following command:
dbns11 -m 10.50.83.114 10.50.125.103
Syntax
createcert [ -r | -s ]
Option Description
-r Creates a PKCS10 certificate request. When this option is specified, createcert does not
prompt for a signer or any other information used to sign a certificate.
-s filename Signs the PKCS10 certificate request that is in the specified file. The request can be DER or
PEM encoded. When this option is specified, createcert does not prompt for key generation
or subject information.
Remarks
Users may typically go to a third party to purchase certificates. These certificate authorities provide their
own tools for creating certificates. The following tools may be especially useful to create certificates for
development and testing purposes, and can also be used for production certificates.
To create a signed certificate, use createcert without options. If you want to break up the process into two
steps, for example so one person creates a request and another person signs it, the first person can run
createcert with -r to create a request and the second person can sign the request by running createcert with
-s.
When you run createcert, you are prompted for the following information. When you specify the -r or -s
option, some of these prompts do not appear.
● Choose encryption type This prompt only appears if you have purchased a license for ECC
encryption. Choose RSA or ECC.
● Enter RSA key length (512-16384) This prompt only appears if you chose RSA encryption. You
can choose a length between 512 bits and 16384 bits.
● Enter ECC curve This prompt only appears if you have purchased a license for ECC encryption and
you chose the ECC encryption type above. You are prompted to choose from a list of ECC curves. The
default is sect163k1.
● Subject information You must enter the following information, which identifies the entity:
○ Country Code
○ State/Province
○ Locality
○ Organization
○ Organizational Unit
○ Common Name
● Enter file path of signer's certificate Optionally, supply a location and file name for the signer's
certificate. If you supply this information, the generated certificate is a signed certificate. If you do not
supply this information, then the generated certificate is a self-signed root certificate.
● Enter file path of signer's private key Supply a location and file name to save the private key
associated with the certificate request.
● Enter password for signer's private key Optionally, supply a password with which to encrypt the
private key. If you do not supply a password, the private key is not encrypted.
● Serial number Optionally, supply a serial number. The serial number must be a hexadecimal string
of 40 digits or less. This number must be unique among all certificates signed by the current signer. If
you do not supply a serial number, createcert generates a GUID as the serial number.
● Certificate will be valid for how many years (1-100) Specify the number of years (between 1 and
100) that the certificate is valid. After this period, the certificate expires, along with all certificates it
signs.
● Certificate Authority (y)es or (n)o Indicate whether this certificate can be used to sign other
certificates. By default, certificates are not certificate authorities (n).
● Key usage Supply a comma-separated list of numbers that indicate how the certificate's private key
can be used. This is an advanced option; the default should be acceptable for most situations. The default
depends on whether the certificate is a certificate authority or not.
● File path to save request This prompt only appears if you specify the -r option. Supply a location
and file name for the PCKS10 certificate request.
● Enter file path to save certificate Supply a location and file name to save the certificate. The
certificate is not saved unless you specify a location and file name.
● Enter file path to save private key This prompt only appears if you specified the -r option and you
supplied a file in the previous prompt. Supply a location and file name to save the private key associated
with the certificate request.
If you did not specify the -r option, supply a location and file name to save the private key. The private
key is not saved unless you specify a location and file name.
● Enter password to protect private key Optionally, supply a password with which to encrypt the
private key. The private key is not encrypted if you do not supply a password.
● Enter file path to save identity Supply a location and file name to save the identity. The identity
file is a concatenation of the certificate, signer, and private key. This is the file that you supply to the
server at startup. If the private key was not saved, createcert prompts for a password to save the private
key. Otherwise, it uses the password provided earlier. The identity is not saved unless you provide a file
name. If you do not save the identity file, you can manually concatenate the certificate, signer, and private
key files into an identity file.
See also
● “Certificates” on page 978
● “Certificate Viewer utility (viewcert)” on page 682
● “-ec server option” on page 170
● “Encryption connection parameter [ENC]” on page 266
● “FIPS-approved encryption technology” on page 979
Example
The following example creates a signed certificate. In the example, no file name is provided for the signer's
certificate, which makes it a self-signed root certificate.
>createcert
SQL Anywhere X.509 Certificate Generator Version 11.0.1.3330
Choose encryption type ((R)SA or (E)CC): r
Enter RSA key length (512-16384): 1024
Generating key pair...
Country Code: CA
State/Province: Ontario
Locality: Waterloo
Organization: Sybase iAnywhere
Organizational Unit: Engineering
Common Name: Test Certificate
Enter file path of signer's certificate:
Certificate will be a self-signed root
Serial number [generate GUID]:
Generated serial number: bfb89a26fb854955954cabc4d056e177
Certificate valid for how many years (1-100): 10
Certificate Authority (Y/N) [N]: n
1. Digital Signature
2. Nonrepudiation
3. Key Encipherment
4. Data Encipherment
5. Key Agreement
6. Certificate Signing
7. CRL Signing
8. Encipher Only
9. Decipher Only
Key Usage [3,4,5]: 3,4,5
Enter file path to save certificate: cert.pem
Enter file path to save private key: key.pem
Enter password to protect private key: pwd
Enter file path to save identity: id.pem
To generate an enterprise root certificate (a certificate that signs other certificates), a self-signed root
certificate should be created with Certificate Authority. The procedure is similar to that shown above.
However, the response to the Certificate Authority prompt should be yes and choice for roles should be
option 6,7 (the default).
Certificate Authority (Y/N) [N]: y
1. Digital Signature
2. Nonrepudiation
3. Key Encipherment
4. Data Encipherment
5. Key Agreement
6. Certificate Signing
7. CRL Signing
8. Encipher Only
9. Decipher Only
Key Usage [6,7]: 6,7
Syntax
viewcert [ options ] input-file
Option Description
-d DER-encodes the output. This option is only useful with the -o option. It cannot be
used with -p. By default, viewcert outputs the PKI object in a readable text format.
-ip input-password Specifies the password needed to decrypt the private key if the input-file contains
an encrypted private key.
-o output-file Specifies the file that viewcert should write the output to. By default, viewcert writes
the output to the command prompt window where it is running.
-op output-password Specifies the password viewcert should use to encrypt a private key. This option is
only useful with -d or -p. By default, private keys are not encrypted.
-p PEM-encodes the output. This option is only useful with the -o option. It cannot be
used with -d. By default, viewcert outputs the PKI object in a readable text format.
Remarks
The viewcert utility can be used to view the following types of PKI objects:
● X.509 certificates
● certificate requests
● private keys
● certificate revocation lists (CRLs)
Viewcert can also be used to convert between DER and PEM encoding types and to encrypt or decrypt
private keys.
The viewcert utility supports RSA and ECC objects. To view ECC objects, you must order a separate license.
See “Separately licensed components” [SQL Anywhere 11 - Introduction].
See also
● “Certificate Creation utility (createcert)” on page 679
Example
The following example allows you to view the sample RSA certificate that is included with SQL Anywhere:
viewcert rsaroot.crt
X.509 Certificate
-----------------
Common Name: RSA Root
Organizational Unit: test
Organization: test
Locality: test
State/Province: test
Country Code: test
Issuer: RSA Root
Serial Number: 303031
Issued: Apr 15, 2002 12:53:51
Expires: Apr 16, 2022 12:53:51
Signature Algorithm: RSA, MD5
Key Type: RSA
Key Size: 1024 bits
Basic Constraints: Is a certificate authority, path length limit: 10
Key Usage: Certificate Signing, CRL Signing
Syntax
dbdsn [ modifier-options ]
{ -l[ s | u ]
| -d[ s | u ] dsn
| -g[ s | u ] dsn
| -w[ s | u ] dsn [details-options;...]
| -cl }
Options
-d[ s | u ] dsn Deletes the named SQL Anywhere data source. If you
supply -y, any existing data source is deleted without
confirmation. On Windows, you can modify the option
using the u (user) or s (system) specifiers. The default
specifier is u.
-g[ s | u ] dsn Lists the definition of the named SQL Anywhere data
source. You can modify the format of the output using
the -b or -v options. On Windows, you can modify the
option using the u (user) or s (system) specifiers. The
default specifier is u.
-w[ s | u ] dsn [ details-options ] Creates a new data source, or overwrites one if one of
the same name exists. If you supply -y, any existing data
source is overwritten without confirmation. On Win-
dows, you can modify the option using the u (user) or
s (system) specifiers. The default specifier is u.
Modifier-options Description
Modifier-options Description
Modifier-options Description
You can specify the -cl option with the -or option to
obtain a list of the connection parameters for the
iAnywhere Solutions Oracle driver.
For more information, see “iAnywhere Solutions
Oracle driver” [MobiLink - Server Administra-
tion].
Details-options Description
Remarks
The modifier options can occur before or after the major option specification.
The Data Source utility is a cross-platform alternative to the ODBC Administrator for creating, deleting,
describing, and listing SQL Anywhere ODBC data sources. The utility is useful for batch operations.
Caution
Storing user IDs, passwords (encrypted or unencrypted), and/or database keys in a data source is not secure.
It is recommended that you do not store this information in a data source if the database contains sensitive
data.
On Windows operating systems, the data sources are held in the registry.
For information about creating a data source on Windows using the ODBC Administrator, see “Working
with ODBC data sources” on page 90.
On Unix operating systems, data sources are held in the system information file (named .odbc.ini by default).
When you use the Data Source utility to create or delete SQL Anywhere ODBC data sources on Unix, the
utility automatically updates the [ODBC Data Sources] section of the system information file. If you
do not specify the Driver connection parameter using the -c option on Unix, the Data Source utility
automatically adds a Driver entry with the full path of the SQL Anywhere ODBC driver based on the setting
of the SQLANY11 environment variable.
For more information about the system information file, see “Using ODBC data sources on
Unix” on page 97.
Caution
You should not obfuscate the system information file (.odbc.ini) with the File Hiding utility (dbfhide) on
Unix unless you will only be using SQL Anywhere data sources. If you plan to use other data sources (for
example, for MobiLink synchronization), then obfuscating the system information file may prevent other
drivers from functioning properly.
Exit codes are 0 (success) or non-zero (failure). See “Software component exit codes” [SQL Anywhere Server
- Programming].
Name Description
Name Description
Name Description
Name Description
performance is the same as isolation
level 0 with respect to contention.
● readonly-statement-snap-
shot This is also called the isolation
level. You must enable snapshot isola-
tion for the database to use this isola-
tion level. The snapshot isolation lev-
els prevent all interference between
reads and writes. Writes can still inter-
fere with each other. Few inconsisten-
ces are possible and performance is the
same as isolation level 0 with respect
to contention.
Name Description
See also
● “Working with ODBC data sources” on page 90
● “Using ODBC data sources on Unix” on page 97
Example
Write a definition of the data source newdsn. Do not prompt for confirmation if the data source already
exists.
dbdsn -y -w newdsn -c "UID=DBA;PWD=sql;LINKS=TCPIP;ENG=myserver"
List all known user data sources, one data source name per line:
dbdsn -l
List all known system data sources, one data source name per line:
dbdsn -ls
List all data sources along with their associated connection string:
dbdsn -l -b
Report the connection string for the user data source MyDSN:
dbdsn -g MyDSN
Report the connection string for the system data source MyDSN:
dbdsn -gs MyDSN
Delete the data source BadDSN, but first list the connection parameters for BadDSN and prompt for
confirmation:
dbdsn -d BadDSN -v
Create a data source named NewDSN for the database server MyServer:
dbdsn -w NewDSN -c "UID=DBA;PWD=sql;ENG=MyServer"
If NewDSN already exists, you are prompted to confirm overwriting the data source.
List all connection parameter names and their aliases:
dbdsn -cl
Specify an absolute file name. When the DSN is created, it will contain DBF=c:\SQLAnywhere11\my.db.
c:\SQLAnywhere11> dbdsn -w testdsn -cw -c UID=DBA;PWD=sql;ENG=SQLAny;DBF=my.db
Generate the command to create the SQL Anywhere 11 Demo data source and output it to a file called
restoredsn.bat:
dbdsn -cm -gs "SQL Anywhere 11 Demo" > restoredsn.bat
Verify the new location of the system information file using dbdsn -f:
dbdsn using ./myodbc.ini
Syntax
dberase [ options ] database-file
Option Description
@data Reads in options from the specified environment variable or configuration file. See “Using
configuration files” on page 669.
If you want to protect passwords or other information in the configuration file, you can use
the File Hiding utility to obfuscate the contents of the configuration file. See “File Hiding
utility (dbfhide)” on page 698.
-ek key Specifies the encryption key for strongly encrypted databases directly in the command. If
you have a strongly encrypted database, you must provide the encryption key to use the
database or transaction log in any way. For strongly encrypted databases, you must specify
either -ek or -ep, but not both. The command will fail if you do not specify the correct key
for a strongly encrypted database.
-ep Specifies that you want to be prompted for the encryption key. This option causes a window
to appear, in which you enter the encryption key. It provides an extra measure of security
by never allowing the encryption key to be seen in clear text. For strongly encrypted data-
bases, you must specify either -ek or -ep, but not both. The command will fail if you do not
specify the correct key for a strongly encrypted database.
-q Runs in quiet mode—do not display output messages. If you specify this option, you must
also specify -y, otherwise the operation fails.
-y Deletes each file without being prompted for confirmation. If you specify -q, you must also
specify -y, otherwise the operation fails.
Remarks
With the Erase utility, you can erase a database file and its associated transaction log, or you can erase a
transaction log file or transaction log mirror file. All database files and transaction log files are marked read-
only to prevent accidental damage to the database and accidental deletion of the database files.
The database-file may be a database file or transaction log file. The full file name must be specified, including
extension. If a database file is specified, the associated transaction log file (and mirror, if one is maintained)
is also erased.
Note
The Erase utility does not erase dbspaces. If you want to erase a dbspace, you can do so with the DROP
DATABASE statement or by using the Erase Database Wizard in Sybase Central. See “DROP
statement” [SQL Anywhere Server - SQL Reference].
You can also use the Erase Database Wizard to erase dbspaces and transaction log files. See “Erasing a
database” on page 26.
Deleting a database file that references other dbspaces does not automatically delete the dbspace files. If you
want to delete the dbspace files on your own, change the files from read-only to writable, and then delete
the files individually. As an alternative, you can use the DROP DATABASE statement to erase a database
and its associated dbspace files.
If you erase a database file, the associated transaction log and transaction log mirror are also deleted. If you
erase a transaction log for a database that also maintains a transaction log mirror, the mirror is not deleted.
The database being erased must not be running when this utility is used.
Exit codes are 0 (success) or non-zero (failure). See “Software component exit codes” [SQL Anywhere Server
- Programming].
Syntax
dbfhide original-configuration-file encrypted-configuration-file
Option Description
Remarks
Configuration files are used by some utilities to hold command line options. These options may contain a
password. You can use the File Hiding utility to add simple encryption to configuration files, as well as
to .ini files used by SQL Anywhere and its utilities, and thereby obfuscate the contents of the file. The original
file will not be modified. Once you add simple encryption to a file, there is no way to remove it. To make
changes to an obfuscated file, you must keep a copy of the original file that you can modify and obfuscate
again.
For more information about using configuration files, see “Using configuration files to store server startup
options” on page 37.
For more information about encryption, see “Keeping your data secure” on page 947.
Caution
You should not add simple encryption to the system information file (named .odbc.ini by default) with the
File Hiding utility (dbfhide) on Unix unless you will only be using SQL Anywhere data sources. If you plan
to use other data sources (for example, for MobiLink synchronization), then obfuscating the contents of the
system information file may prevent other drivers from functioning properly.
This utility does not accept the @data parameter to read in options from a configuration file.
Example
Create a configuration file that starts the personal database server and the sample database. It should set a
cache of 10 MB, and name this instance of the personal server Elora. The configuration file would be written
as follows:
# Configuration file for server Elora
-n Elora
-c 10M
samples-dir\demo.db
Syntax
dbhist [ options ] -t table-name [ excel-output-filename ]
Options
Option Description
@data Reads in options from the specified environment variable or configuration file. See
“Using configuration files” on page 669.
If you want to protect passwords or other information in the configuration file, you can
use the File Hiding utility to obfuscate the contents of the configuration file. See “File
Hiding utility (dbfhide)” on page 698.
-n colname Specifies the name of the column to associate the histogram with. If you do not specify
a column, all columns that have histograms in the table are returned.
-t table-name Specifies the name of the table or materialized view for which to generate the chart.
excel-output- Specifies the name of the generated Excel file. If no name is specified, Excel prompts
name you to enter one with a Save As window.
Remarks
Histograms are stored in the ISYSCOLSTAT system table and can also be retrieved with the
sa_get_histogram stored procedure. The Histogram utility converts a histogram into a Microsoft Excel chart
containing information about the selectivity of predicates. The Histogram utility (dbhist) only works on
Windows, and you must have Excel 97 or later installed.
Statistics (including histograms) may not be present for a table or materialized view, for example, if statistics
were recently dropped. In this case, the Histogram utility returns the message Histogram contains
no data, aborting. In this case, you must create the statistics, and then run the Histogram utility
again. To create statistics for a table or materialized view, execute a CREATE STATISTICS statement. See
“CREATE STATISTICS statement” [SQL Anywhere Server - SQL Reference].
To determine the selectivity of a predicate over a string column, you should use the ESTIMATE or
ESTIMATE_SOURCE functions. Attempting to retrieve a histogram from string columns causes both
sa_get_histogram and the Histogram utility to generate an error. See “ESTIMATE function
[Miscellaneous]” [SQL Anywhere Server - SQL Reference] and “ESTIMATE_SOURCE function
[Miscellaneous]” [SQL Anywhere Server - SQL Reference].
The sheets are named with the column name. Column names are truncated after 24 characters, and all
occurrences of \, /, ?, *, [, ], and : (which are not allowed in Excel) are replaced with underscores ( _ ). Chart
names are prefixed with the word chart, followed by the same naming convention above. Duplicate names
(arising from character replacement, truncation, or columns named starting with chart) result in an Excel
error stating that no duplicate names can be used. However, the spreadsheet is still created with those names
created with their previous version (Sheet1, Chart1, and so on).
Exit codes are 0 (success) or non-zero (failure). See “Software component exit codes” [SQL Anywhere Server
- Programming].
You can also retrieve histograms using the sa_get_histogram stored procedure. See “sa_get_histogram
system procedure” [SQL Anywhere Server - SQL Reference].
Example
The following command (entered all on the same line) generates an Excel chart for the column ProductID
in the table SalesOrderItems for database demo.db, and saves it as histogram.xls.
dbhist -c "UID=DBA;PWD=sql;DBF=samples-dir\demo.db" -n ProductID -t
SalesOrderItems histogram.xls
The following statement generates charts for every column with a histogram in the table SalesOrders,
assuming that the sample database is already started. This statement also attempts to connect using
UID=DBA and PWD=sql. No output file name is specified, so Excel prompts you to enter one.
dbhist -t SalesOrders -c "UID=DBA;PWD=sql"
See also
● “Optimizer estimates and column statistics” [SQL Anywhere Server - SQL Usage]
● “CREATE STATISTICS statement” [SQL Anywhere Server - SQL Reference]
Syntax
dbinfo [ options ]
Option Description
Remarks
The dbinfo utility displays information about a database. It reports the name of the database file, the name
of any transaction log file or log mirror, the page size, the collation name and label, whether table encryption
is enabled, and other information. Optionally, it can also provide table usage statistics and details.
Exit codes are 0 (success) or non-zero (failure).
For more information about exit codes, see “Software component exit codes” [SQL Anywhere Server -
Programming].
Syntax
dbinit [ options ] new-database-file
Option Description
Option Description
Option Description
-dba [ DBA-user ][ ,pwd ] Specifies the DBA user ID and password. If you specify
a new name for the DBA user for the database, you can
no longer connect to the database as the user DBA. You
can also specify a different password for the DBA data-
base user. If you do not specify a password, the default
password sql is used. If you do not specify this option,
the default user ID DBA with password sql is created.
Either of the following commands creates a database
with a DBA user named testuser with the default pass-
word sql:
dbinit -dba testuser mydb.db
Option Description
Option Description
Caution
For strongly encrypted databases, be sure to store a copy
of the key in a safe location. If you lose the encryption
key there is no way to access the data, even with the
assistance of technical support. The database must be
discarded and you must create a new database.
Option Description
Option Description
Option Description
-p page-size Specifies the page size for the database. The page size
for a database can be (in bytes) 2048, 4096, 8192, 16384,
or 32768, with 4096 being the default.
Large databases can benefit from a larger page size. For
example, the number of I/O operations required to scan
a table is generally lower, as a whole page is read in at a
time. However, there are additional memory require-
ments for large page sizes. It is strongly recommended
that you do performance testing (and testing in general)
when choosing a page size. Then choose the smallest
page size that gives satisfactory results. For most appli-
cations, 16 KB or 32 KB page sizes are not recommen-
ded. You should not use page sizes of 16 KB or 32 KB
in production systems unless you can be sure that a large
database server cache is always available, and only after
you have investigated the tradeoffs of memory and disk
space with its performance characteristics. It is particu-
larly important to pick the correct (and reasonable) page
size if a large number of databases are going to be started
on the same server.
For more information, see:
● “Use an appropriate page size” [SQL Anywhere Serv-
er - SQL Usage]
● “Table and page sizes” [SQL Anywhere Server - SQL
Usage]
Option Description
-t transaction-log-name Specifies the name of the transaction log file. The trans-
action log is a file where the database server logs all
changes, made by all users, no matter what application
is being used. The transaction log plays a key role in
backup and recovery (see “The transaction
log” on page 852), and in data replication. If the file
name has no path, it is placed in the same directory as
the database file. If you run dbinit without specifying -t
or -n, a transaction log is created with the same file name
as the database file, but with extension .log.
Option Description
-z coll [ collation-tailoring-string ] Specifies the collation sequence for the database. The
collation sequence is used for sorting and comparing
character data types (CHAR, VARCHAR, and LONG
VARCHAR). The collation provides character compar-
ison and ordering information for the encoding (charac-
ter set) being used. It is important to choose your
collation carefully. It cannot be changed after the data-
base has been created without unloading and reloading
the database. If the collation is not specified, SQL Any-
where chooses a collation based on the operating system
language and character set. See:
● “Choosing collations” on page 365
● “Recommended character sets and colla-
tions” on page 378
● “Supported and alternate collations” on page 374
Note
Databases initialized with collation tailoring options
cannot be started by a pre-10.0.1 database server.
Option Description
-ze encoding Specifies the encoding for the collation. Most collations
specified by -z dictate both the encoding (character set)
and ordering. For those collations, -ze should not be
specified.
If the collation specified by -z is UCA (Unicode Colla-
tion Algorithm), then -ze can specify UTF-8 or any
single-byte encoding for CHAR data types. By default,
SQL Anywhere uses UTF-8. Use -ze to specify a locale-
specific encoding and get the benefits of the UCA for
comparison and ordering.
-zn coll [ collation-tailoring-string ] Specifies the collation sequence used for sorting and
comparing of national character data types (NCHAR,
NVARCHAR, and LONG NVARCHAR). The collation
provides character ordering information for the UTF-8
encoding (character set) being used. Values are UCA
(the default), or UTF8BIN which provides a binary or-
dering of all characters whose encoding is greater than
0x7E. If the dbicu11 and dbicudt11 DLLs are not instal-
led, then the default NCHAR collation is UTF8BIN. For
more information, see “Choosing colla-
tions” on page 365.
Optionally, you can specify collation tailoring options
(collation-tailoring-string) for additional control over the
sorting and comparing of characters. These options take
the form of keyword=value pairs, assembled in paren-
theses, following the collation name. For example:
dbinit -c -zn UCA(case=LowerFirst)
sens.db
See “Collation tailoring options” on page 366.
Case and accent settings specified in the collation-tailor-
ing-string override case and accent options for dbinit ( -
c, -a, and -af), in the event that you specify both.
Note
Databases initialized with collation tailoring options
cannot be started by a pre-10.0.1 database server.
Remarks
A number of database attributes are specified at initialization and cannot be changed later except by
unloading, reinitializing, and rebuilding the entire database. These database attributes include:
For example, the database test.db can be created with 8192 byte pages as follows:
dbinit -p 8192 test.db
You cannot name a database utility_db. This name is reserved for the utility database. See “Using the utility
database” on page 22.
When specifying collation tailoring options in the initialization command, you cannot specify quaternary
for the punctuation sensitivity if the database is case or accent insensitive.
In addition, the choice of whether to use a transaction log and a transaction log mirror is made at initialization.
This choice can be changed later using the Transaction Log utility or the ALTER DATABASE statement.
Note
When you are deploying applications, the personal database server (dbeng11) is required for creating
databases using the dbinit utility. It is also required if you are creating databases from Sybase Central on the
local computer when no other database servers are running.
Exit codes are 0 (success) or non-zero (failure). See “Software component exit codes” [SQL Anywhere Server
- Programming].
Example
The following command creates a case sensitive database, spanish.db, which uses the 1262spa collation for
non-NCHAR data. For NCHAR data, the UCA collation is specified, with locale es, and sorting by lowercase
first.
Syntax
dbisql [ options ] [ dbisql-command | command-file ]
Option Description
@data Reads in options from the specified environment variable or configuration file. See
“Using configuration files” on page 669.
If you want to protect passwords or other information in the configuration file, you can
use the File Hiding utility to obfuscate the contents of the configuration file. See “File
Hiding utility (dbfhide)” on page 698.
-c "key- Specifies connection parameters. If Interactive SQL cannot connect, you are presented
word=val- with a window where you can enter the connection parameters. See “Connection param-
ue; ..." eters” on page 248.
-d delimiter Specify a command delimiter. Quotation marks around the delimiter are optional, but are
required when the command shell itself interprets the delimiter in some special way.
This option overrides the setting of the command_delimiter option. See “command_de-
limiter option [Interactive SQL]” on page 644.
-d1 Echoes all statements explicitly executed by the user to the command window
(STDOUT). This can provide useful feedback for debugging SQL scripts, or when In-
teractive SQL is processing a long SQL script. (The final character is a number 1, not a
lowercase L). This option is only available when you run Interactive SQL as a command
line program.
-f filename Opens (but does not run) in the SQL Statements pane the file called filename.
If the -f option is given, the -c option is ignored; that is, no connection is made to the
database.
The file name can be enclosed in quotation marks, and must be enclosed in quotation
marks if the file name contains a space. If the file does not exist, or if it is really a directory
instead of a file, Interactive SQL prints an error message and then quits. If the file name
does not include a full drive and path specification, it is assumed to be relative to the
current directory.
This option is only supported when Interactive SQL is run as a windowed application.
Option Description
-host host- Specifies the hostname or IP address of the computer on which the database server is
name running. You can use the name localhost to represent the current computer.
-nogui Runs Interactive SQL in a command-prompt mode, with no windowed user interface.
This is useful for batch operations. If you specify either dbisql-command or command-file,
then -nogui is assumed.
In this mode, Interactive SQL sets the program exit code to indicate success or failure.
On Windows operating systems, the environment variable ERRORLEVEL is set to the
program exit code. See “Software component exit codes” [SQL Anywhere Server - Pro-
gramming].
-onerror Controls what happens if an error is encountered while reading statements from a com-
{ continue | mand file. This option overrides the on_error setting. It is useful when using Interactive
exit } SQL in batch operations. See “on_error option [Interactive SQL]” on page 654.
-port port- Specifies the port number on which the database server is running. The default port num-
number ber for SQL Anywhere is 2638.
-q Suppresses output messages. This is useful only if you start Interactive SQL with a com-
mand or command file. Specifying this option does not suppress error messages, but it
does suppress the following:
● warnings and other non-fatal messages
● the printing of result sets
-ul Specifies that UltraLite databases are the default. Interactive SQL customizes the options
available to you depending on the type of database you are connected to. By default,
Interactive SQL assumes that you are connecting to SQL Anywhere databases. When you
specify the -ul option, the default changes to UltraLite databases. Regardless of the type
of database set as the default, you can connect to either SQL Anywhere or UltraLite
databases by choosing the database type from the dropdown list on the Connect window.
For more information about connecting to UltraLite databases from Interactive SQL, see
“Interactive SQL utility for UltraLite (dbisql)” [UltraLite - Database Management and
Reference].
-version Displays the version number of Interactive SQL. You can also view the version number
from within Interactive SQL; from the Help menu, choose About Interactive SQL.
-x Scans commands but does not execute them. This is useful for checking long command
files for syntax errors.
For detailed descriptions of SQL statements and Interactive SQL commands, see “SQL
language elements” [SQL Anywhere Server - SQL Reference].
Remarks
Interactive SQL allows you to browse the database, execute SQL commands, and run command files. It also
provides feedback about the number of rows affected, the time required for each command, the execution
plan of queries, and any error messages.
You can connect to both SQL Anywhere and UltraLite databases.
Interactive SQL is supported on Windows, Solaris, Linux, and Mac OS X.
If dbisql-command is specified, Interactive SQL executes the command. You can also specify a command file
name. If no dbisql-command or command-file argument is specified, Interactive SQL enters interactive mode,
where you can type a command into a command window.
You can start Interactive SQL in the following ways:
● from Sybase Central, using the Open Interactive SQL menu item.
● from the Start menu by choosing Start » Programs » SQL Anywhere 11 » Interactive SQL.
● using the dbisql command.
You can specify a code page to use when reading or writing files using the ENCODING clause of the INPUT,
OUTPUT, or READ statement. For example, on an English Windows XP computer, windowed programs
use the 1252 (ANSI) code page. If you want Interactive SQL to read a file named status.txt created using
the 297 (IBM France) code page, use the following statement:
READ
ENCODING 297
status.txt;
The default code page for Interactive SQL can also be set using the default_isql_encoding option. See:
● “Recommended character sets and collations” on page 378
● “default_isql_encoding option [Interactive SQL]” on page 646
● “INPUT statement [Interactive SQL]” [SQL Anywhere Server - SQL Reference]
● “OUTPUT statement [Interactive SQL]” [SQL Anywhere Server - SQL Reference]
● “READ statement [Interactive SQL]” [SQL Anywhere Server - SQL Reference]
Exit codes are 0 (success) or non-zero (failure). Non-zero exit codes are set only when you run Interactive
SQL in batch mode (with a command line that contains a SQL statement or the name of a script file). See
“Software component exit codes” [SQL Anywhere Server - Programming].
When executing a reload.sql file with Interactive SQL, you must specify the encryption key as a parameter.
If you do not provide the key in the READ statement, Interactive SQL prompts for the key.
See also
● “CLEAR statement [Interactive SQL]” [SQL Anywhere Server - SQL Reference]
● “CONFIGURE statement [Interactive SQL]” [SQL Anywhere Server - SQL Reference]
● “CONNECT statement [ESQL] [Interactive SQL]” [SQL Anywhere Server - SQL Reference]
● “DESCRIBE statement [Interactive SQL]” [SQL Anywhere Server - SQL Reference]
● “EXIT statement [Interactive SQL]” [SQL Anywhere Server - SQL Reference]
● “HELP statement [Interactive SQL]” [SQL Anywhere Server - SQL Reference]
● “INPUT statement [Interactive SQL]” [SQL Anywhere Server - SQL Reference]
Example
The following command runs the command file mycom.sql against the current default server, using the user
ID DBA and the password sql. If there is an error in the command file, the process shuts down.
dbisql -c "UID=DBA;PWD=sql" -onerror exit mycom.sql
Syntax
dbisqlc [ options ] [ dbisqlc-command | command-file ]
Option Description
-c "key- Specifies connection parameters. If Interactive SQL cannot connect, you are presented
word=val- with a window where you can enter the connection parameters. See “Connection param-
ue; ..." eters” on page 248.
-d delimiter Specifies a command delimiter. Quotation marks around the delimiter are optional, but
are required when the command shell itself interprets the delimiter in some special way.
The specified command delimiter is used for all connections in the current dbisqlc session.
-q Suppresses output messages. This is useful only if you start Interactive SQL with a com-
mand or command file. Specifying this option does not suppress error messages, but it
does suppress the following:
● warnings and other non-fatal messages
● the printing of result sets
-x Scans commands but does not execute them. This is useful for checking long command
files for syntax errors.
For detailed descriptions of SQL statements and Interactive SQL commands, see “SQL
language elements” [SQL Anywhere Server - SQL Reference].
Remarks
Note
It is recommended that you use the Interactive SQL utility (accessed by using the dbisql command or by
choosing Start » Programs » SQL Anywhere 11 » Interactive SQL) where possible because the dbisqlc
utility does not support all the features that Interactive SQL does, and it does not support all of the features
available in previous versions of the database server.
The dbisqlc utility allows you to type SQL commands or run command files.
The dbisqlc utility is supported on Windows, Mac OS X, and Unix.
If dbisqlc-command is specified, dbisqlc executes the command. You can also specify a command file name.
If no dbisqlc-command or command-file argument is specified, dbisqlc enters interactive mode, where you can
type a command into a command window.
Exit codes are 0 (success) or non-zero (failure). Only the dbisql utility has the ability to provide exit codes
from a SQL script. See “Interactive SQL utility (dbisql)” on page 716 and “EXIT statement [Interactive
SQL]” [SQL Anywhere Server - SQL Reference].
See also
● “CLEAR statement [Interactive SQL]” [SQL Anywhere Server - SQL Reference]
● “CONFIGURE statement [Interactive SQL]” [SQL Anywhere Server - SQL Reference]
● “CONNECT statement [ESQL] [Interactive SQL]” [SQL Anywhere Server - SQL Reference]
● “DESCRIBE statement [Interactive SQL]” [SQL Anywhere Server - SQL Reference]
● “EXIT statement [Interactive SQL]” [SQL Anywhere Server - SQL Reference]
● “HELP statement [Interactive SQL]” [SQL Anywhere Server - SQL Reference]
● “INPUT statement [Interactive SQL]” [SQL Anywhere Server - SQL Reference]
● “OUTPUT statement [Interactive SQL]” [SQL Anywhere Server - SQL Reference]
● “PARAMETERS statement [Interactive SQL]” [SQL Anywhere Server - SQL Reference]
● “READ statement [Interactive SQL]” [SQL Anywhere Server - SQL Reference]
● “SET CONNECTION statement [Interactive SQL] [ESQL]” [SQL Anywhere Server - SQL Reference]
● “SET OPTION statement [Interactive SQL]” [SQL Anywhere Server - SQL Reference]
● “START ENGINE statement [Interactive SQL]” [SQL Anywhere Server - SQL Reference]
● “START LOGGING statement [Interactive SQL]” [SQL Anywhere Server - SQL Reference]
● “STOP LOGGING statement [Interactive SQL]” [SQL Anywhere Server - SQL Reference]
● “SYSTEM statement [Interactive SQL]” [SQL Anywhere Server - SQL Reference]
Example
The following command runs the command file mycom.sql against the current default server, using the user
ID DBA and the password sql. If there is an error in the command file, the process shuts down.
dbisqlc -c "UID=DBA;PWD=sql" mycom.sql
Syntax
createkey
Remarks
To create ECC objects, you must order a separate license. See “Separately licensed components” [SQL
Anywhere 11 - Introduction].
When you run createkey, you are prompted for the following information:
● Choose encryption type This prompt only appears if you have purchased a license for ECC
encryption. Choose RSA or ECC.
● Enter RSA key length (512-16384) This prompt only appears if you chose RSA encryption. You
can choose a length between 512 bits and 16384 bits.
● Enter ECC curve This prompt only appears if you have purchased a license for ECC encryption and
you chose the ECC encryption type. You are prompted to choose from a list of ECC curves. The default
is sect163k1.
● Enter file path to save public key Specify a file name and location for the generated PEM-encoded
public key. This file is specified on the MobiLink client by the e2ee_public_key protocol option. See
“e2ee_public_key” [MobiLink - Client Administration].
● Enter file path to save private key Specify a file name and location for the generated PEM-encoded
private key. This file is specified on the MobiLink server via the e2ee_private_key protocol option. See
“-x option” [MobiLink - Server Administration].
● Enter password to protect private key Optionally, supply a password with which to encrypt the
private key. The private key is not encrypted if you do not supply a password. This password is specified
on the MobiLink server via the e2ee_private_key_password protocol option. See “-x option” [MobiLink
- Server Administration].
See also
● “End-to-end encryption” on page 995
● “e2ee_type” [MobiLink - Client Administration] (MobiLink client network protocol option)
Example
The following example creates an RSA key pair:
>createkey
SQL Anywhere Key Pair Generator Version 11.0.0.1304
Choose encryption type ((R)SA or (E)CC): r
Enter RSA key length (512-16384): 2048
Generating key pair...
Enter file path to save public key: rsapublic.pem
Enter file path to save private key: rsaprivate.pem
Enter password to protect private key: pwd
Syntax
dblang [options] language-code
Option Description
-u Writes the language code to the registry under HKEY_CURRENT_USER. This is the default
location.
EN English
DE German
ES Spanish
FR French
IT Italian
JA Japanese
KO Korean
LT Lithuanian
PL Polish
PT Portuguese
RU Russian
TW Traditional Chinese
UK Ukrainian
ZH Simplified Chinese
Remarks
If you do not specify -m or -u, then the language code is written to the registry under
HKEY_CURRENT_USER. You can specify both -m and -u to write the language code to both locations.
Running the dblang utility without a language code reports the current settings. These settings are as follows:
● SQL Anywhere This setting controls which language resource library is used to deliver informational
and error messages from the SQL Anywhere database server. The language resource library is a DLL
with a name of the form dblgXX11.dll, where XX is a two-letter language code.
Ensure that you have the appropriate language resource library on your computer when you change the
settings.
● Sybase Central This setting controls the resources used to display user interface elements for Sybase
Central and Interactive SQL. You must have purchased the appropriate localized version of SQL
Anywhere for this setting to take effect.
Exit codes are 0 (success) or non-zero (failure). See “Software component exit codes” [SQL Anywhere Server
- Programming].
This utility does not accept the @data parameter to read in options from a configuration file.
When the fast launcher option is enabled, changes to language settings are only detected by Sybase Central
or Interactive SQL once the process is stopped and restarted.
To change the language settings when the fast launcher option is enabled
1. Choose Tools » Options.
2. On the General tab of the Options window, clear the Enable Fast Launcher option.
Click OK.
3. Shut down Sybase Central or Interactive SQL.
4. Change the language settings as required. For example, running the following command changes the
language settings to German:
dblang DE
5. Start Sybase Central or Interactive SQL.
6. Re-enable the fast launcher option:
a. Choose Tools » Options.
b. On the General tab of the Options window, select the Enable Fast Launcher option.
c. Click OK.
To change the language settings when the fast launcher option is disabled
1. Shut down Sybase Central or Interactive SQL.
2. Change the language settings as required. For example, running the following command changes the
language settings to German:
dblang de
Alternatively, you can shut down the scjview or dbisql process to stop the fast launcher.
See also
● “SALANG environment variable” on page 323
● “Using the fast launcher option” on page 661
Example
The following command displays a window containing the current settings:
dblang
The following command changes the settings to German, and displays a window containing the previous
and new settings:
dblang de
Syntax
dbltm [ options ]
Options
Option Description
@data Reads in options from the specified environment variable or configuration file. See
“Using configuration files” on page 669.
If you want to protect passwords or other information in the configuration file, you can
use the File Hiding utility to obfuscate the contents of the configuration file. See “File
Hiding utility (dbfhide)” on page 698.
-A Prevents filtering of updates. By default, all changes made by the maintenance user are
not replicated. If the -A option is set, these changes are replicated. This may be useful
in non-hierarchical Replication Server installations, where a database acts as both a rep-
licate site and as a primary site.
-C config-file Uses the configuration file config-file to determine the LTM settings. The default con-
figuration file is dbltm.cfg. See “The LTM configuration file” on page 728.
-I interface-file (Uppercase I.) Uses the named interfaces file. The interfaces file is the file created by
DSEDIT and holds the connection information for Open Servers. The default interfaces
file is SQL.ini in the ini subdirectory of your Sybase directory.
-M Initiates recovery actions. The LTM starts reading logs from the earliest available posi-
tion. If the offline directory is specified in the configuration file, the LTM reads from
the oldest offline log file.
-S LTM-name Provides the server name for this LTM. The default LTM name is DBLTM_LTM. The
LTM name must correspond to the Open Server name for the LTM that was entered in
DSEDIT.
-dl Displays all messages in the LTM window or at a command prompt, as well as in the
log file (if specified).
-ek key Specifies the encryption key for strongly encrypted databases directly in the command.
If you have a strongly encrypted database, you must provide the encryption key to use
the database or transaction log in any way, including offline transaction logs. For strongly
encrypted databases, you must specify either -ek or -ep, but not both. The command fails
if you do not specify a key for a strongly encrypted database.
Option Description
-ep Specifies that you want to be prompted for the encryption key. This option causes a
window to appear, in which you enter the encryption key. It provides an extra measure
of security by never allowing the encryption key to be seen in clear text. For strongly
encrypted databases, you must specify either -ek or -ep, but not both. The command fails
if you do not specify a key for a strongly encrypted database.
-o filename Uses a log file different from the default (dbltm.log). Output messages from log transfer
operations are written to this file.
-os size Specifies the maximum size of the output file, in bytes. The minimum value is 10000
(ten thousand). If the log file grows to the point where it would exceed this limit, it is
renamed to yymmddxx.ltm. The value of xx in yymmddxx.ltm is incremented for each file
created on a given day.
-ot file Uses a log file different from the default (dbltm.log), and truncates the log file (all existing
content is deleted) when the LTM starts. Output messages from log transfer operations
are sent to this file for later review.
-s Logs all LTL commands that are generated by the LTM. This should be used only to
diagnose problems, and is not recommended in a production environment. It carries a
significant performance penalty.
-ud Runs the LTM as a daemon on Unix operating systems. If you run in this manner, output
is logged to the log file.
-ux Opens the Log Transfer Manager window if dbltm can find a usable display on Unix
operating systems. If it cannot find one, for example because the DISPLAY environment
variable is not set or because the X window server is not running, dbltm fails to start. On
Windows, the dbltm window appears automatically.
Remarks
The Log Transfer Manager (LTM) is also known as a replication agent. The LTM is required for any SQL
Anywhere database that participates in a Replication Server installation as a primary site.
The SQL Anywhere LTM reads a database transaction log and sends committed changes to Replication
Server. The LTM is not required at replicate sites.
The LTM sends committed changes to Replication Server in a language named Log Transfer Language
(LTL).
By default, the LTM uses a log file named DBLTM.LOG to hold status and other messages. You can use
options to change the name of this file and to change the volume and type of messages that are sent to it.
Exit codes are 0 (success) or non-zero (failure). See “Software component exit codes” [SQL Anywhere Server
- Programming].
Parameter Description
APC_pw The password for the APC_user login name. This entry is present only in SQL
Anywhere LTM configuration files.
APC_user A user ID that is used when executing asynchronous procedures at the primary
site. This user ID must have permissions appropriate for all asynchronous pro-
cedures at the primary site. This entry is present only in SQL Anywhere LTM
configuration files.
backup_only By default, this is off. If it is set to on, the LTM replicates only backed-up
transactions.
batch_ltl_cmds Set to on (the default) to use batch mode. Batch mode can increase overall
throughput, but may lead to longer response times.
batch_ltl_sz The number of commands that are saved in the buffer before being sent to Rep-
lication Server, when batch_ltl_cmds is on. The default is 200.
batch_ltl_mem The amount of memory that the buffer can use before its contents are sent to
Replication Server, when batch_ltl_cmds is on. The default is 256 KB.
Continuous By default, this is on. When set to off, the LTM automatically shuts down as
soon as all committed data has been replicated.
LTM_admin_user The system administrator LTM login name that is used to log in to the LTM.
This parameter is required so that the LTM can check whether a user logging
on to the LTM to shut it down has the correct login name.
Parameter Description
LTM_charset The Open Client/Open Server character set for the LTM to use.
LTM_language The Open Client/Open Server language for the LTM to use.
LTM_sortorder The Open Client/Open Server sort order for the LTM to use to compare user
names. You can specify any Adaptive Server Enterprise-supported sort order
that is compatible with the LTM's character set. All sort orders in your replica-
tion system should be the same.
The default sort order is a binary sort.
maint_cmds_to_skip Ignored.
qualify_table_owners Set to on for the LTM to send LTLs with table names and columns names, as
well as table owners to Replication Server. The setting applies to all replicating
tables, and the create replication definition statements must match this setting.
The default is off.
rep_func Set to on to use asynchronous procedure calls (APCs). The default is off.
Retry The number of seconds to wait before retrying a failed connection to a SQL
Anywhere database server or Replication Server. The default is 10 seconds.
RS The name of the Replication Server to which the LTM is transferring the log.
RS_source_db The name of the database whose log the LTM transfers to the Replication Server.
This name must match the name of the database as defined within the Replica-
tion Server connection definitions. Most configurations use the same setting for
both RS_Source_db and SQL_database configuration options.
RS_source_ds The name of the server whose log the LTM transfers to the Replication Server.
This name must match the name of the server as defined within the Replication
Server connection definitions. Most configurations use the same setting for both
RS_Source_ds and SQL_server configuration options.
RS_user A login name for the LTM to use to log in to the Replication Server. The login
name must have been granted connect source permission in the Replication
Server.
scan_retry The number of seconds that the LTM waits between scans of the transaction
log. This parameter is somewhat different in meaning to that of the Adaptive
Server Enterprise LTM. The SQL Anywhere server does not wake up and scan
the log when records arrive in the log. For this reason, you may want to set the
scan_retry value to a smaller number then that for an Adaptive Server Enterprise
LTM.
Parameter Description
skip_ltl_cmd_err This parameter tells Replication Agent to continue or shut down when LTL
command errors occur. When skip_ltl_cmd_err=on is specified, Replication
Agent displays the LTL commands that caused the errors and then skips the
LTLs and continues replication. When this parameter is set to off, Replication
Agent displays the LTL commands that caused the errors and then shuts down.
By default, this parameter is set to off.
SQL_database The primary site database name on the server SQL_server to which the LTM
connects. For Adaptive Server Enterprise during recovery, this is the temporary
database whose logs the LTM will transfer to Replication Server. The SQL
Anywhere LTM uses the SQL_log_files parameter to locate offline transaction
logs.
SQL_log_files A directory that holds off-line transaction logs. The directory must exist when
the LTM starts up. This entry is present only in SQL Anywhere LTM config-
uration files.
SQL_server The name of the primary site SQL Anywhere server to which the LTM connects.
For Adaptive Server Enterprise during recovery, this is a data server with a
temporary database whose logs the LTM will transfer to Replication Server.
The LTM uses the SQL_log_files parameter to locate offline transaction logs.
SQL_user The login name that the LTM uses to connect to the database specified by
RS_source_ds and RS_source_db.
Syntax
Running against a database server:
Option Description
@data Reads in options from the specified environment variable or configuration file. See
“Using configuration files” on page 669.
If you want to protect passwords or other information in the configuration file, you can
use the File Hiding utility to obfuscate the contents of the configuration file. See “File
Hiding utility (dbfhide)” on page 698.
-c "key- Specifies the connection string when running the utility against a database server. See
word=value; ..." “Connection parameters” on page 248.
-d Specifies that transactions are written in order from earliest to latest. This feature is
provided primarily for use when auditing database activity: the output of dbtran should
not be applied against a database.
Option Description
-ek key Specifies the encryption key for strongly encrypted databases. If you have a strongly
encrypted database, you must provide the encryption key to use the database or trans-
action log.
For strongly encrypted databases, you must specify either -ek or -ep, but not both. The
command fails if you do not specify the correct encryption key.
If you are running dbtran against a database server using the -c option, specify the key
using a connection parameter instead of using the -ek option. For example, the following
command gets the transaction log information about database enc.db from the database
server sample, and saves its output in log.sql.
dbtran -n log.sql -c "ENG=sample;DBF=enc.db;
UID=DBA;PWD=sql;DBKEY=mykey"
-ep Prompts for the encryption key. This option causes a window to appear, in which you
enter the encryption key. It provides an extra measure of security by never allowing the
encryption key to be seen in clear text.
For strongly encrypted databases, you must specify either -ek or -ep, but not both. The
command fails if you do not specify the correct encryption key.
If you are running dbtran against a database server using the -c option, specify the key
using a connection parameter, instead of using the -ep option. For example, the follow-
ing command gets the transaction log information about database enc.db from the
database server sample, and saves its output in log.sql.
dbtran -n log.sql -c "ENG=sample;DBF=enc.db;
UID=DBA;PWD=sql;DBKEY=mykey"
-f Outputs only transactions that were completed since the last checkpoint.
-g Adds auditing information to the transaction log if the auditing database option is turned
on. You can include this information as comments in the output file using this option.
See “auditing option [database]” on page 454.
The -g option implies the -a, -d, and -t options.
-ir offset1,off- Outputs a portion of the transaction log between two specified offsets.
set2
Option Description
-is source,... Outputs operations on rows that have been modified by operations from one or more of
the following sources, specified as a comma-separated list:
● All All rows. This is the default setting.
● SQLRemote Include only rows that were modified using SQL Remote. You can
also use the short form SR.
● RepServer Include only rows that were modified using the Replication Agent
(LTM) and Replication Server. You can also use the short form RS.
● Local Include only rows that are not replicated.
-it owner.ta- Outputs those operations on the specified, comma-separated list of tables. Each table
ble,... should be specified as owner.table.
-j date/time Translates only transactions from the most recent checkpoint prior to the given date and/
or time. The user-provided argument can be a date, time, or date and time, enclosed in
quotes. If the time is omitted, the time is assumed to be the beginning of the day. If the
date is omitted, the current day is assumed. The following is an acceptable format for
the date and time: "YYYY/MMM/DD HH:NN".
-k Prevents partial .sql files from being erased if an error is detected. If an error is detected
while dbtran is running, the .sql file generated until that point is normally erased to
ensure that a partial file is not used by accident. Specifying this option may be useful if
you are attempting to salvage transactions from a damaged transaction log.
-m Specifies a directory that contains transaction logs. This option must be used in con-
junction with the -n option.
-n filename Specifies the output file that holds the SQL statements when you run the dbtran utility
against a database server.
-r Removes any transactions that were not committed. This is the default behavior.
-rsu user- Specifies a comma-separated list of user names to override the default Replication
name,... Server user names. By default, the -is option assumes the default Replication Server
user names of dbmaint and sa.
-s Controls how UPDATE statements are generated. If the option is not used, and there is
no primary key or unique index on a table, the Log Translation utility generates UP-
DATE statements with a non-standard FIRST keyword in case of duplicate rows. If the
option is used, the FIRST keyword is omitted for compatibility with the SQL standard.
Option Description
-sr Places generated comments in the output file describing how SQL Remote distributes
operations to remote sites.
-t Controls whether triggers are included in the command file. By default, actions per-
formed by triggers are not included in the command file. If the matching trigger is in
the database, when the command file is run against the database the trigger performs
the actions automatically. Trigger actions should be included if the matching trigger
does not exist in the database against which the command file is to run.
-u userid,... Limits the output from the transaction log to include only specified users.
-x userid,... Limits the output from the transaction log to exclude specified users.
-y Replaces existing command files without prompting you for confirmation. If you spec-
ify -q, you must also specify -y or the operation fails.
-z Includes transactions that were generated by triggers only as comments in the output
file.
transaction-log Specifies the log file to be translated. Cannot be used together with -c or -m options.
SQL-file Names the output file containing the translated information. For use with transaction-
log only.
Remarks
The dbtran utility takes the information in a transaction log and places it as a set of SQL statements and
comments into an output file. The utility can be run in the following ways:
● Against a database server When dbtran is run against a database server, the utility is a standard
client application. It connects to the database server using the connection string specified following the
-c option, and places output in a file specified with the -n option. DBA authority is required to run in this
way.
The following command translates log information from the server demo11 and places the output in a
file named demo.sql.
dbtran -c "ENG=demo11;DBN=demo;UID=DBA;PWD=sql" -n demo.sql
● Against a transaction log file When dbtran is run against a transaction log, the utility acts directly
against a transaction log file. You should protect your transaction log file from general access if you
want to prevent users from having the capability of running this statement.
dbtran demo.log demo.sql
When the dbtran utility runs, it displays the earliest log offset in the transaction log. This can be an effective
method for determining the order in which multiple log files were generated.
If -c is used, dbtran attempts to translate the online transaction log file, as well as all the offline transaction
log files in the same directory as the online transaction log file. If the directory contains transaction log files
for more than one database, dbtran may give an error. To avoid this problem, ensure that each directory
contains transaction log files for only one database.
A transaction can span multiple transaction logs. If transaction log files contain transactions that span logs,
translating a single transaction log file (for example dbtran demo.log) can cause the spanning
transactions to be lost. In order for dbtran to generate complete transactions, use the -c or -m options with
the transaction log files in the directory. See “Recovering from multiple transaction logs” on page 890.
You can access the Log Translation utility in the following ways:
● From Sybase Central, using the Translate Log File Wizard.
● At a command prompt, using the dbtran command. This is useful for incorporating into batch or command
files.
Exit codes are 0 (success) or non-zero (failure). See “Software component exit codes” [SQL Anywhere Server
- Programming].
Syntax
dbping [ options ]
Option Description
@data Reads in options from the specified environment variable or configuration file. See “Using
configuration files” on page 669.
If you want to protect passwords or other information in the configuration file, you can
use the File Hiding utility to obfuscate the contents of the configuration file. See “File
Hiding utility (dbfhide)” on page 698.
-c "key- Specifies connection parameters that control the behavior of dbping. If connection pa-
word=val- rameters are not specified, connection parameters from the SQLCONNECT environment
ue; ..." variable are used, if set. See “Connection parameters” on page 248.
If you use the following command to start dbping and there is a database server named
demo11 already running, dbping attempts to connect to a database named demo. If no such
database is running on that database server, the database server attempts to load
demo.db. If no server called demo11 is found, dbping attempts to autostart one.
dbping -d -c "UID=DBA;PWD=sql;ENG=demo11;DBN=demo;DBF=samples-dir
\demo.db"
The following command fails, with the message Ping database failed --
specified database not found:
dbping -c "ENG=blair;DBN=demo" -d
-en Specifies that you want dbping to exit with a failed return code when NULL is returned
for any of the properties specified. By default, dbping prints NULL when the value for a
property specified by -pc, -pd, or -ps is unknown, and exits with a success return code.
This option can only be used in conjunction with -pc, -pd, and -ps.
Option Description
-l library Specifies the library to use (without its file extension). This option avoids the use of the
ODBC driver manager, and so is particularly useful on Unix operating systems.
For example, the following command loads the ODBC driver directly:
dbping -m -c "DSN=SQL Anywhere 11 Demo" -l dbodbc11
On Unix, if you want to use a threaded connection library, you must use the threaded
version of the Ping utility, dbping_r.
-m Establishes a connection using ODBC. By default, the utility connects using the embedded
SQL interface.
-pc proper- Displays the specified connection properties. Supply the properties in a comma-separated
ty,... list. You must specify enough connection information to establish a database connection
if you use this option. See “Connection-level properties” on page 538.
For example, the following command displays the fire_triggers option setting, which is
available as a connection property.
dbping -c ... -pc fire_triggers
-pd proper- Displays the specified database properties. Supply the properties in a comma-separated
ty[@db- list. See “Database-level properties” on page 574.
name],...
For example, the following command displays the page size in use by the database:
dbping -c ... -pd PageSize
Optionally, you can specify the name of a database running on the database server you
want to obtain the value from. For each property listed, if the database name is not specified
by appending @db-name to the property, then the database name used for the previous
property is used.
The following command displays the page size and collation of the database mydb:
dbping -c ... -pd PageSize@mydb,Collation
-ps proper- Displays the specified database server properties. Supply the properties in a comma-sep-
ty,... arated list. You must specify enough connection information to establish a database
connection if you use this option. See “Server-level properties” on page 561.
For example, the following command displays the number of licensed seats or processors
for the database server:
dbping -c ... -ps LicenseCount
Option Description
-s Returns information about the performance of the network between the computer running
dbping and the computer running the database server. Approximate connection speed,
latency, and throughput are displayed. The -c option is usually required to specify the
connection parameters to connect to a database on the server. You can only use dbping -
s for embedded SQL connections. This option is ignored if -m or -l is also specified. By
default, dbping -s loops through the requests for at least one second for each statistic it
measures. A maximum of 200 connect and disconnect iterations are performed, regardless
of the time they take, to avoid consuming too many resources. On slower networks, it can
take several seconds to perform the minimum number of iterations for each statistic. The
performance statistics are approximate, and are more accurate when both the client and
server computers are fairly idle. See “Testing embedded SQL connection perform-
ance” on page 112.
-st time This option is the same as -s, except that it specifies the length of time, in seconds, that
dbping loops through the requests for each statistic it measures. This option allows more
accurate timing information to be obtained that -s. See “Testing embedded SQL connection
performance” on page 112.
-z Displays the network communication protocols used to attempt connection, and other di-
agnostic messages. This option is available only when an embedded SQL connection is
being attempted. That is, it cannot be combined with -m or -l.
Remarks
The dbping utility is a tool to help debug connection problems. It takes a full or partial connection string and
returns a message indicating whether the attempt to locate a server or database, or to connect, was successful.
The utility can be used for embedded SQL or ODBC connections. It cannot be used for jConnect (TDS)
connections.
Exit codes are 0 (success) or non-zero (failure). See “Software component exit codes” [SQL Anywhere Server
- Programming].
Syntax
rebuild old-database new-database [ DBA-password ]
Remarks
This batch file or shell script uses dbunload to rebuild old-database into new-database. Both database names
should be specified without extensions. An extension of .db is automatically added.
The DBA-password must be specified if the password for the DBA user in the old-database is not the initial
password sql.
Rebuild runs the dbunload command with the -an option.
You can also rebuild databases as part of the unload process using the Unload Database Wizard in Sybase
Central. See “Using the Unload Database Wizard” [SQL Anywhere Server - SQL Usage].
Exit codes are 0 (success) or non-zero (failure). See “Software component exit codes” [SQL Anywhere Server
- Programming].
This utility does not accept the @data parameter to read in options from a configuration file.
See also
● “Unload utility (dbunload)” on page 776
● “Initialization utility (dbinit)” on page 703
● “Interactive SQL utility (dbisql)” on page 716
Syntax
dbrunsql [ options ] [ SQL-script-file | SQL-command ]
Option Description
-d Write data exported from result sets to the output file. If you
do not specify -d, then all dbrunsql output is written to the
output file.
-qc Close the dbrunsql window once the command or script file
has been executed.
Option Description
Remarks
The dbrunsql utility allows you to execute SQL commands or run command files against a database. The
SQL Anywhere Script Execution utility (dbrunsql) is only supported on Windows Mobile.
Syntax
dblocate [ options ] [ server-name ]
Option Description
-d Lists the server name and address, for each server found,
followed by a comma-separated list of databases running
on that server. If the list exceeds 160 characters, it is trun-
cated and ends with an ellipsis (...).
Databases that are running on SQL Anywhere 9.0.2 and
earlier database servers or that were started with the -dh
database option are not listed. See “-dh database op-
tion” on page 238.
-dn database-name Lists the server name and address, for servers running a
database with the specified name. If the list exceeds 160
characters, it is truncated and ends with an ellipsis (...).
Databases that are running on SQL Anywhere 9.0.2 and
earlier database servers or that were started with the -dh
database option are not listed. See “-dh database op-
tion” on page 238.
-dv Displays the server name and address, for each server
found, listing each database running on that server on a
separate line. The list is not truncated, so this option can
be used to reveal lists that are truncated when the -d option
is used.
Databases that are running on SQL Anywhere 9.0.2 and
earlier database servers or that were started with the -dh
database option are not listed. See “-dh database op-
tion” on page 238.
Option Description
-p port-number Displays the server name and address only for servers us-
ing the specified TCP/IP port number. The TCP/IP port
number must be between 1 and 65535.
-s name Displays the server name and address only for servers
with the specified server name. If this option is used, the
-ss option should not be used (if both options are used, it
is likely that no matching servers will be found).
-ss substr Displays the server name and address only for servers that
contain the specified substring anywhere in the server
name. If this option is used, the -s option should not be
used (if both options are used, it is likely that no matching
servers will be found).
Remarks
The Server Enumeration utility (dblocate) locates any SQL Anywhere database servers running over TCP/
IP on the immediate network, and prints a list of the database servers and their addresses. This list includes
alternate server names. See “-sn database option” on page 243.
Depending on your network, it may take several seconds for dblocate to prints its results.
Note
If a database server is using a TCP/IP port other than 2638 on Mac OS X, dblocate will not find it, even if
the -p option is used to specify the TCP/IP port. See “ServerPort protocol option [PORT]” on page 302.
Exit codes are 0 (success) or non-zero (failure). See “Software component exit codes” [SQL Anywhere Server
- Programming].
The database server can register itself with an LDAP server, which keeps track of all servers in an enterprise.
This allows both clients and dblocate to find them, regardless of whether they are on a WAN or LAN, through
firewalls, and without specifying an IP address. LDAP is only used with TCP/IP, and only on network servers.
See “Connecting using an LDAP server” on page 138.
If the same database server name is found more than once, dblocate displays the IP address of each host,
even if the -n option is not specified. The same server name could be found in cases where a server is running
on a computer with multiple IP addresses (for example, if the computer has multiple network cards), or if a
network server is running on a remote computer and a personal server with the same name is running on the
local computer.
Syntax
dblic [ options ] license-file "user-name" "company-name"
Option Description
@data Reads in options from the specified environment variable or configuration file. See “Using
configuration files” on page 669.
If you want to protect passwords or other information in the configuration file, you can use
the File Hiding utility to obfuscate the contents of the configuration file. See “File Hiding
utility (dbfhide)” on page 698.
-l type Specifies the license type that matches the licensing model described in your software license
agreement. The following license types are supported:
● Perseat A perseat license restricts the number of client connections to the database
server. You can use any or all of the processors on the computer running the database
server.
● Processor A processor license restricts the number of separate physical processors that
can be used by the database server. The database server treats each physical processor as
a CPU for the purposes of this license type, and does not treat a dual core or hyperthreaded
processor as multiple processors. When you have a processor license, there are no restric-
tions on the number of client connections to the database server.
-u li- Specifies the total number of users or processors for the license. If you are adding extra li-
cense- censes, this is the total, not the number of additional licenses.
number
filename Specifies the path and file name of the server executable or license file for the personal database
server, network database server, or MobiLink server you are licensing.
You can view the current license information for a server executable by entering only the
license file name.
user- Specifies the user name for the license. This name appears on the database server messages
name window on startup. If there are spaces in the name, enclose it in double quotes.
compa- Specifies the company name for the license. This name appears on the database server mes-
ny-name sages window on startup. If there are spaces in the name, enclose it in double quotes.
Remarks
The Server Licensing utility adds licensed users or licensed processors to your SQL Anywhere database
server or MobiLink server. You must use this utility only in accordance with your license agreement to
license the number of users or processors to which you are entitled. Running this command does not grant
you license.
This utility also modifies the user and company names displayed at startup by the personal or network
database servers, and the MobiLink server.
You can also use this utility to view the current license information for a personal or network database server
by entering only the license file name.
Licensing information is stored in a .lic file in the same directory as the server executable. The server looks
for a .lic file that has the same base file name as the executable that is being run. For example, if the database
server executable was named myserver.exe, then the server looks for a license file named myserver.lic. By
default, the following names are used:
When you attempt to start a server, if the corresponding .lic file is not available, then the server does not
start. The license file is created by the SQL Anywhere installation program. The dblic utility only modifies
existing licenses; it does not create new license files.
Exit codes are 0 (success) or non-zero (failure). See “Software component exit codes” [SQL Anywhere Server
- Programming].
On Unix, the database server executable is not writable by default, so using the Server Licensing (dblic)
utility will fail. Make sure the executable is writable (for example, using chmod +w) before you use the
Server Licensing utility.
For more information about SQL Anywhere licensing, visit http://www.sybase.com/detail?id=1056242.
Example
The following command, executed in the same directory as the database server executable, applies a license
for 50 users, in the name of Sys Admin, for company My Co, to a Windows network database server. The
command must be entered all on one line:
dblic -l perseat -u 50 dbsrv11.lic "Sys Admin" "My Co"
The following messages appear on the screen to indicate the success of the license:
Licensed nodes: 50
User: Sys Admin
Company: My Co
The following command returns information about the license for a database server:
dblic dbsrv11.lic
Syntax
dbsvc [ modifier-options ] -d svc
dbsvc [ modifier-options ] -l
details:
<full-executable-path> [ options ]
@data Reads in options from the specified environment variable or configuration file. See “Using
configuration files” on page 669.
If you want to protect passwords or other information in the configuration file, you can
use the File Hiding utility to obfuscate the contents of the configuration file. See “File
Hiding utility (dbfhide)” on page 698.
-d service- Removes the named service from the list of services. If you supply -y, the service is deleted
name without confirmation.
-g service- Lists the definition of the service, not including the password.
name
-w executa- Creates a new service, or overwrites one if one of the same name exists. If you supply -
ble parame- y, the existing service is overwritten without confirmation.
ters
You must supply the full path to the executable that you want to use as a service, as the
account under which the service is running may not have the appropriate SQL Anywhere
installation directory in its path.
You must supply parameters appropriate for the service you are creating.
See:
● dbsrv11 and dbeng11 “The SQL Anywhere database server” on page 148
● mlsrv11 “MobiLink server options” [MobiLink - Server Administration]
● dbmlsync “dbmlsync syntax” [MobiLink - Client Administration]
● dblsn “Listener syntax” [MobiLink - Server-Initiated Synchronization]
● dbremote “Message Agent” [SQL Remote]
● dbns “Broadcast Repeater utility (dbns11)” on page 677
● dbltm “Log Transfer Manager utility (dbltm)” on page 726
● SAVSSWriter “SQL Anywhere Volume Shadow Copy Service
(VSS)” on page 873
Creation Description
option
-a acct Names the Windows account. All services run under a Windows account. If you run under
an account you have created, you must name the account with the -a option and supply a
password with the -p option.
The Login as a Service privilege is required for all accounts other than the LocalSystem
account. If an account does not have the Login as a Service privilege enabled, you are
prompted to enable it. If the -y option is also specified, dbsvc attempts to grant the Login as
a Service privilege without prompting you. If the -q option is specified without the -y option,
you are not prompted to grant the Login as a Service privilege and dbsvc fails.
-as All services run under a Windows account. When -as is specified, the service runs under the
Windows LocalSystem account. No password is required. One of -a or -as must be used.
-i Displays an icon that you can double-click to display the database server messages window.
Creation Description
option
-p Use this option with the -a option to specify the password for the account under which the
service runs.
-rg de- Specifies one or more load ordering groups that must be started before the service being
penden- created is allowed to start.
cy,...
-rs depend- Specifies that all the services in the list must have started before the service being created
ency,... is allowed to start.
-s startup Sets startup behavior for SQL Anywhere services. You can set startup behavior to Auto-
matic, Manual, or Disabled. The default is Manual.
-sd de- Use this option to provide a description of the service. The description appears in the Win-
scription dows Service Manager.
-sn name Use this option to provide a name for the service. This name appears in the Windows Service
Manager. If you do not specify the -sn option, the default service name is SQL Anywhere -
svc. For example, the following service is named SQL Anywhere - myserv by default.
To have the service name myserv appear in the Windows Service Manager, you need to
execute the following (entered all on one line):
dbsvc -as -sn myserv -w myserv
"c:\Program Files\SQL Anywhere 11\bin32\dbeng11.exe"
Creation Description
option
-t type Specifies the type for this service. You can choose from the following types:
● Network SQL Anywhere network database server (dbsrv11). See “The SQL Any-
where database server” on page 148.
● Standalone SQL Anywhere personal database server (dbeng11). See “The SQL
Anywhere database server” on page 148.
● DBLTM SQL Anywhere Log Transfer Manager (LTM). You can also specify LTM
for this service type. See “Log Transfer Manager utility (dbltm)” on page 726.
● DBRemote SQL Remote Message Agent (dbremote). See “Message Agent” [SQL
Remote].
● MobiLink MobiLink server (mlsrv11). See “mlsrv11 syntax” [MobiLink - Server Ad-
ministration].
● dbmlsync MobiLink synchronization client (dbmlsync). See “dbmlsync syn-
tax” [MobiLink - Client Administration].
● DBNS Broadcast Repeater (dbns11). See “Broadcast Repeater utility
(dbns11)” on page 677.
● dblsn Listener utility (dblsn). See “Listener syntax” [MobiLink - Server-Initiated
Synchronization].
● vss The Volume Shadow Copy Service (VSS). See “SQL Anywhere Volume Shadow
Copy Service (VSS)” on page 873.
Modifier Description
option
-cm Displays the command used to create the service. This option can be used to output the creation
command to a file, which can then be used to add the service on another computer or restore
a service to its original state if changes have been made to it. You must specify the -g option
or -l option with -cm or the command fails. Specifying -g displays the creation command for
the specified service, while specifying -l displays the creation command for all services.
If the specified service does not exist, the command to delete the service is generated. For
example, if service_1 does not exist on the computer, dbsvc -cm -g service_1 would
return the following command to delete the service_1 service:
dbsvc -y -d "service_1"
If the service does not use the LocalSystem account, there is no way to retrieve the password,
so it is not included in the command that is generated. If you created the service with -a
user -p password, only -a user is included in the output.
Modifier Description
option
-o log-file Writes output from the Service utility (dbsvc) to the specified file. The -o option must occur
before the -d, -g, -l, -u, and -x options. When you specify the -o option for both dbsvc and
for the executable that you are running as a service (for example, the database server), log
files are created for both. For example:
dbsvc -o out1.txt -y -as -w mydsn install-dir\bin32\dbsrv11 -n mysrv
-o c:\out2.txt
In this case, the output from dbsvc is logged to out1.txt, while the output from the database
server is logged to c:\out2.txt.
-q Do not display messages in the database server messages window. If you specify -q, it is also
recommended that you specify a file where messages are logged using the -o option. If you
specify this option when modifying or deleting an existing service, you must also specify -y
or the operation will fail.
-y Automatically performs the action without prompting for confirmation. This option can be
used with the -w or -d options. If you specify -q when modifying or deleting an existing
service, you must also specify -y or the operation will fail.
Remarks
A service runs a database server or other application with a set of options. This utility provides a
comprehensive way of managing SQL Anywhere services on Windows. You must be a member of the
Administrators group on the local computer to use the Service utility.
You can access the Service utility in the following ways:
● From Sybase Central, using the Create Service Wizard. See “Creating Windows
services” on page 55.
● At a command prompt, using the dbsvc command.
Exit codes are 0 (success) or non-zero (failure). See “Software component exit codes” [SQL Anywhere Server
- Programming].
See also
● “Understanding Windows services” on page 54
Example
Create a personal server service called myserv, which starts the specified server with the specified
parameters. The server runs as the LocalSystem user:
Create a network server service called mynetworkserv. The server runs under the local account, and starts
automatically when the computer is restarted:
Create a service dependent on the Workstation service and the TDI group:
dbsvc -rs Workstation -rg TDI -w ...
Generate the command to create the service_1 service and output it to a file called restoreservice.bat:
dbsvc -cm -g service_1 > restoreservice.bat
Create a Volume Shadow Copy Service (VSS) service that is started automatically when the database server
starts:
dbsvc -as -s Automatic -t vss -w SAVSSWriter "c:\Program Files\SQL Anywhere
11\bin32\dbvss11.exe"
Syntax
dbsvc [ modifier-options ] -d svc
dbsvc [ modifier-options ] -l
details:
full-executable-path [ options ]
-d service-name Removes the named service from the list of services. If you supply -y, the service is
deleted without confirmation.
-w executable Creates a new service, or overwrites one if one of the same name exists. If you supply
parameters -y, the existing service is overwritten without confirmation.
You must supply parameters appropriate for the service you are creating.
See:
● dbsrv11 and dbeng11 “The SQL Anywhere database server” on page 148
● mlsrv11 “MobiLink server options” [MobiLink - Server Administration]
● dbmlsync “dbmlsync syntax” [MobiLink - Client Administration]
● dbremote “Message Agent” [SQL Remote]
Creation Description
option
-a acct All services run under a Linux account. If you run under an account you have created, you
must name the account with the -a option.
The Login as a Service privilege is required for all accounts other than the daemon account.
-as All services run under a Linux account. When -as is specified, the service runs under the
Linux daemon account. No password is required. One of -a or -as must be used.
-t type Specifies the type for this service. You can choose from the following types:
● Network SQL Anywhere network database server (dbsrv11). See “The SQL Anywhere
database server” on page 148.
● Standalone SQL Anywhere personal database server (dbeng11). See “The SQL Any-
where database server” on page 148.
● DBRemote SQL Remote Message Agent (dbremote). See “Message Agent” [SQL
Remote].
● MobiLink MobiLink server (mlsrv11). See “mlsrv11 syntax” [MobiLink - Server Ad-
ministration].
● dbmlsync MobiLink synchronization client (dbmlsync). See “dbmlsync syntax” [Mo-
biLink - Client Administration].
-cm Displays the command used to create the service. This option can be used to output
the creation command to a file, which can then be used to add the service on another
computer or restore a service to its original state if changes have been made to it. You
must specify the -g option or -l option with -cm or the command fails. Specifying -g
displays the creation command for the specified service, while specifying -l displays
the creation command for all services.
-q Suppress messages to the console. If you specify this option when modifying or de-
leting an existing service, you must also specify -y or the operation will fail.
-y Automatically performs the action without prompting for confirmation. This option
can be used with the -w or -d options. If you specify -q when modifying or deleting an
existing service, you must also specify -y or the operation will fail.
Linux-specif- Description
ic options
-od Specify the location of the system information file (if required).
Remarks
A service runs a database server or other application with a set of options. This utility provides a
comprehensive way of managing SQL Anywhere services on Linux.
Because services typically run in a different environment, it is recommended that you fully qualify the name
of the database file when creating a service. It is also recommended that you do not use spaces in data source
names.
Like most Linux services, the dbsvc utility creates service files in /etc/init.d. The naming convention for the
service is SA_service-name. For example, if you created a service named myserv, you could issue the
following command to start the service:
/etc/init.d/SA_myserv start
Example
Create a personal server service called myserv, which starts the specified server with the specified
parameters. The server runs as the LocalSystem user:
dbsvc -as -w myserv -n myeng -c 8m "/tmp/demo.db"
Create a network server service called mynetworkserv. The server runs under the local account, and starts
automatically when the computer is restarted:
dbsvc -as -t network -w mynetworkserv -x tcpip -c 8m "/tmp/demo.db"
dbsvc -g myserv
Generate the command to create the service_1 service and output it the console:
dbsvc -cm -g service_1
Syntax
dbconsole [ options ]
Option Description
@data Use this option to read in options from the specified environment variable or con-
figuration file. See “Using configuration files” on page 669.
If you want to protect passwords or other information in the configuration file, you
can use the File Hiding utility to obfuscate the contents of the configuration file. See
“File Hiding utility (dbfhide)” on page 698.
-datasource Specify an ODBC data source to connect to. You do not need to be using the iAny-
DSN-name where JDBC driver to use this option.
-host hostname Specify the hostname or IP address of the computer on which the database server is
running. You can use the name localhost to represent the current computer.
-port port-number Specify the port number on which the database server is running. The default port
number for SQL Anywhere is 2638.
Remarks
The SQL Anywhere Console allows you to monitor the server from a client computer. This utility is also
called the Network Server Monitor. You can use it to track who is logged on to a database server elsewhere
on your network. You can also display both server and client statistics on your local client screen, disconnect
users, and configure the database server. The SQL Anywhere Console can display information for multiple
connections.
To disconnect a user from a database
1. Connect to the database from the SQL Anywhere Console.
2. In the User ID column, right-click the user and choose Disconnect.
You can configure the columns that appear in the SQL Anywhere Console in the Options window, which
can be accessed by choosing File » Options. See “Using the SQL Anywhere Console
utility” on page 662.
The SQL Anywhere Console is available on all supported platforms except Windows Mobile, AIX, HP-UX,
and HP-UX Itanium. On these platforms, you can use the connection-level, server-level, and database-level
properties to obtain information or you can monitor your server from a computer running an operating system
that supports the SQL Anywhere Console (such as Windows, Mac OS X, or Linux).
For more information about obtaining property values, see “Database properties” on page 537.
Syntax
dbspawn [ options ] server-command
Option Description
@data Read in options from the specified environment variable or configuration file. If both exist with
the same name, the environment variable is used. The Start Server in Background utility
(dbspawn) does not expand the contents of configuration files specified with the @data option.
See “Using configuration files” on page 669.
If you want to protect passwords or other information in the configuration file, you can use the
File Hiding utility to obfuscate the contents of the configuration file. See “File Hiding utility
(dbfhide)” on page 698.
-f Force dbspawn to start a database server, even if a default database server already exists. If a
database server is running but is not the default, dbspawn starts another server.
If a database server is already running with the same name as the database server that dbspawn
is attempting to start, dbspawn returns success without starting a new server.
-p Specify the operating system process ID of the database server process. For example:
dbspawn -p dbeng11 -n newserver
server- Specify the command line for starting the database server. See “The SQL Anywhere database
com- server” on page 148.
mand
Remarks
The dbspawn utility is provided to start a server in the background. dbspawn starts the server in the
background and returns with an exit code of 0 (success) or non-zero (failure). If a database server is already
running on the same computer, dbspawn does not start the new server and reports failure. Otherwise, dbspawn
does not return until the database server has completed initialization and is ready to accept requests.
For more information about exit codes, see “Software component exit codes” [SQL Anywhere Server -
Programming].
The dbspawn utility is useful for starting a server from a batch file, especially when subsequent commands
in the batch file require a server that is accepting requests.
If the specified path includes at least one space, you must enclose the path in one set of double quotes. For
example,
dbspawn dbeng11 "c:\my databases\mysalesdata.db"
If the specified path does not contain spaces, then quotes are not required.
Syntax
dbstop [ options ] [ server-name ]
Option Description
@data Read in options from the specified environment variable or configuration file. See “Using
configuration files” on page 669.
If you want to protect passwords or other information in the configuration file, you can
use the File Hiding utility to obfuscate the contents of the configuration file. See “File
Hiding utility (dbfhide)” on page 698.
-c "key- Specify a connection string. When stopping a network server, the connection string must
word=val- include a user ID that has permissions to stop the server. By default, DBA authority is
ue; ..." required on the network server, and all users can shut down a personal server, but the -
gk server option can be used to change this.
If you supply connection parameters, do not supply a server name as well. See “Con-
nection parameters” on page 248, “Unconditional connection parameter
[UNC]” on page 283, and “-gk server option” on page 181.
-d Do not stop the database server. Instead, only stop the database specified in the connec-
tion string.
-x Do not stop the server if there are still active connections to the server. Including this
option prevents dbstop from prompting for confirmation if there are active connections.
-y Stop the server even if there are still active connections to the server. This is equivalent
to including Unconditional=YES in the connection parameters.
server-name Specify the name of a database server running on the current computer. The database
server must be started so that no permissions are required to shut it down. The personal
database server starts in this mode by default. For the network database server, you must
supply the -gk all option. See “-gk server option” on page 181.
If you supply a server name, do not supply connection parameters as well.
Remarks
The Stop Server utility stops a database server. You can use the -d option to stop a specified database.
The Stop Server utility can only be run at a command prompt. In windowed environments, you can stop a
database server by clicking Shut Down on the database server messages window.
Options let you control whether a server is stopped, even if there are active connections, and whether to stop
a server or only a database.
The behavior of dbstop can be controlled if there are active connections on a server. If there are active
connections, dbstop provides a prompt asking if you want to shut down the server. The -x and -y options
can be used to change this behavior.
If dbstop is able to stop the database server, dbstop does not complete until all databases have stopped
running, and the database server has been stopped enough so that another server could be started with the
same name and databases. When dbstop successfully completes, the database server process may still be
running, and some of its resources, such as the output file specified by the -o server option, may still be in
use.
Exit codes are 0 (success) or non-zero (failure). See “Software component exit codes” [SQL Anywhere Server
- Programming].
If you want to use the SQLCONNECT environment variable with dbstop, you should specify the -c option.
Otherwise, you can get unexpected results.
Example
You are running the server named myserver without a database. To stop the server, specify the utility database
as a DatabaseName (DBN) connection parameter:
dbstop -c "UID=DBA;PWD=sql;ENG=myserver;DBN=utility_db"
You are running the server named myserver with the database demo.db started. To stop the server and
database:
dbstop -c "UID=DBA;PWD=sql;ENG=myserver"
You are running a personal server named myserver. To stop the server and databases even if there are
connections:
dbstop -y myserver
You are running a server named myserver with the database demo.db. To stop only the database named
demo, but not other databases or the server itself, execute the following command:
dbstop -c "UID=DBA;PWD=sql;ENG=myserver;DBN=demo" -d
Syntax
dbsupport [ options ] operation [ operation-specific-option ]
dbsupport configuration-options
Option Description
@data Read in options from the specified environment variable or configuration file. See “Using
configuration files” on page 669.
If you want to protect passwords or other information in the configuration file, you can use
the File Hiding utility to obfuscate the contents of the configuration file. See “File Hiding
utility (dbfhide)” on page 698.
Operation Description
-is submission-ID [ -rr N ] Check the status of a crash report that has been submitted
to iAnywhere Solutions.
For example, the following command inquires about the
status of submission ID 66:
dbsupport -is 66
Operation Description
-lc Generate a list of all crash reports that have not been
submitted to iAnywhere Solutions. The report names
listed can be used with the -sc option.
-ls Generate a list of submission IDs for all reports that have
been submitted to iAnywhere Solutions. For example:
dbsupport -ls
-pc filename Display crash report information. You can use this op-
tion to view information before it is submitted to iAny-
where Solutions.
-ps submission-ID Display information about a specific report that has been
submitted to iAnywhere Solutions. For example:
dbsupport -ps 4
-sa [ -r number-of-submission-retries ] Submit all crash report and diagnostic information stor-
ed in the diagnostic directory to iAnywhere Solutions.
-sc reportname [ -r number-of-submission-re- Submit a crash report and diagnostic information to iA-
tries ] [ -nr | -rr N ] nywhere Solutions. For example:
dbsupport -sc 20051220_133828_32116
Use the -lc option to see a list of reports that have not
been submitted.
Operation Description
Configuration options
-cc [ autosubmit | no | promptDefY | prompt- Change the prompting behavior of dbsupport. You can
DefN ] specify one of the following options:
● autosubmit Submit reports automatically.
● no Do not prompt for permission to submit re-
ports. Reports and feature statistics are not submit-
ted.
● promptDefY If possible, prompt for permission
to submit the report. If no answer is given, submit
the report.
● promptDefN If possible, prompt for permission
to submit the report. If no answer is given, do not
submit the report. This is the default behavior.
For example, if you are using embedded SQL Any-
where in an application, you may want to configure
the Support utility to not submit reports to iAny-
where Solutions.
-cd retry-delay Specify the retry delay, in seconds, for submitting a re-
port if the previous attempt is unsuccessful. The default
delay is 30 seconds.
If you specify this option, its value becomes the default
used by the Support utility. The setting is stored in the
dbsupport.ini file in the diagnostic directory.
The following dbsupport command specifies that failed
submissions should be retried every 3 seconds, up to a
maximum of 4 times before giving up:
dbsupport -cr 4 -cd 3
-ce email-address;email-server[:port ][;user- Specify the address where an email is sent after a crash
id:password ] occurs. The email is sent using the email-server SMTP
server. Optionally, you can specify the port that should
be used, as well as the user-id and password used to au-
thenticate with the SMTP server.
-ch- Remove the crash handler settings that are stored in the
dbsupport.ini file. For example:
dbsupport -ch-
-cp { email-server [ :port ] | autodetect } Configure the HTTP proxy host and port used to submit
error reports.
On Windows, the syntax -cp autodetect is also suppor-
ted. If you specify this option, then if a proxy server and
port have been set using Internet Explorer, and they are
currently enabled, dbsupport configures its proxy serv-
er and port using the system setting. You can set the
proxy server and port in Internet Explorer on Windows
by choosing Tools » Options » Lan Settings.
-cp- Remove HTTP proxy host and port settings from the
dbsupport.ini file. For example:
dbsupport -cp-
-nr Specify that dbsupport does not check the server for the
status of the submission. For example, the following
command submits the report, but does not check for the
status of the new submission:
dbsupport -nr -sc 20051220_133828_32116
Remarks
The Support utility (dbsupport) can be used for any of the following tasks:
● submit diagnostic information and crash reports to iAnywhere Solutions over the Internet
● submit feature statistics
● list information about submitted and unsubmitted crash reports
By default, dbsupport checks whether there is already a fix for the problem being submitted.
Information from any of the following applications can be sent as an error report if a fatal error occurs:
● Interactive SQL (dbisql)
● MobiLink Listener (dblsn)
● MobiLink server (mlsrv)
● network server (dbsrv11)
● personal server (dbeng11)
● QAnywhere agent (qaagent)
● Replication Agent (dbltm)
● SQL Anywhere client for MobiLink (dbmlsync)
● SQL Anywhere Console utility (dbconsole)
● SQL Remote (dbremote)
● Sybase Central
When a report is successfully submitted, it is assigned a unique submission ID. Reports are written to the
diagnostic directory.
Unix $HOME/.sqlanywhere11/diagnostics
For information about the diagnostic directory, see “SADIAGDIR environment variable” on page 321.
For more information about error reports and how they are submitted, see “Error reporting in SQL
Anywhere” on page 71.
The Support utility can also be configured to perform certain actions when a problem is detected. For
example, it can be configured to execute a specified handler program each time the database server submits
an error report. This feature is useful for adding your own custom actions to the error handling process.
As well, the Support utility can be configured to retry certain operations. For example, when submitting a
report, it could be configured to retry the operation again in 30 seconds, up to a maximum of 10 times. This
feature is useful for handling the case where the service may be temporarily unavailable.
Settings for the Support utility are stored in the dbsupport.ini file in the diagnostic directory.
The operation-specific options are useful for overriding default behavior, including those that have been
saved in the dbsupport.ini file.
See also
● “SADIAGDIR environment variable” on page 321
● “Software component exit codes” [SQL Anywhere Server - Programming]
Syntax
dblog [ options ] database-file
Option Description
@data Read in options from the specified environment variable or configuration file. See “Using
configuration files” on page 669.
If you want to protect passwords or other information in the configuration file, you can use
the File Hiding utility to obfuscate the contents of the configuration file. See “File Hiding
utility (dbfhide)” on page 698.
-ek key Specify the encryption key for strongly encrypted databases directly in the command. If
you have a strongly encrypted database, you must provide the encryption key to use the
database or transaction log in any way. For strongly encrypted databases, you must specify
either -ek or -ep, but not both. The command will fail if you do not specify the correct key
for a strongly encrypted database.
-ep Specify that you want to be prompted for the encryption key. This option causes a window
to appear, in which you enter the encryption key. It provides an extra measure of security
by never allowing the encryption key to be seen in clear text. For strongly encrypted data-
bases, you must specify either -ek or -ep, but not both. The command will fail if you do not
specify the correct key for a strongly encrypted database.
-g n Use this option if you are using the Log Transfer Manager to participate in a Replication
Server installation. It can be used after a backup is restored, to set the generation number.
It performs the same function as the following Replication Server function:
dbcc settrunc( 'ltm', 'gen_id', n )
For information about generation numbers and dbcc, see your Replication Server docu-
mentation.
-il Use this option if you have stopped using the Log Transfer Manager to participate in a
Replication Server installation on this database, but continue to use SQL Remote or Mobi-
Link synchronization. It resets the Log Transfer Manager log offset that is kept for the
delete_old_logs option, allowing transaction logs to be deleted when they are no longer
needed.
It performs the same function as the following Replication Server function:
dbcc settrunc( 'ltm', 'ignore' )
Option Description
-ir Use this option if you have stopped using SQL Remote on this database, but continue to
use the Log Transfer Manager or MobiLink synchronization. It resets the SQL Remote log
offset that is kept for the delete_old_logs option, allowing transaction logs to be deleted
when they are no longer needed.
-is Use this option if you have stopped using MobiLink synchronization on this database, but
continue to use the Log Transfer Manager or SQL Remote. It resets the MobiLink log offset
that is kept for the delete_old_logs option, allowing transaction logs to be deleted when they
are no longer needed.
-m mirror- Specify the file name for a new transaction log mirror. If the database is not currently using
name a transaction log mirror, it starts using one. If the database is already using a transaction log
mirror, it changes to using the new file as its transaction log mirror.
-n Stop using a transaction log, and stop using a mirror log. Without a transaction log, the
database can no longer participate in data replication or use the transaction log in data
recovery. If a SQL Remote, Log Transfer Manager, or dbmlsync truncation offset exists,
the transaction log cannot be removed unless the corresponding ignore option (-il for the
Log Transfer Manager, -ir for SQL Remote, or -is for dbmlsync) is also specified. You
cannot stop using a transaction log if the database has auditing turned on (unless you first
turn auditing off).
-r Maintain a single transaction log for databases that maintain a mirrored transaction log.
-t log-name Specify the file name for a new transaction log. If the database is not currently using a
transaction log, it starts using one. If the database is already using a transaction log, it
changes to using the new file as its transaction log.
-x n Reset the transaction log current relative offset to n, so that the database can take part in
replication. This option is used for reloading SQL Remote consolidated databases. This
option ee “Unloading and reloading a database participating in replication” [SQL Re-
mote].
-z n Reset the transaction log starting offset to n, so that the database can take part in replication.
This option is used for reloading SQL Remote consolidated databases. See “Unloading and
reloading a database participating in replication” [SQL Remote].
Remarks
The dblog utility allows you to display or change the name of the transaction log or transaction log mirror
associated with a database. You can also stop a database from maintaining a transaction log or mirror, or
start maintaining a transaction log or mirror.
A transaction log mirror is a duplicate copy of a transaction log, maintained by the database in tandem.
The name of the transaction log is first set when the database is initialized. The Transaction Log utility works
with database files. The database server must not be running on that database when the transaction log file
name is changed (or an error message appears).
The utility displays additional information about the transaction log, including the following:
● Version number
● The name of the transaction log file
● The name of the mirror log file, if any
● The current relative offset
You can access the Transaction Log utility in the following ways:
● From Sybase Central, using the Change Log File Settings Wizard. See “Changing the location of a
transaction log” on page 892.
● From Interactive SQL, using the ALTER DATABASE dbfile ALTER LOG statement. See “ALTER
DATABASE statement” [SQL Anywhere Server - SQL Reference].
● At a command prompt, using the dblog command.
Exit codes are 0 (success) or non-zero (failure). See “Software component exit codes” [SQL Anywhere Server
- Programming].
Syntax
dbunload [ options ] [ directory ]
Option Description
@data Read in options from the specified environment variable or configuration file. See “Using
configuration files” on page 669.
If you want to protect passwords or other information in the configuration file, you can use
the File Hiding utility to obfuscate the contents of the configuration file. See “File Hiding
utility (dbfhide)” on page 698.
-ac "key- Connect to an existing database and reload the data directly into it, combining the operations
word=val- of unloading a database and reloading the results into an existing database. This option is
ue; ..." not supported on Windows Mobile.
For example, you could create a new database using the Initialization utility, and then reload
it using this option. This method is useful when you want to change initialization options.
The following command (entered all on one line) loads a copy of the c:\mydata.db database
into an existing database file named c:\mynewdata.db:
dbunload -c "UID=DBA;PWD=sql;DBF=c:\mydata.db"
-ac "UID=DBA;PWD=sql;DBF=c:\mynewdata.db"
If the original database was created using version 9 or earlier of SQL Anywhere and the
new database is not already running, you must provide a database server name in the -ac
option. For example:
dbunload -c "UID=DBA;PWD=sql;DBF=c:\mydata.db"
-ac "UID=DBA;PWD=sql;DBF=c:\mynewdata.db;ENG=newserver"
If you use this option, no interim copy of the data is created on disk, so do not specify an
unload directory in the command. This provides greater security for your data.
Option Description
-an data- Combine the operations of unloading a database, creating a new database, and loading the
base data using this option. This option is not supported on Windows Mobile or when rebuilding
version 9 or earlier databases on Mac OS X on Intel.
The options specified when you created the source database are used to create the new
database. However, you can change the initialization options as necessary by specifying
other supported dbunload options (such as -ap to change the page size or -et to enable table
encryption).
For example, the following command (which should be entered all on one line) creates a
new database file named mydatacopy.db and copies the schema and data of mydata.db into
it:
dbunload -c "UID=DBA;PWD=sql;DBF=c:\mydata.db"
-an c:\mydatacopy.db
If you use this option, no interim copy of the data is created on disk, so you do not specify
an unload directory in the command. This provides greater security for your data.
When the new database is created, the dbspace file names have an R appended to the file
name to prevent file name conflicts if the dbspace file for the new database is created in
the same directory as the dbspace for the original database. For example, if an unloaded
database has a dbspace called library in the file library.db, then the library dbspace for the
new database is library.dbR.
The file specified by -an is relative to the database server.
-ap size Set the page size of the new database. This option is ignored unless -an or -ar is also used.
The page size for a database can be (in bytes) 2048, 4096, 8192, 16384, or 32768, with the
default being the page size of the original database. You must specify either -an or -ar with
this option. If there are already databases running on the database server, the server's page
size (set with the -gp option) must be large enough to handle the new page size. See “-gp
server option” on page 184.
Option Description
-ar [ direc- Create a new database with the same settings as the old database, reload it, and replace the
tory ] old database. However, you can change the initialization options as necessary by specifying
other supported dbunload options (such as -ap to change the page size or -et to enable table
encryption).
If you use this option, there can be no other connections to the database, and the database
connection must be local, not over a network. This option is not supported on Windows
Mobile or when rebuilding version 9 or earlier databases on Mac OS X on Intel.
If you specify an optional directory, the transaction log offsets are reset for replication
purposes, and the transaction log from the old database is moved to the specified directory.
The named directory should be the directory that holds the old transaction logs used by the
Message Agent and the Replication Agent. The transaction log management is handled
only if the database is used in replication: if there is no SQL Remote publisher or LTM
check, then the old transaction log is not needed and is deleted instead of being copied to
the specified directory. See “Backup methods for remote databases in replication installa-
tions” on page 861.
When the new database is created, the dbspace file names have an R appended to the file
name to prevent file name conflicts if the dbspace file for the new database is created in
the same directory as the dbspace for the original database. For example, if an unloaded
database has a dbspace called library in the file library.db, then the library dbspace for the
new database is library.dbR.
If you are rebuilding an encrypted database, the encryption key for the original and new
databases must be the same.
Using the -ar option resets the database truncation points to zero.
-c "key- Specify the connection parameters for the source database. For a description of the con-
word=val- nection parameters, see “Connection parameters” on page 248. The user ID should have
ue; ..." DBA authority to ensure that the user has permissions on all the tables in the database.
For example, the following statement unloads the sample database, connecting as user ID
DBA with password sql. The data is unloaded into the c:\unload directory.
dbunload -c "DBF=samples-dir\demo.db;UID=DBA;PWD=sql" c:\unload
-cp Compress the table data output files by appending the COMPRESSED keyword to the
UNLOAD TABLE statements it executes. This option has no effect when specified with -
an or -ar.
-d With this option, none of the database definition commands are generated (CREATE TA-
BLE, CREATE INDEX, and so on); reload.sql contains statements to reload the data only.
Option Description
-dc Force all computed columns in the database to be recalculated. By default, computed col-
umn values are not recalculated. When the -dc option is specified, a new section is added
to the reload.sql script to recompute computed columns. Statements of the following form
are added.
ALTER TABLE "owner"."table-name"
ALTER "computed-column" SET COMPUTE (compute-expression);
-e table, ... Exclude the specified tables from the reload.sql file. Table names are always case insen-
sitive, even in case sensitive databases.
A reload.sql file created with the -e option should not be used to rebuild a database because
the file will not include all the database tables. If a table has foreign keys referring to it,
the database cannot be rebuilt without the contents of the table.
It is recommended that you only use the -e option with the -d option to unload data for all
tables except those identified by -e.
Option Description
-ea algo- Specify the encryption algorithm used for database or table encryption (-et). Specify -ea
rithm simple for simple encryption (do not specify -ek or -ep). Simple encryption is equivalent
to obfuscation and is intended only to keep data hidden in the event of casual direct access
of the database file, to make it more difficult for someone to decipher the data in your
database using a disk utility to look at the file.
For greater security, specify AES or AES256 for 128-bit or 256-bit strong encryption,
respectively. Specify AES_FIPS or AES256_FIPS for 128-bit or 256-bit FIPS-approved
encryption, respectively. For strong encryption, you must also specify the -ek or -ep option.
For more information about strong encryption, see “Strong encryption” on page 965.
To create a database that is not encrypted, specify -ea none, or do not include the -ea option
(and do not specify -e, -et, -ep, or -et).
If you do not specify the -ea option, the default behavior is as follows:
● -ea none, if -ek, -ep, or -et is not specified
● -ea AES, if -ek or -ep is specified (with or without -et)
● -ea simple, if -et is used without -ek or -ep
-ek key Specify an encryption key in the dbunload command for the new database created if you
unload and reload a database (using the -an option). If you create a strongly encrypted
database, you must provide the encryption key to use the database or transaction log in any
way. The algorithm used to encrypt the database is the algorithm specified by the -ea option.
If you specify the -ek option without specifying -ea, the AES algorithm is used. See “Strong
encryption” on page 965.
Protect your key. Be sure to store a copy of your key in a safe location. A lost key will
result in a completely inaccessible database, from which there is no recovery.
-ep Prompt for an encryption key for the new database created if you unload and reload your
database using the -an option. It provides an extra measure of security by never allowing
the encryption key to be seen in clear text. If you specify -ep without specifying -an, the -
ep option is ignored. If you specify -ep and -an, you must input the encryption key twice
to confirm that it was entered correctly. If the keys don't match, the unload fails. See
“Strong encryption” on page 965.
Option Description
-et Enable database table encryption in the new database (-an or -ar must also be specified).
If you specify the -et option without the -ea option, the AES algorithm is used. If you specify
the -et option, you must also specify -ep or -ek. You can change the table encryption settings
for the new database to be different than those of the database you are unloading.
When rebuilding a database that has table encryption enabled, you must specify either -er
or -et to indicate whether the new database has table encryption enabled, otherwise you get
an error when attempting to load the data into the new database.
The following example unloads a database (mydata.db) that has tables encrypted with the
simple encryption algorithm, into a new database (mydatacopy.db) that has table encryption
enabled, and uses AES_FIPS encryption with the key 34jh:
dbunload -an c:\mydatacopy.db -et -ea AES_FIPS
-ek 34jh
-c "UID=DBA;PWD=sql;DBF=c:\mydata.db"
Option Description
-ii Use the UNLOAD statement to extract data from the database, and uses the LOAD state-
ment in the reload.sql file to repopulate the database with data. This is the default.
-ix Use the UNLOAD statement to extract data from the database, and uses the Interactive
SQL INPUT statement in the reload.sql file to repopulate the database with data.
-k Populate the sa_diagnostic_auxiliary_catalog table. This table maps database object IDs
for tables, users, procedures, and so on, from the source database to the tracing database.
It also causes all histograms to be unloaded/reloaded. This option is used when creating a
tracing database, that is, a database that receives diagnostic tracing information. The sa_di-
agnostic_auxiliary_catalog table allows the server to simulate conditions that were present
when tracing data was captured (for example, for use with Index Consultant, or application
profiling). This option is most useful when specified with the -n option. See “Advanced
application profiling using diagnostic tracing” [SQL Anywhere Server - SQL Usage] and
“sa_diagnostic_auxiliary_catalog table” [SQL Anywhere Server - SQL Reference].
-n Do not unload database data; reload.sql contains SQL statements to build the structure of
the database only. If you want the reload.sql file to contain LOAD TABLE or INPUT
statements, use -nl instead.
Option Description
-nl Unload the structure (the same behavior as the -n option), but the resulting reload.sql file
also includes LOAD TABLE or INPUT statements for each table. No user data is unloaded
when this option is used. When you specify -nl, you must also include a data directory so
that the LOAD/INPUT statements can be generated, even though no files are written to the
directory. This option allows you to generate a reload script without unloading data. You
can unload the data by specifying -d. If a database contains a table whose data should not
be unloaded, unloading the data for that table can be skipped using dbunload -d -e
table-name.
-no Unload the database objects ordered by name. By default, dbunload generates objects in
the order they were created. Specifying the -no option may be useful for comparing database
schemas when the databases contain the same objects, but the creation order was different.
Object definitions are grouped by object type in alphabetical order in the reload.sql file if
-no is specified:
● users
● group memberships
● tables
● indexes and foreign keys
● views
● procedures
● functions
● triggers
● events
● web services
The object definitions are output in owner,name order. In some cases a third element is
included in the ordering (for example, foreign key role name, trigger name).
The -no option cannot be used with the -n, -nl, -ar, -an, or -ac option. To simplify com-
parisons, it is recommended that you use -no option when comparing the reload scripts for
databases that were created using the same version of the database server because of minor
differences in the object definitions.
Caution
The generated file should not be used to create a new database because in some cases the
object creation order can be important. For example, if procedure p2 calls procedure p1
and p1 returns a result set, it may be important to define p1 before p2. Attempting to execute
a reload.sql script generated with -no option results in an error.
-o filename Write output messages to the named file. The location of this file is relative to dbunload.
-p char Replace the default escape character (\) for external unloads (dbunload -x option) with
another character. This option is available only when you run this utility from a command
prompt.
Option Description
-q Run in quiet mode—do not display messages or windows. This option is available only
when you run this utility from a command prompt. If you specify -q, you must also specify
-y or the unload will fail if reload.sql already exists.
-qc Close the messages window once the unload completes. By default, the dbunload messages
window remains open until a user closes it. This option is only available on Windows
Mobile.
-r reload-file Modify the name and directory of the generated reload command file. The default is re-
load.sql in the current directory. The directory is relative to the current directory of the
client application, not the server.
-t table,... Specify a list of tables to be unloaded. By default, all tables are unloaded. Together with
the -n option, this allows you to unload a set of table definitions only. Table names are
always case insensitive, even in case sensitive databases.
A reload.sql file created with the -t option should not be used to rebuild a database because
the file will not include all the database tables. If a table has foreign keys referring to it,
the database cannot be rebuilt without the contents of the table.
It is recommended that you only use the -t option with the -d option to unload data for the
tables identified by -t.
-u Use this option if you are unloading a database with a corrupt index, so that the corrupt
index is not used to order the data. Normally, the data in each table is ordered by the primary
key or clustered index if one is defined for the table.
-v Display the name of the table being unloaded, as well as the number of rows that have been
unloaded. This option is available only when you run dbunload from a command prompt.
-xi Perform an external unload by unloading data to the dbunload client, and then using the
LOAD statement in the generated reload command file, reload.sql, to repopulate the da-
tabase with data.
-xx Perform an external unload by unloading data to the dbunload client, and then using the
Interactive SQL INPUT statement in the generated reload command file, reload.sql, to
repopulate the database with data.
-y Replace existing command files without prompting for confirmation. If you specify -q, you
must also specify -y or the unload will fail if dbunload detects that a command file already
exists.
There are special considerations for unloading databases involved in replication. See
“Unloading and reloading a database participating in replication” [SQL Remote] and
“Upgrading SQL Remote” [SQL Anywhere 11 - Changes and Upgrading].
Remarks
Upgrading to version 11
For detailed information about rebuilding an existing database into a version 11 database, see “Upgrading
SQL Anywhere” [SQL Anywhere 11 - Changes and Upgrading].
When using dbunload with a version 10.0.0 or later database, the version of dbunload used must match the
version of the database server used to access the database. If an older version of dbunload is used with a
newer database server, or vice versa, an error is reported.
With the Unload utility, you can unload a database and put a set of data files in a named directory. The
Unload utility creates an Interactive SQL command file to rebuild your database. It also unloads all of the
data in each of your tables into files in the specified directory, in comma-delimited format. Binary data is
properly represented with escape sequences.
An internal unload/reload will unload information about the current status of each user by issuing UPDATE
ISYSUSER statements. An external unload/reload does not include this information and the status of all
users is reset. See “Managing login policies overview” on page 386.
When you rebuild a database by unloading and reloading it, the rebuilt database may be smaller than the
original database. This decrease in database size may be the result of indexing changes in SQL Anywhere,
and does not indicate a problem or a loss of data.
You can also use the Unload utility to directly create a new database from an existing one. This avoids
potential security problems with the database contents being written to ordinary disk files.
If you only want to unload table data, you can do so in one step using the Unload Data window in Sybase
Central.
For more information, see “Using the Unload Data window” [SQL Anywhere Server - SQL Usage].
There are special considerations for unloading databases involved in replication. See “Unloading and
reloading a database participating in replication” [SQL Remote].
You can access the Unload utility in the following ways:
● From Sybase Central, using the Unload Database Wizard. See “Using the Unload Database
Wizard” [SQL Anywhere Server - SQL Usage].
● At a command prompt, using the dbunload command. This is useful for incorporating into batch or
command files.
The Unload utility should be run by a user ID with DBA authority. This is the only way you can be sure of
having the necessary privileges to unload all the data. In addition, the reload.sql file should be run by a user
with DBA authority. (Usually, it is run on a new database where the only user ID is DBA with password
sql.)
The database server -gl option controls the permissions required to unload data from the database. See “-gl
server option” on page 182.
The dbo user ID owns a set of system objects in a database, including views and stored procedures.
The Unload utility does not unload the objects that were created for the dbo user ID during database creation.
Changes made to these objects, such as redefining a system procedure, are lost when the database is unloaded.
Any objects that were created by the dbo user ID since the initialization of the database are unloaded by the
Unload utility, and so these objects are preserved.
When you unload a database, changes to permissions on system objects are not unloaded. You must grant
or revoke these permissions in the new database.
The directory is the destination directory where the unloaded data is to be placed. The reload.sql command
file is always relative to the current directory of the user.
Tip
Before rebuilding your database, it is recommended that you validate the reload process by reloading the
database without any data, by running a command similar to the following:
dbunload -n -an new.db -c "UID=your-user-id;PWD=your-password;DBF=original-
database-file"
You should fix any problems that are identified in the original database before rebuilding it.
In the default mode, or if -ii or -ix is used, the directory used by dbunload to hold the data is relative to the
database server, not to the current directory of the user.
If -xi or -xx is used, the directory is relative to the current directory of the user.
For more information about supplying a file name and path in this mode, see “UNLOAD statement” [SQL
Anywhere Server - SQL Reference].
If no list of tables is supplied, the whole database is unloaded. If a list of tables is supplied, only those tables
are unloaded.
Unloaded data includes the column list for the LOAD TABLE statements generated in the reload.sql file.
Unloading the column list facilitates reordering of the columns in a table. Tables can be dropped or recreated,
and then repopulated using reload.sql.
The LOAD TABLE statements generated by dbunload turn off check constraints and computed columns.
Exit codes are 0 (success) or non-zero (failure). See “Software component exit codes” [SQL Anywhere Server
- Programming].
The following options offer combinations of internal and external unloads and reloads: -ii, -ix, -xi, and -xx.
A significant performance gain can be realized using internal commands (UNLOAD/LOAD) versus external
commands (Interactive SQL's INPUT and OUTPUT statements). However, internal commands are executed
by the server so that file and directory paths are relative to the location of the database server. Using external
commands, file and directory paths are relative to the current directory of the user.
In Sybase Central, you can specify whether to unload relative to the server or client. See “UNLOAD
statement” [SQL Anywhere Server - SQL Reference].
When you use an external unload and reload to unload, reload, or rebuild a database and the character set of
the database is incompatible with the character set of the host system on which dbunload is running, character
set conversion may cause data to be corrupted as it is converted between the database character set and the
host system's character set.
To avoid this problem, specify the database character set in the connection string for the database (-c and -
ac options). For example, if the database character set is UTF-8, you should include "charset=utf-8" in the
connection strings:
dbunload -c UID=user-ID;PWD=password;
CHARSET=utf-8;DBF=filename -ac UID=user-ID;
PWD=password;CHARSET=utf-8;ENG=server-name -xx
When you perform an external unload, the beginning of the reload.sql includes a commented CREATE
DATABASE statement. This statement can be used to create a database that is equivalent to the one being
unloaded.
If the unloaded database was created with version 9 or earlier of SQL Anywhere and had a custom collation,
the COLLATION clause appears as follows:
COLLATION collation-label DEFINITION collation-definition
Failed unloads
If a failure occurs during an internal rebuild of a database using -ar or -an, after the table data has been
reloaded and any indexes on the table have been rebuilt, dbunload creates a file named unprocessed.sql in
the current directory. This file contains all of the statements that were not executed as a result of the failure,
and also includes the statement that caused the failure as a comment. The following is an example of an
unprocessed.sql file:
-- The database reload failed with the following error:
-- ***** SQL error: the-SQL-ERROR
-- This script contains the statements that were not executed as a
-- result of the failure. The statement that caused the failure is
-- commented out below. To complete the reload, correct the failing
*/
setuser "DBA"
go
Having this file gives you the opportunity to correct, remove, or alter the failing statement(s). The
unprocessed.sql file is only created after all the table data and referential integrity constraints have been
reloaded. Using Interactive SQL, you can connect to the new database and execute the updated
unprocessed.sql file. This allows you to complete the rebuild of the database without having to start the
rebuild over again, which can save considerable time.
When the unprocessed.sql file is generated, dbunload stops and returns a failed error code to make other
tools or scripts aware of the failed rebuild.
Encrypted databases
When you rebuild a database that has table encryption enabled, you must specify either -er or -et to indicate
whether the new database has table encryption enabled, otherwise you get an error when attempting to load
the data into the new database.
If you want to unload a strongly encrypted database, you must provide the encryption key. You can use the
DatabaseKey (DBKEY) connection parameter to provide the key in the command. Alternatively, if you want
to be prompted for the encryption key rather than entering it in plain view, you can use the -ep server option
as follows:
dbunload -c "DBF=enc.db;START=dbeng11 -ep"
If you are using the -an option to unload a database and reload into a new one, and you want to use the -ek
or -ep options to set the encryption key for the new database, keep the following in mind:
● If the original database is strongly encrypted, you need to specify the key for the original database using
the DatabaseKey (DBKEY) connection parameter in the -c option, rather than using -ek or -ep.
● Using the -ek and -ep options, it is possible to unload an unencrypted database and reload into a new,
strongly encrypted database. When you use -ep and -an, you must confirm the key correctly or the unload
fails.
● If the original database is strongly encrypted, but the -ek and -ep options are not used, then the new
database will be encrypted with simple encryption.
● The -ek and -ep options are ignored if -an is not specified. The dbunload -ek and -ep options apply to a
new database, while the database server (dbeng11/dbsrv11) options and DBKEY= apply to existing
databases.
● When rebuilding databases involved in synchronization or replication, dbunload assumes that the
encryption key specified with the -ek or -ep option is the encryption key of the original database, as well
as the encryption key of the newly-rebuilt database.
For more information about encryption, see “-ep server option” on page 173 and “DatabaseKey connection
parameter [DBKEY]” on page 260.
Rebuilding a database
To unload a database, first ensure that the database is not already running. Then, run dbunload, specifying
a DBA user and password, and referencing the database with the DBF= connection parameter.
To reload a database, create a new database and then run the generated reload.sql command file through
Interactive SQL.
To combine the unload and reload steps, follow the directions for unloading above, but add the -an option
to specify the name of the new database file. See the descriptions of the -ac and -an options.
Updates the system tables and views, adds new database options, and recreates all system stored procedures,
as well as installing jConnect support and changing support for Java in the database.
Syntax
dbupgrad [ options ]
Option Description
@data Read in options from the specified environment variable or configuration file. See “Using
configuration files” on page 669.
If you want to protect passwords or other information in the configuration file, you can
use the File Hiding utility to obfuscate the contents of the configuration file. See “File
Hiding utility (dbfhide)” on page 698.
-i Exclude the jConnect system objects. If you want to use the jConnect JDBC driver to
access system catalog information, you need to install jConnect support. You can still use
JDBC when this option is specified, as long as you do not access system information. If
you want, you can add jConnect support later using Sybase Central or the ALTER DA-
TABASE UPGRADE statement. See “Installing jConnect system objects into a data-
base” [SQL Anywhere Server - Programming] and “ALTER DATABASE state-
ment” [SQL Anywhere Server - SQL Reference].
Remarks
Caution
You should always back up your database files before upgrading. If you apply the upgrade to the existing
files, then these files become unusable if the upgrade fails. For information about backing up your database,
see “Backup and data recovery” on page 847.
The dbupgrad utility upgrades a database created with earlier versions of the software to enable features
from the current version of the software. The earliest version that can be upgraded is SQL Anywhere 10.0.0.
While later versions of the database server can run against databases that were created with earlier releases
of the software, some of the features introduced since the version that created the database are unavailable
unless the database is upgraded.
You can use the Upgrade utility to update the system tables and views, add new database options, restore
database options, and recreate all system stored procedures, as well as install jConnect support and change
support for Java in the database.
As new versions and software updates become available for SQL Anywhere, you can use the Upgrade utility
to take advantage of the new features.
Upgrading a database does not require you to unload and reload your database.
Note
If you want to upgrade a version 9.0.2 or earlier database to version 11, you must rebuild the database by
performing an unload and reload. See “Upgrading SQL Anywhere” [SQL Anywhere 11 - Changes and
Upgrading].
If you want to use replication on an upgraded database, you must also archive your transaction log and start
a new one on the upgraded database.
You can access the Upgrade utility in the following ways:
● From Sybase Central, using the Upgrade Database Wizard.
● From Interactive SQL, using the ALTER DATABASE UPGRADE statement. See “ALTER
DATABASE statement” [SQL Anywhere Server - SQL Reference].
● At a command prompt, using the dbupgrad command.
Exit codes are 0 (success) or non-zero (failure). See “Software component exit codes” [SQL Anywhere Server
- Programming].
Syntax
dbvalid [ options ] [ object-name, ... ]
Option Description
@data Read in options from the specified environment variable or configuration file. See
“Using configuration files” on page 669.
If you want to protect passwords or other information in the configuration file, you can
use the File Hiding utility to obfuscate the contents of the configuration file. See “File
Hiding utility (dbfhide)” on page 698.
-c "key- Specify database connection parameters. For a description of the connection parameters,
word=value; ..." see “Connection parameters” on page 248. The user ID must have DBA authority or
VALIDATE authority.
For example, the following command validates the database, including all tables and
materialized views for c:\salesdata.db, connecting as user DBA with password sql:
dbvalid -c "UID=DBA;PWD=sql;DBF=c:\salesdata.db"
-d Validate that all table pages in the database belong to the correct object, and perform a
checksum validation. The -d option does not include validation of data or indexes. The
-d option cannot be used with the -i, -s, or -t options.
-fx Validate every row of the table, and make sure that the number of rows in the table
matches the number of rows in each index associated with the table. This option does
not perform individual index lookups for each row. Using this option can significantly
improve performance when validating large databases with a small cache.
-q Do not display output messages to the client. You can still log the messages to file using
the -o option, however.
-s Validate the database using checksums. Checksums are used to determine whether a
database page has been modified on disk. Checksum validation reads each page of the
database from disk and calculates its checksum. If the calculated checksum is different
from the checksum stored on the page, the page has been modified on disk and an error
is returned. The page numbers of any invalid pages appear in the database server mes-
sages window. The -s option cannot be used in conjunction with -d, -i, -t, or either of
the -f options.
Option Description
-t Specify a list of object-name values, which represents a list of tables and materialized
views.
Remarks
By default, dbvalid validates all the tables, materialized views, and indexes, in the database, and validates
the database itself.
With the Validation utility, you can validate the indexes and keys on some or all of the tables and materialized
views in a database. You can also use the Validation utility to verify that all table pages in the database
belong to the correct object, and that page checksums are correct. By default, dbvalid validates all the tables
and materialized views in the database (the same behavior as the -t option).
For each table or materialized view, the Validation utility scans the entire object, and then looks up each
record in every index and key defined on the table. You can also use the Validation utility to verify that all
table pages in the database belong to the correct object, and that page checksums are correct. To run the
Validation utility, you must have either DBA or VALIDATE authority.
You can also access the Validation utility in the following ways:
● From Sybase Central, using the Validate Database Wizard. See “Ensuring your database is
valid” on page 862.
● From Interactive SQL, using the VALIDATE statement. See “VALIDATE statement” [SQL Anywhere
Server - SQL Reference].
The Validation utility can be used in combination with regular backups to give you confidence in the integrity
of the data in your database. If you want to validate the backup copy of your database, it is recommended
that you make a copy of the backup and validate the copy. Doing this ensures that you do not make changes
to the file that is used in recovery. See “Backup and data recovery” on page 847.
Caution
Backup copies of the database and transaction log must not be changed in any way. If there were no
transactions in progress during the backup, or if you specified BACKUP DATABASE WITH
CHECKPOINT LOG RECOVER or WITH CHECKPOINT LOG NO COPY, you can check the validity of
the backup database using read-only mode or by validating a copy of the backup database.
However, if transactions were in progress, or if you specified BACKUP DATABASE WITH CHECKPOINT
LOG COPY, the database server must perform recovery on the database when you start it. Recovery modifies
the backup copy, which prevents subsequent transaction log files from the original database from being
applied.
If running the Validation utility autostarts a database, the database starts in read-only mode. This prevents
changes from being made to the database in case the validation is part of a backup or recovery plan.
If the Validation utility connects to a running database that was not started in read-only mode, the utility
displays a warning. This warning is a reminder that the database being validated cannot be used as part of a
recovery plan. Because of the way backups are performed, most databases created by dbbackup are marked
as needing recovery. If the database you are validating requires recovery and you want to force it to start as
read-write, you can either start the database before running dbvalid or specify a valid value for the DBS
connection parameter. See “DatabaseSwitches connection parameter [DBS]” on page 262.
Both of the following commands allow dbvalid to run if the mycopy.db database needs to be recovered:
dbvalid -c "UID=DBA;PWD=sql;DBF=mycopy.db;DBS=-n mycopy"
dbvalid -c "UID=DBA;PWD=sql;DBF=mycopy.db;DBS=-dh"
Caution
Validating a table or an entire database should be performed while no connections are making changes to
the database; otherwise, errors may be reported indicating some form of database corruption even though
no corruption actually exists.
The Validation utility may return warnings about checksum violations for databases that do not have
checksums enabled. This is because the database server automatically still calculates checksums for critical
database pages, regardless of whether checksums are enabled. The database server also creates checksums
automatically for databases running on Windows Mobile and for databases running on storage media that
may be less reliable, such as removable drives. See “Using checksums” on page 863.
Validation requires exclusive access to each table. For this reason, it is best to validate when there is no other
activity on the database.
Exit codes are 0 (success) or non-zero (failure). See “Software component exit codes” [SQL Anywhere Server
- Programming].
For more information about specific checks made during validation, see “VALIDATE statement” [SQL
Anywhere Server - SQL Reference].
Syntax
dbversion executable-name
Remarks
This utility is only available on Unix, and returns information about SQL Anywhere executables.
See also
● “-v server option” on page 221
Example
The following command:
$ dbversion /opt/sqlanywhere11/bin32/dbversion
Field Description
Contents
Introduction to the SQL Anywhere SNMP Extension Agent ...................................... 800
Understanding SNMP ................................................................................................ 801
Using the SQL Anywhere SNMP Extension Agent .................................................... 805
SQL Anywhere MIB reference ................................................................................... 813
RDBMS MIB reference .............................................................................................. 839
Supplied files
The following files for the SQL Anywhere SNMP Extension Agent are included in your SQL Anywhere
installation:
● dbsnmp11.dll The SQL Anywhere SNMP Extension Agent. This file is located in install-dir
\bin32.
● iAnywhere.mib The SQL Anywhere MIB contains all the OIDs for database server and database
properties, statistics, and options that can be accessed using the SQL Anywhere SNMP Extension Agent.
● RDBMS-MIB.mib This is a generic MIB for relational database management systems and contains
OIDs that can be accessed using the SQL Anywhere SNMP Extension Agent.
● SNMPv2-SMI.mib This MIB is referenced by the SQL Anywhere and RDBMS MIBs.
● SNMPv2-TC.mib This MIB is referenced by the SQL Anywhere and RDBMS MIBs.
● SYBASE-MIB.mib The Sybase MIB. This MIB is referenced by the SQL Anywhere MIB.
● sasnmp.ini This file lists the databases that the SQL Anywhere SNMP Extension Agent monitors.
By default, this file is located in install-dir\bin32.
Understanding SNMP
Simple Network Management Protocol (SNMP) is a standard protocol used for network management. SNMP
allows managers and agents to communicate: managers send requests to agents, and agents respond to
queries from managers. Additionally, agents can notify managers when specific events occur using
notifications called traps.
SNMP agents handle requests to get and set the values of variables for managed objects. Each variable has
a single value, and values are generally strings or integers, although they may also be other types.
Variables are kept in a global hierarchy, and each variable has a unique number under its parent. The full
name of a variable (including all its parents) is called the Object Identifier (OID). All OIDs that are owned
by Sybase begin with 1.3.6.1.4.1.897.
The list of OIDs that an agent supports, including their names, types, and other information are stored in a
file called a Management Information Base (MIB).
A MIB is a database that stores network management information about managed objects. The MIB is
separate from the SQL Anywhere database you are monitoring using the SQL Anywhere SNMP Extension
Agent. The values of MIB objects can be changed or retrieved using SNMP. MIB objects are organized in
a hierarchy with the most general information about the network located at the top level of the hierarchy.
The SQL Anywhere SNMP Extension Agent supports the following MIBs:
● SQL Anywhere MIB A MIB created specifically for the SQL Anywhere SNMP Extension Agent.
All the OIDs in the SQL Anywhere MIB begin with 1.3.6.1.4.1.897.2. The SQL Anywhere MIB lists
the OIDs for the statistics, properties, and option values that can be retrieved, and in some cases set,
using the SQL Anywhere SNMP Extension Agent. See “The SQL Anywhere MIB” on page 801.
● RDBMS MIB A generic, vendor-independent MIB for relational databases. This MIB contains
information about the database servers and databases in your system. See “The RDBMS
MIB” on page 804.
1 When stopping a database by setting this variable, the stop is unconditional, meaning that the database will
string (as well as DBN, and DBKEY if it is required), and either the UtilDbPwd field must be set in the
sasnmp.ini file, or the start database permission on the server (specified with the -gd server option) must be
set to all.
saMetaData tables
The SQL Anywhere MIB includes metadata tables that provide a way to query the SQL Anywhere Extension
Agent to find out which variables are supported.
● saSrvMetaData.saSrvStatMetaDataTable Lists the database server statistics (variables under
sa.saServer.saSrvStat).
● saSrvMetaData.saSrvpropMetaDataTable Lists the database server properties (variables under
sa.saServer.saSrv.Prop).
● saDbMetaData.saDbStatMetaDataTable Lists the database statistics (variables under
sa.saDb.saDbStat).
● saDbMetaData.saDbpropMetaDataTable Lists the database properties (variables under
sa.saDb.saDbProp).
For more information about the information stored in the SQL Anywhere MIB metadata tables, see
“saMetaData tables” on page 813.
Installing SNMP
Before you can use the SQL Anywhere Extension Agent, you must install SNMP on your computer. By
default, SNMP is not installed on Windows.
For information about installing SNMP, see your operating system documentation.
Once you install SNMP on your computer, the following services should be running on your computer:
SNMP Service and SNMP Trap Service.
If you installed SNMP before you installed SQL Anywhere, you need to stop and restart the SNMP service
so it can detect the SQL Anywhere SNMP Extension Agent. If you installed SQL Anywhere and then
installed SNMP, the SNMP service detects the SQL Anywhere SNMP Extension Agent automatically.
To restart the SNMP service (Command line)
1. Run the following command:
net stop snmp
[DBn]
ConnStr=connection-string
UtilDbPwd=utility-database-password
CacheTime=time-in-seconds
DBSpaceCacheTime=time-in-seconds
Trapt=trap-information
Disabled=1 or 0
By default, your SQL Anywhere installation places the sasnmp.ini file in the install-dir\bin32 directory.
If you specify any of these values in the connection string in the sasnmp.ini file, the values in the
sasnmp.ini file will override the default settings.
UtilDbPwd When setting sa.agent.saStarted to start a database, the SQL Anywhere SNMP
Extension Agent attempts to connect to the database with the DBF parameter, which tells the database server
where to find the database file. However, if the permission required to start the database is DBA (the default
for the network server, which can also be set using the -gd dba option for both the personal and network
servers), then the server will not allow the connection.
To start a database on such a server, the SQL Anywhere SNMP Extension Agent must connect as a user
with DBA authority to a database already running on the same server. This can be done by connecting to
the utility database. If you specify the utility database password (specified by the -su server option) in the
sasnmp.ini file, then to start a database, the SQL Anywhere Extension Agent connects to the utility database
on the same server, executes the START DATABASE statement, and then disconnects. This field is optional.
CacheTime When data is retrieved from the database, it can be cached inside the SQL Anywhere SNMP
Extension Agent, so that subsequent retrievals of the same type of data (for example, server properties or
database statistics) do not require communication with the database. While caching the data means that you
can obtain the data more quickly on subsequent retrievals, the data may be out of date. The CacheTime field
can be used to change the cache time, or disable the cache by setting the value to 0. By default, the cache
time is 0 seconds. When the CacheTime parameter is set to 0, the data retrieved is always up-to-date because
data is retrieved from the database for every request. This field is optional.
DBSpaceCacheTime The rdbmsDbLimitedResourceTable in the RDBMS MIB contains information
about dbspaces. When this information is retrieved from the database, it can also be cached inside the SQL
Anywhere Extension Agent. The default cache time for dbspace information is 600 seconds (10 minutes).
This field can be used to change the cache time (or disable the cache by setting the value to 0). This field is
optional. See “rdbmsDbLimitedResourceTable” on page 841.
Trapt Creates a dynamic trap. The value t must be a positive integer starting at 1. Skipping numbers is not
allowed. This field is optional. See “Creating dynamic traps” on page 811.
Disabled If set to 1, this database entry is skipped by the SQL Anywhere SNMP Extension Agent. This
is useful for temporarily removing one database from the list of databases managed by the SQL Anywhere
SNMP Extension Agent, without renumbering the rest. This field is optional.
Once you edit this file, you must restart the SNMP service or reset the SQL Anywhere SNMP Extension
Agent so that the new settings are used by the Agent.
To restart the SNMP service (Command line)
1. Run the following command:
net stop snmp
You can obfuscate the contents of the sasnmp.ini file with simple encryption using the File Hiding utility
(dbfhide). See “Hiding the contents of .ini files” on page 698.
ConnStr=UID=DBA;PWD=sql;ENG=server1;DBN=sales;DBF=sales.db
Trap1=1.1.5 > 50000
UtilDbPwd=test
[DB2]
ConnStr=UID=DBA;PWD=sql;ENG=server1;DBN=field;DBF=field.db
UtilDbPwd=test
Disabled=1
[DB3]
ConnStr=UID=DBA;PWD=sql;LINKS=tcpip;ENG=server2;DBN=hq;DBF=hq.db
UtilDbPwd=test
Because there are no parameters specified in the SAAgent section, the SQL Anywhere SNMP Extension
Agent will poll values every 5 seconds.
The SQL Anywhere SNMP Extension Agent is monitoring 3 different databases running on two different
servers. Database 3 is running on a different computer, so the LINKS connection parameter is required to
specify the protocol. A trap is specified for DB1, which fires when the number of bytes sent by the database
server is greater than 50000.
The way you retrieve these values depends on your SNMP management software.
Examples
The table below provides a description and sample value that could be returned for the following OIDs.
When setting database and server properties, the sa_server_option system procedure is used.
The way you set these values depends on your SNMP management software.
For more information about the options and properties that can be set with the SQL Anywhere SNMP
Extension Agent, see “SQL Anywhere MIB reference” on page 813.
See also
● “SET OPTION statement” [SQL Anywhere Server - SQL Reference]
● “Introduction to database options” on page 432
● “sa_server_option system procedure” [SQL Anywhere Server - SQL Reference]
Any result sets or return values generated by the procedure are ignored.
To execute a stored procedure using the SQL Anywhere SNMP Extension Agent, set the value of
saAgent.saProc (OID 1.3.6.1.4.1.897.2.3.5.db, where db is the database number in the sasnmp.ini file)
to a string that is the name of a stored procedure. Optionally, you can supply arguments to the procedure; if
no arguments are supplied, parentheses are appended to the procedure name.
For example, setting the value of saAgent.saProc to the string
"pchin.updatesales( 'param1', 2)" calls the updatesales stored procedure owned by user pchin.
The way you set the value of this OID to the procedure name depends on your SNMP management software.
See “The SQL Anywhere MIB” on page 801.
Using traps
A trap is an OID that is sent by an SNMP agent when a particular event occurs. Traps are initiated by the
SNMP agent and can be detected by SNMP management software, which can then either deal with the event
directly or query the SNMP agent for more information.
In order to receive traps, you must configure the SNMP service. The SNMP service will receive the trap
information and then forward it on somewhere; however, by default, this is nowhere, so any trap listeners
you have running will not detect anything. The following steps show how to configure your SNMP Service
to send traps to your computer.
To configure the SNMP service
1. Right-click My Computer and choose Manage.
The Computer Management window appears.
2. In the left pane, double-click Services And Applications.
3. In the left pane, double-click Services.
4. Locate SNMP Service in the list of services in the right pane, right-click it and choose Properties.
The SNMP Service Properties window appears.
5. Click the Traps tab.
6. On the Traps tab, click Add.
The SNMP Service Configuration window appears.
7. In the SNMP Service Configuration window, type localhost in the text box and then click Add.
8. Click OK to close the Service Properties window.
The SQL Anywhere SNMP Extension Agent sends a trap whenever a connection is dropped by the database
server. The OID of this trap is 1.3.6.1.2.1.39.2.1.
If you are using database mirroring, and the SQL Anywhere SNMP Extension Agent connection to the
database server drops, every 30 seconds the SQL Anywhere SNMP Extension Agent attempts to reconnect
to the database server. When the agent reconnects, if it finds that it is connected to a different database server
(as determined by the ServerName property), then it sends a trap with the OID 1.3.6.1.4.1.897.2.6.3, as well
as the database ID from the sasnmp.ini file. In this case, the SQL Anywhere SNMP Extension Agent was
connected to the primary database server, which went down, and now the mirror server is acting as the
primary server. See “Introduction to database mirroring” on page 914.
The only other traps sent by the SQL Anywhere SNMP Extension Agent are dynamic traps. See “Creating
dynamic traps” on page 811.
Note
You can only use OIDs corresponding to database server or database properties, statistics, or options in
dynamic traps.
dbnum is the database number. This field is optional, but if specified, it must match the database number
of the [DBn] section of the sasnmp.ini file.
op must have one of the following values:
● = or == (equality)
● !=, <>, or >< (inequality)
● <= or =< (less than or equal)
● >= or => (greater than or equal)
● < (less than)
● > (greater than)
Note
Only equality or inequality is supported for string values.
value is the value to use in the expression. String values may be enclosed in single or double quotes; these
quotes are not included in the value. If you want the beginning or closing quotation marks to be included in
the string, you must double them. Note that single quotes occurring within the string should not be doubled.
When setting dynamic traps, use k, m, g, or t to specify units of kilobytes, megabytes, gigabytes, or terabytes.
For example, you can set a dynamic trap to fire if the current cache size exceeds 200 MB by using:
Trap1=1.3.6.1.4.1.897.2.1.1.11.1 > 200M
You can specify as many Trap fields as you want in the sasnmp.ini file. The OID used for the trap is
1.3.6.1.4.1.897.2.4.1, and the data sent with the trap includes the following:
● the trap number (starts at 1 for the first dynamic trap sent by the SQL Anywhere SNMP agent)
● the database index
● the database name trap index (from the sasnmp.ini file)
● the variable name
● the variable value (this is the current value of the variable, not necessarily the threshold value)
Trap examples
Trap information Description
Trap1=1.1.5 > 10000 Trap sent when the number of bytes sent from the
server is greater than 10000.
Trap2=1.3.6.1.2.1.39.1.4.1.4.14.1 >= 10485760 Trap sent if the size of the transaction log file is larger
than 10 MB.
See also
● “Understanding SNMP” on page 801
Agent
The Agent table lists information about the SQL Anywhere SNMP Extension Agent.
Writable properties are marked with an asterisk (*). The value n is the database number in the sasnmp.ini
file.
saMetaData tables
The following metadata tables are included in the SQL Anywhere MIB:
● saSrvMetaData.saSrvStatMetaDataTable
● saSrvMetaData.saSrvPropMetaDataTable
● saSrvMetaData.saDbStatMetaDataTable
● saSrvMetaData.saDbPropMetaDataTable
● saSrvMetaData.saDbOptMetaDataTable
saSrvMetaData.saSrvStatMetaDataTable
This table contains metadata about the database server statistics.
The value db is the database number in the sasnmp.ini file.
saSrvMetaData.saSrvPropMetaDataTable
This table contains metadata about the database server properties.
The value db is the database number in the sasnmp.ini file.
3 The OID returned does not include the database number. You must append the database number to the OID
saDbMetaData.saDbStatMetaDataTable
This table contains metadata about the database statistics.
The value db is the database number in the sasnmp.ini file.
saDbMetaData.saDbPropMetaDataTable
This table contains metadata about the database properties.
The value db is the database number in the sasnmp.ini file.
saDbMetaData.saDbOptMetaDataTable
This table contains metadata about the database options.
The value db is the database number in the sasnmp.ini file.
For more information about the database statistics, see “Server-level properties” on page 561 and “Database-
level properties” on page 574.
rdbmsDbTable
This table lists information about the databases installed on a system.
The value db is the database number in the sasnmp.ini file.
rdbmsDbInfoTable
This table provides additional information about the databases on the system.
The value db is the database number in the sasnmp.ini file.
1 This OID is not supported by the SQL Anywhere SNMP Extension Agent.
rdbmsDbParamTable
This table lists the configuration parameters for the databases on the system.
The value db is the database number in the sasnmp.ini file, while n is the index of the option in the sa.
2.3 subtree.
1 This OID is not supported by the SQL Anywhere SNMP Extension Agent.
rdbmsDbLimitedResourceTable
This table lists free space information on each dbspace. In this table, n represents each dbspace as follows:
● 1-13 are for normal dbspaces (numbered 0-12 in the database)
● 14 is the transaction log file
● 15 is the transaction log mirror file
● 16 is the temporary file
1 This OID is not supported by the SQL Anywhere SNMP Extension Agent.
rdbmsSrvTable
This table lists the database servers running or installed on your system.
The value db is the database number in the sasnmp.ini file.
rdbmsSrvInfoTable
This table lists additional information about the database servers in your system.
The value db is the database number in the sasnmp.ini file.
1 This OID is not supported by the SQL Anywhere SNMP Extension Agent.
rdbmsSrvParamTable
This table lists the server options that can be set by the SQL Anywhere SNMP Extension Agent through the
SQL Anywhere MIB. n is the index, as follows:
n Server option
1 ConnsDisabled
2 LivenessTimeout (default)
3 QuittingTime
4 RememberLastStatement
5 RequestLogFile
6 RequestLogging
rdbmsSrvLimitedResourceTable
This table contains information about server configuration parameters.
The value db is the database number in the sasnmp.ini file, while n is the index of the resource as follows:
1 This OID is not supported by the SQL Anywhere SNMP Extension Agent.
Contents
Introduction to backup and recovery ......................................................................... 848
Understanding backups ............................................................................................. 852
Designing backup procedures ................................................................................... 855
Configuring your database for data protection .......................................................... 865
Backup and recovery internals .................................................................................. 868
Backup and recovery tasks ....................................................................................... 875
Creating a maintenance plan ..................................................................................... 895
What are media and system failure? “Protecting your data against fail-
ure” on page 850
From what kinds of failure do backups protect my “Protecting your data against fail-
data? ure” on page 850
What tools are available for backups? “Ways of making backups” on page 850
What type of backup should I use? “Designing backup procedures” on page 855
If my database file or transaction log becomes cor- “Protecting your data against media fail-
rupt, what data may be lost? ure” on page 853
My database is involved in replication. How does this “A backup scheme for databases involved in rep-
affect my backup strategy? lication” on page 859
“Backup methods for remote databases in repli-
cation installations” on page 861
How can I be sure that my database file is not corrupt? “Ensuring your database is valid” on page 862
“Validating a database” on page 876
How can I be sure that my transaction log is not cor- “Validating the transaction log on database start-
rupt? up” on page 874
“Validating a transaction log” on page 878
How can I run my database for maximum protection “Configuring your database for data protec-
against failures? tion” on page 865
How can I ensure high availability and machine re- “Protecting against total computer fail-
dundancy? ure” on page 866
“Making a live backup” on page 884
How do I restore data from backups when a failure “Recovering from media failure on the database
occurs? file” on page 885
“Recovering from media failure on an unmirrored
transaction log” on page 886
“Recovering from media failure on a mirrored
transaction log” on page 887
How do I create a maintenance plan for a database? “Creating a maintenance plan” on page 895
After a system failure occurs, the database server recovers automatically when you next start the database.
The results of each transaction committed before the system error are intact. All changes by transactions that
were not committed before the system failure are canceled.
See “Backup and recovery internals” on page 868.
It is possible to recover uncommitted changes manually. See “Recovering uncommitted
operations” on page 889.
● Backup utility The dbbackup utility makes client-side backups. For example, executing the following
command makes backup copies of the database and transaction log in the directory c:\backup on the
client computer:
dbbackup -c "connection-string" c:\backup
You can make a backup copy of the database and transaction log in the directory c:\backup on the server
computer by specifying the -s option:
dbbackup -c "connection-string" -s c:\backup
Notes
You must have BACKUP authority or REMOTE DBA authority to make online backups of a database.
Understanding backups
To understand what files you need to back up, and how you restore databases from backups, you need to
understand how the changes made to the database are stored on disk.
Between checkpoints, you need both the database file and another file, called the transaction log, to ensure
that you have a complete copy of all committed transactions.
See also
● “Checkpoints and the checkpoint log” on page 869
● “How the database server decides when to checkpoint” on page 872
lost. However, if the database and transaction log are stored on different disks, then most, if not all, of the
data can be recovered because you will still have either the full database or the transaction log (from which
the database can be recovered) in the event of a disk failure.
See “Protecting against media failure on the database file” on page 865.
Caution
The database file and the transaction log file must be located on the same physical computer as the database
server or accessed via a SAN or iSCSI configuration. Database files and transaction log files located on a
remote network directory can lead to poor performance, data corruption, and server instability.
For more information, see http://www.sybase.com/detail?id=1034790.
In this way, completed transactions are guaranteed to be stored on disk, while performance is improved by
avoiding a write to the disk on every operation.
Configuration options are available to allow advanced users to tune the precise behavior of the transaction
log. See “cooperative_commits option [database]” on page 464 and “delayed_commits option
[database]” on page 471.
in place. All information since the last backed up copy of the database file is held in backed up transaction
logs, or in the online transaction log.
Media failure on the transaction log file Unless you use a mirrored transaction log, you cannot recover
information entered between the last database checkpoint and a media failure on the transaction log. For this
reason, it is recommended that you use a mirrored transaction log in setups such as SQL Remote consolidated
databases, where loss of the transaction log can lead to loss of key information, or the breakdown of a
replication system.
See also
● “Protecting your data against failure” on page 850
● “Protecting against media failure on the database file” on page 865
● “Protecting against media failure on the transaction log” on page 865
Types of backup
This section assumes that you are familiar with basic concepts related to backups.
Backups can be categorized in several ways:
● Full backup and incremental backup A full backup is a backup of both the database file and of
the transaction log. See “Making a full backup” on page 875.
An incremental backup is a backup of the transaction log only. Typically, full backups are interspersed
with several incremental backups. See “Making an incremental backup” on page 876.
● Server-side backup and client-side backup To execute a server side backup, you execute the
BACKUP statement or use the dbbackup -s option; the database server then performs the backup. You
can easily build server side backup into applications because it is a SQL statement. Also, server-side
backup is generally faster because the data does not have to be transported across the client/server
communications system. See “BACKUP statement” [SQL Anywhere Server - SQL Reference].
You can execute an online backup from a client computer using the Backup utility.
See also
○ “Backup utility (dbbackup)” on page 672
○ “Making image backups” on page 856
○ “DBBackup function” [SQL Anywhere Server - Programming]
● Archive backup and image backup An archive backup copies the database file and the transaction
log into a single archive file, typically on a tape drive. An image backup makes a copy of the database
files and/or the transaction log, each as separate files. You can only perform archive backups as server-
side backups, and you can only make full backups.
You should use an archive backup if you are backing up directly to tape. Otherwise, an image backup
has more flexibility for transaction log file management. See “Backing up a database directly to
tape” on page 883.
● Online backup and offline backup Backing up a running database provides a snapshot of a
consistent database, even though other users are modifying the database. An offline backup consists
simply of copying the files. You should only perform an offline backup when the database is not running,
and when the database server was shut down properly.
The information in this chapter focuses on online backups.
● Live backup A live backup is a continuous backup of the database that helps protect against total
computer failure.
You can use a live backup to provide a redundant copy of the transaction log. This copy can be used to
restart a secondary system in case the primary system running the database server becomes unusable. A
live backup runs continuously, ending only if the server shuts down. If you suffer a system failure, the
backed up transaction log can be used for a rapid restart of the system. However, depending on the load
that the server is processing, the live backup may lag behind and may not contain all committed
transactions. For more information, see “Protecting against total computer failure” on page 866 and
“Making a live backup” on page 884.
Scheduling backups
Most backup schedules involve periodic full backups interspersed with incremental backups of the
transaction log. There is no simple rule for deciding how often to make backups of your data. The frequency
with which you make backups depends on the importance of your data, how often it is updated or changes,
and other factors.
Most backup strategies involve occasional full backups, interspersed by several incremental backups. A
common starting point for backups is to perform a weekly full backup, with daily incremental backups of
the transaction log. Both full and incremental backups can be performed online (while the database is
running) or offline, on the server side or the client side. Archive backups are always full backups.
The kinds of failure against which a backup schedule protects you depends not only on how often you make
backups, but also on how you operate your database server. See “Configuring your database for data
protection” on page 865.
You should always keep more than one full backup. If you make a backup on top of a previous backup, a
media failure in the middle of the backup leaves you with no backup at all. You should also keep some of
your full backups offsite to protect against fire, flood, earthquake, theft, or vandalism.
You can use the event scheduling features of SQL Anywhere to perform online backups automatically at
scheduled times. See “Automating tasks using schedules and events” on page 897.
To make backups to tape using an image backup, you have to take each backup copy and put it on tape using
a disk backup utility.
To restore from an image backup, copy the saved files back to their original locations and reapply the
transaction logs. See “Recovering from multiple transaction logs” on page 890.
See also
● “BACKUP statement” [SQL Anywhere Server - SQL Reference]
● “Backup utility (dbbackup)” on page 672
● “RESTORE DATABASE statement” [SQL Anywhere Server - SQL Reference]
● “Making archive backups” on page 861
Backups should always be made to a separate physical drive. This not only provides a performance benefit
from the I/O parallelism, but also improves the safety of the data in the event of a hardware failure.
See also
● “BACKUP statement” [SQL Anywhere Server - SQL Reference]
● “Backup utility (dbbackup)” on page 672
For more information about full backups, see “Making a backup, continuing to use the original transaction
log” on page 878.
Deleting the transaction log after each incremental backup makes recovery from a media failure on the
database file a more complex task as there may then be several different transaction logs since the last full
backup. Each transaction log needs to be applied in sequence to bring the database up to date.
You can use this kind of backup at a database that is operating as a MobiLink consolidated database because
MobiLink does not rely on the transaction log. If you are running SQL Remote or the MobiLink
dbmlsync.exe application, you must use a scheme suitable for preserving old transaction logs.
See:
● “A backup scheme for databases involved in replication” on page 859
● “Making a backup, deleting the original transaction log” on page 879
In these cases, you can choose backup options to rename and restart the transaction log. This kind of backup
prevents open-ended growth of the transaction log, while maintaining information about the old transactions
for the Message Agent and the Replication Agent.
This kind of backup is illustrated in the figure below.
For more information about how to perform a backup of this kind, see “Making a backup, renaming the
original transaction log” on page 881.
You can perform direct backup to a tape drive using an archive backup. Archive backups are always full
backups. An archive backup makes copies of both the database file and the transaction log, but these copies
are placed into a single file.
See also
● “BACKUP statement” [SQL Anywhere Server - SQL Reference]
● “RESTORE DATABASE statement” [SQL Anywhere Server - SQL Reference]
● “Restoring an archive backup” on page 888
● “Making image backups” on page 856
Validation requires exclusive access to the object being validated. For this reason, it is best to validate when
there is no other activity on the database. Database validation does not validate data, continued row structure,
or foreign key relationships if you perform an express validation using the -fx option.
If you can be sure that no transactions are in progress when the backup is being made, the database server
does not need to perform the recovery steps. In this case, you can perform a validity check on the backup
using the read-only database option. See “-r server option” on page 205.
Tip
Using the BACKUP statement with the WAIT BEFORE START clause ensures that no transactions are in
progress when you start a backup.
If a base table in the database file is corrupt, you should treat the situation as a media failure, and recover
from your previous backup. If an index is corrupt, you may want to unload the database without indexes,
and reload.
Caution
Backup copies of the database and transaction log must not be changed in any way. If there were no
transactions in progress during the backup, or if you specified BACKUP DATABASE WITH
CHECKPOINT LOG RECOVER or WITH CHECKPOINT LOG NO COPY, you can check the validity of
the backup database using read-only mode or by validating a copy of the backup database.
However, if transactions were in progress, or if you specified BACKUP DATABASE WITH CHECKPOINT
LOG COPY, the database server must perform recovery on the database when you start it. Recovery modifies
the backup copy, which is not desirable.
See also
● “Validating a database” on page 876
● “Validating a transaction log” on page 878
● “Validating a single table” on page 877
● “VALIDATE statement” [SQL Anywhere Server - SQL Reference]
● “Improving performance when validating databases” on page 874
Using checksums
Checksums are used to determine whether a database page has been modified on disk. When you create a
database with checksums enabled, a checksum is calculated for each page just before it is written to disk.
The next time the page is read from disk, the page's checksum is recalculated and compared to the checksum
stored on the page. If the checksums are different, then the page has been modified on disk and an error
occurs.
You can check whether a database was created with checksums enabled by executing the following
statement:
SELECT DB_PROPERTY ( 'Checksum' );
This query returns ON if checksums are turned on; otherwise, it returns OFF.
Validating checksums
If you created your database with checksums enabled, you can check the validity of the disk pages. Checksum
validation requires either DBA or VALIDATE authority.
For databases with checksums enabled, a checksum is calculated for each database page and this value is
stored when the page is written to disk. You can use the Validation utility (dbvalid) or the Validate Database
Wizard in Sybase Central to perform checksum validation, which consists of reading the database pages
from disk and calculating the checksum for the page. If the calculated checksum does not match the stored
checksum for a page, the page has been modified or corrupted while on disk or while writing to the page. If
one or more pages has been corrupted, an error is returned and information about the invalid pages appears
in the database server messages window.
For more information about checksum validation, see “VALIDATE statement” [SQL Anywhere Server -
SQL Reference] and “Validation utility (dbvalid)” on page 793.
See also
● “Creating a database” on page 14
● “Changing the location of a transaction log” on page 892
See also
● “Making a live backup” on page 884
● “Recovering from a live backup” on page 888
Backup internals
When you issue a backup instruction, the database may be in use by many people. If you later need to use
your backup to restore your database, you need to know what information has been backed up, and what has
not.
The database server performs a backup as follows:
1. Issue a checkpoint. Further checkpoints are disallowed until the backup is complete.
2. Make a backup of the database files, if the backup instruction is for a full backup.
3. Make a backup of the transaction log.
The backup includes all operations recorded in the transaction log before the final page of the log is read.
This may include instructions issued after the backup instruction was issued.
The backup copy of the transaction log is generally smaller than the online transaction log. The database
server allocates space to the online transaction logs in multiples of 64 KB, so the transaction log file size
generally includes empty pages. However, only the non-empty pages are backed up.
4. If the backup instruction requires the transaction log to be truncated or renamed, uncommitted
transactions are carried forward to the new transaction log.
For more information about renaming and truncating the transaction log, see “Designing backup
procedures” on page 855.
5. Mark the backup image of the database to indicate that recovery is needed. This causes any operations
that happened since the start of the backup to be applied. It also causes operations that were incomplete
at the checkpoint to be undone if they were not committed.
During recovery, including restoring backups, no action is permitted by other users of the database.
Changes made to the page are applied to the copy in the cache. For performance reasons they are not written
immediately to the database file on disk.
When the cache is full, the changed page may get written out to disk. The copy in the checkpoint log remains
unchanged.
A checkpoint is a point at which all dirty pages are written to disk and therefore represents a known consistent
state of the database on disk. Following a checkpoint, the contents of the checkpoint log are deleted. The
empty checkpoint log pages remain in the checkpoint log within a given session and can be reused for new
checkpoint log data. As the checkpoint log increases in size, so does the database file.
At a checkpoint, all the data in the database is held on disk in the database file. The information in the
database file matches that in the transaction log. During recovery, the database is first recovered to the most
recent checkpoint, and then changes since that checkpoint are applied.
The entire checkpoint log, including all empty checkpoint log pages, is deleted at the end of each session.
Deleting the checkpoint log causes the database to shrink in size.
The database server can initiate a checkpoint and perform other operations while it takes place. However,
if a checkpoint is already in progress, then any operation like an ALTER TABLE or CREATE INDEX that
initiates a new checkpoint must wait for the current checkpoint to finish.
For more information about when checkpoints occur, see “How the database server decides when to
checkpoint” on page 872.
The checkpoint and recovery urgencies are important only if the server does not have enough idle time to
write dirty pages. The interval between checkpoints is lower bounded based on a combination of the
recovery_time and checkpoint_time options. The recovery_time option setting is not respected in cases
where it would force a checkpoint too soon.
Frequent checkpoints make recovery quicker, but also create work for the server writing out dirty pages.
There are two database options that allow you to control the frequency of checkpoints. checkpoint_time
controls the maximum time between checkpoints and recovery_time controls the maximum time for recovery
in the event of system failure.
If, because of other activity in the database, the number of dirty pages falls to zero, and if the urgency is
50% or more, then a checkpoint takes place automatically since it is a convenient time.
Both the checkpoint urgency and recovery urgency values increase in value until the checkpoint occurs, at
which point they drop to zero. They do not decrease otherwise.
See also
● “-gc server option” on page 179
● “-gr server option” on page 184
In rare circumstances, SQL Anywhere might be unable to suspend transactions or complete a checkpoint
within the maximum time allowed by VSS. If this occurs, you must use the transaction log file and the full
recovery process to recover the backed up database.
See also
● “Introduction to backup and recovery” on page 848
● “Understanding backups” on page 852
● “Service utility (dbsvc) for Windows” on page 748
See also
● “Making a full backup” on page 875
● “Making an incremental backup” on page 876
Notes
Validity checking requires exclusive access to entire tables on your database.
For more information and alternative approaches, see “Ensuring your database is valid” on page 862.
If you validate your backup copy of the database, make sure that you do so in read-only mode. Start the
database server with the -r option to use read-only mode.
For more information about how to perform the backup operation, see:
● “Making a backup, continuing to use the original transaction log” on page 878
● “Making a backup, deleting the original transaction log” on page 879
● “Making a backup, renaming the original transaction log” on page 881
Notes
The backup copies of the database file and transaction log file have the same names as the online versions
of these files. For example, if you make a backup of the sample database, the backup copies are called
demo.db and demo.log. When you repeat the backup statement, choose a new backup directory to avoid
overwriting the backup copies.
For more information about how to make a repeatable incremental backup command by renaming the backup
copy of the transaction log, see “Renaming the backup copy of the transaction log during
backup” on page 883.
Validating a database
Validating a database is a key part of the backup operation. You must have either DBA or VALIDATE
authority to validate a database.
Validation requires exclusive access to each table in turn. For this reason, it is best to validate when there is
no other activity on the database.
Caution
Validating a table or an entire database should be performed while no connections are making changes to
the database; otherwise, spurious errors may be reported indicating some form of database corruption even
though no corruption actually exists.
Tip
You can also access the Validate Database Wizard from within Sybase Central using any of the following
methods:
● Right-clicking the database, and choosing Validate Database.
● Selecting the database, and choosing Tools » SQL Anywhere 11 » Validate Database.
The procedure returns a single column, named Messages. If all tables are valid, the column contains No
errors detected.
For more information, see “sa_validate system procedure” [SQL Anywhere Server - SQL Reference].
Notes
If you are checking the validity of a backup copy, you should run the database in read-only mode so that it
is not modified in any way. You can only do this when there were no transactions in progress during the
backup. See “-r server option” on page 205.
See also
● “Ensuring your database is valid” on page 862
● “Making a full backup” on page 875
Notes
If errors are reported, you can drop all of the indexes and keys on a table and recreate them. Any foreign
keys to the table also need to be recreated. If you suspect a particular index, you can execute an ALTER
INDEX ... REBUILD statement to rebuild the corrupted index. Another solution to errors reported by
VALIDATE TABLE is to unload and reload your entire database. You should use the dbunload -u option
so that it does not try to use a possibly corrupt index to order the data.
For more information about using the REBUILD clause of the ALTER INDEX statement, see “ALTER
INDEX statement” [SQL Anywhere Server - SQL Reference].
6. Select an option in the Which Files Do You Want To Back Up list and click Next.
7. In the What Do You Want To Do With The Transaction Log list, click Continue To Use The Same
Transaction Log.
8. Click Next.
9. Click Finish.
10. Click Close.
Tip
You can also access the Create Backup Images Database Wizard from within Sybase Central by using
any of the following methods:
● Selecting a database, and choosing File » Create Backup Images.
● Right-clicking a database, and choosing Create Backup Images.
The procedure describes a client-side backup. There are more options available for this kind of backup.
If you choose a server-side backup, and the server is running on a different computer from Sybase Central,
you cannot use the Browse button to locate a directory in which to place the backups. The Browse button
browses the client computer, while the backup directory is relative to the server.
To make a backup, continuing to use the original transaction log (SQL)
● If you are using the BACKUP statement, use the following clauses only:
BACKUP DATABASE
DIRECTORY directory-name
[ TRANSACTION LOG ONLY ];
Include the TRANSACTION LOG ONLY clause if you are making an incremental backup.
To make a backup, continuing to use the original transaction log (Command line)
● If you are using the dbbackup utility, use the following syntax:
dbbackup -c "connection-string" [ -t ] backup-directory
See also
● “Backup utility (dbbackup)” on page 672
● “BACKUP statement” [SQL Anywhere Server - SQL Reference]
For more information about when to use this type of backup, see “A backup scheme for databases not involved
in replication” on page 858.
To make a backup, deleting the transaction log (Sybase Central)
1. Connect to the database as a user with DBA authority.
2. Right-click the database and choose Create Backup Images.
3. Click Next.
4. In the Which Database Do You Want To Back Up list, select the database and click Next.
5. In the Save The Backup Images In The Following Directory field, type the name of a directory to
save the backup copies.
6. Select an option in the Which Files Do You Want To Back Up list and click Next.
7. In the What Do You Want To Do With The Transaction Log list, click Truncate The Transaction
Log.
8. Click Next.
9. Click Finish.
10. Click Close.
Include the TRANSACTION LOG ONLY clause only if you are making an incremental backup.
The backup copies of the transaction log and database file are placed in backup-directory. If you enter
a path, it is relative to the working directory of the database server, not your client application.
Notes
Before the online transaction log can be erased, all outstanding transactions must complete. If there are
outstanding transactions, your backup cannot complete. See “Backup internals” on page 868.
You can determine which connection has an outstanding transaction using the sa_conn_info system
procedure. If necessary, you can disconnect the user with a DROP CONNECTION statement. See
“Determining which connection has an outstanding transaction” on page 882.
See also
● “Backup utility (dbbackup)” on page 672
● “BACKUP statement” [SQL Anywhere Server - SQL Reference]
Include the TRANSACTION LOG ONLY clause only if you are making an incremental backup.
The backup copies of the transaction log and database file are placed in backup-directory. If you enter
a path, it is relative to the working directory of the database server, not your client application.
Notes
Before the online transaction log can be renamed, all outstanding transactions must complete. If there are
outstanding transactions, your backup will not complete. See “Backup internals” on page 868.
You can determine which connection has an outstanding transaction using the sa_conn_info system
procedure. If necessary, you can disconnect the user with a DROP CONNECTION statement. See
“Determining which connection has an outstanding transaction” on page 882.
See also
● “Backup utility (dbbackup)” on page 672
● “BACKUP statement” [SQL Anywhere Server - SQL Reference]
2. Double-click each connection, and inspect the Uncommitted Ops entry to see which users have
uncommitted operations. If necessary, you can disconnect the user to enable the backup to finish.
Notes
The backup copy of the transaction log is named YYMMDDxx.log, where YY is the year, MM is the month,
DD is the day of the month, and xx runs from AA to ZZ, incrementing if there is more than one backup per
day. The YYMMDDxx.log file names are used for distinguishability only, not for ordering.
If you set the ATTENDED option to OFF, the backup fails if it runs out of tape or disk space. If
ATTENDED is set to ON, you are prompted to take an action, such as replacing the tape, when there is
no more space on the backup archive device.
Notes
The BACKUP statement makes an entry in the text file backup.syb, in the same directory as the server
executable.
For information about restoring from an archive backup, see “Restoring an archive
backup” on page 888.
Example
The following statement makes a backup to the first tape drive on a Windows computer:
BACKUP DATABASE
TO '\\\\.\\tape0'
ATTENDED OFF
WITH COMMENT 'May 6 backup';
The first tape drive on Windows is \\.\tape0. Because the backslash is an escape character in SQL
strings, each backslash is preceded by another.
The following statement makes an archive file on disk named c:\backup\archive.1.
BACKUP DATABASE
TO 'c:\\backup\\archive';
runs continuously, ending only if the server shuts down. If you suffer a system failure, the backed up
transaction log can be used for a rapid restart of the system. However, depending on the load that the server
is processing, the live backup may lag behind and may not contain all committed transactions.
You should normally run the dbbackup utility from the secondary computer.
If the primary computer becomes unusable, you can restart your database using the secondary computer.
The database file and the transaction log hold the information needed to restart.
For more information about live backups, see “Protecting against total computer failure” on page 866.
You carry out a live backup of the transaction log by using the dbbackup utility with the -l option.
To make a live backup
1. Set up a secondary computer from which you can run the database if the online computer fails. For
example, ensure that you have SQL Anywhere installed on the secondary computer.
2. Periodically, perform a full backup to the secondary computer.
For example:
2. Create a recovery directory to hold the files you use during recovery.
3. Copy the database file from the last full backup to the recovery directory.
4. Apply the transactions held in the backed up transaction logs to the recovery database. You can use either
of the following methods to do this.
If you want to apply each transaction log manually, for each log file, in chronological order do the
following:
a. Copy the log file into the recovery directory.
b. Start the database server with the apply transaction log (-a) option, to apply the transaction log:
dbeng11 database-name.db -a log-name.log
The database server shuts down automatically once the transactions are applied.
c. Once you have applied all of the backed up transaction logs, copy the online transaction log into the
recovery directory.
Apply the transactions from the online transaction log to the recovery database.
dbeng11 database-name.db -a log-name.log
If you want the database server to determine the correct order of the transaction logs and apply them
automatically, do the following:
a. Copy the offline and online transaction log files into the recovery directory.
b. Start the database server with the -ad option, to specify the location of the transaction logs. The
database server determines the correct order in which to apply the transaction logs based on the log
offsets:
dbeng11 database-name.db -ad log-directory
The database server shuts down automatically once the transactions are applied.
5. Perform validity checks on the recovery database.
See “Validating a database” on page 876.
6. Make a post-recovery backup.
7. Move the database file to the production directory.
8. Allow users to access the production database.
Caution
This command should only be used when the database is not participating in a SQL Remote or Replication
Server replication system. If your database is a consolidated database in a SQL Remote replication
system, you may have to re-extract the remote databases.
Without the -f option, the server reports the lack of a transaction log as an error. With the option, the
server restores the database to the most recent checkpoint and then rolls back any transactions that were
not committed at the time of the checkpoint. A new transaction log is then created.
For information about samples-dir, see “Samples directory” on page 336.
The Log Translation utility properly translates the intact file, and reports an error while translating the
corrupt file.
3. Copy the correct file over the corrupt file so that you have two identical files again.
4. Restart the server.
See also
● “Protecting against total computer failure” on page 866
3. Click the Database tab and enter a database name of utility_db. Leave all other fields on this tab blank.
4. Click OK to connect.
5. Execute the RESTORE statement, specifying the archive root. At this time, you can choose to restore
an archived database to its original location (default), or to a different computer with different device
names using the RENAME clause. See “RESTORE DATABASE statement” [SQL Anywhere Server -
SQL Reference].
Example
The following statement restores a database from a tape archive to the database file c:\newdb\newdb.db.
RESTORE DATABASE 'c:\\newdb\\newdb.db'
FROM '\\\\.\\tape0';
The following statement restores a database from an archive backup in file c:\backup\archive.1 to the
database file c:\newdb\newdb.db. The transaction log name and location are specified in the database.
RESTORE DATABASE 'c:\\newdb\\newdb.db'
FROM 'c:\\backup\\archive';
For more information, see “RESTORE DATABASE statement” [SQL Anywhere Server - SQL Reference].
Note
The transaction log may or may not contain changes right up to the point where a failure occurred. It does
contain any changes made before the end of the most recently committed transaction that made changes to
the database.
Recovering from multiple transaction logs using the -ad server option
The -ad server option is used to recover a database by applying all the transaction logs from a specified
directory to the backup copy of a database. When this option is specified, the database server applies the log
and then shuts down the database.
To recover from multiple transaction logs using the -ad server option
● Start the database server using -ad to apply the transaction logs to the backup copy of your database. See
“-ad database option” on page 235.
Example
The following example applies the offline (backup) and current transaction logs to the backup copy of the
sample database using the -ad database server option. The database server uses the log offsets in the
transaction logs to determine the correct order in which to apply the log files.
1. Copy the backup transaction log and current transaction log into a directory, for example, c:
\backuplogs.
2. Start the database server and apply the transaction logs to a backup copy of a database called
backupdemo.db:
dbeng11 backupdemo.db -ad c:\backuplogs
The database server applies the transaction logs to the backup copy of the database and then shuts down.
Example
The following example applies the offline (backup) and current transaction logs to the backup copy of the
sample database using the -a database server option.
1. Start the database server and apply a backup transaction log called backupdemo.log to the backup copy
of a database called backupdemo.db:
dbeng11 backupdemo.db -a backupdemo.log
The database server applies the backup transaction log to the backup copy of the database and then shuts
down.
2. Start the database server and apply the current transaction log called demo.log to the backup copy of the
database:
dbeng11 backupdemo.db -a demo.log
The database server applies the current transaction log to the backup copy of the database and then shuts
down.
You need to use -m because if you translate each log individually using dbtran, any transactions that span
transaction log files could be rolled back. This is because when dbtran translates a log, it adds a ROLLBACK
statement to the end of the log to undo any uncommitted transactions. In cases where a transaction spans
two logs, the COMMIT for the transaction occurs in the second log file. Operations at the end of the first
log file would be rolled back by dbtran because the file does not contain a COMMIT for the transaction.
Translating all the transaction log files in a directory using -m ensures that all your transactions are translated.
See “Transaction Log utility (dblog)” on page 773.
To recover from multiple transaction logs using the dbtran utility
1. Run the Log Translation utility (dbtran) against the directory containing the transaction log files and
output the resulting SQL statements into a .sql file.
2. Start the backup copy of your database.
3. Apply the .sql file generated by dbtran in step 1 to the backup copy of your database from Interactive
SQL.
Example
The following example uses the dbtran utility to apply the backup and current transaction logs to the backup
copy of the database.
1. Run the Log Translation utility against the c:|backup directory and output the SQL statements into a file
called recoverylog.sql:
dbtran -m "c:\backup" -n recoverylog.sql
2. Start the backup copy of the database called backupdemo.db:
dbeng11 backupdemo.db
3. Apply the recoverylog.sql file to the database from Interactive SQL:
dbisql "UID=DBA;PWD=sql;END=backupdemo" READ recoverylog.sql
To change the location of a transaction log mirror for an existing database (Command line)
1. Ensure that the database is not running.
2. Run the following command:
dblog -t new-transaction-log-file database-file
dbinit -t d:\log-dir\company.log -m
e:\mirr-dir\company.mlg c:\db-dir\company.db
You can also use the dblog utility and Sybase Central to stop a database from using a transaction log mirror.
You create a maintenance plan from Sybase Central using the Create Maintenance Plan Wizard. Each
time the maintenance plan runs, a maintenance report is saved in the database. You can view this report from
Sybase Central, or you can have the maintenance log emailed to you after each time the maintenance plan
executes on the database.
To create a maintenance plan
1. Connect to the database as a user with DBA authority.
2. In the left pane, right-click Maintenance Plans and choose New » Maintenance Plan.
3. Follow the instructions in the Create Maintenance Plan Wizard.
For more information about the available settings, see:
● “Defining schedules” on page 900
● “VALIDATE statement” [SQL Anywhere Server - SQL Reference]
● “Types of backup” on page 855
● “xp_startsmtp system procedure” [SQL Anywhere Server - SQL Reference]
Contents
Introduction to using schedules and events .............................................................. 898
Understanding events ................................................................................................ 899
Understanding schedules .......................................................................................... 900
Understanding system events ................................................................................... 902
Understanding event handlers ................................................................................... 906
Schedule and event internals .................................................................................... 908
Event handling tasks ................................................................................................. 910
How does the database server use schedules to trigger “How the database server checks for scheduled
event handlers? events” on page 908
What kind of system events can the database server “Understanding system events” on page 902
use to trigger event handlers?
“CREATE EVENT statement” [SQL Anywhere
Server - SQL Reference]
What connection do event handlers get executed on? “How event handlers are execu-
ted” on page 909
How do event handlers get information about what “Developing event handlers” on page 906
triggered them?
“EVENT_PARAMETER function [Sys-
tem]” [SQL Anywhere Server - SQL Reference]
Understanding events
You can automate routine tasks in SQL Anywhere by adding an event to a database, and providing a schedule
for the event. SQL Anywhere supports three types of events:
● Scheduled events have an associated schedule and execute at specified times. See “Understanding
schedules” on page 900.
● System events are associated with a particular type of condition that is tracked by the database server.
See “Understanding system events” on page 902.
● Manual events are fired explicitly using the TRIGGER EVENT statement. See “Triggering an event
handler” on page 911.
After each execution of an event handler, a COMMIT occurs if no errors occurred. A ROLLBACK occurs
if there was an error.
Understanding schedules
By scheduling activities you can ensure that a set of actions is executed at a set of preset times. The scheduling
information and the event handler are both stored in the database itself.
Although this is not usually necessary, you can define complex schedules by associating more than one
schedule with a named event. For example, a retail outlet might want an event to occur once per hour during
hours of operation, where the hours of operation vary based on the day of the week. You can achieve the
same effect by defining multiple events, each with its own schedule, and by calling a common stored
procedure.
When scheduling events, you can use either full-length English day names (Monday, Tuesday, and so on)
or the abbreviated forms of the day (Mon, Tue, and so on). Note that you must use the full-length English
day names if you want the day names to be recognized by a server running in a language other than English.
The following examples give some ideas for scheduled actions that may be useful.
Examples
Perform an incremental backup daily at 1:00 A.M.:
CREATE EVENT IncrementalBackup
SCHEDULE
START TIME '1:00 AM' EVERY 24 HOURS
HANDLER
BEGIN
BACKUP DATABASE DIRECTORY 'c:\\backup'
TRANSACTION LOG ONLY
TRANSACTION LOG RENAME MATCH
END;
See also
● “CREATE EVENT statement” [SQL Anywhere Server - SQL Reference]
Defining schedules
To permit flexibility, schedule definitions have several components to them:
● Name Each schedule definition has a name. You can assign more than one schedule to a particular
event, which can be useful in designing complex schedules.
● Start time You can define a start time for the event, which is the time when execution begins.
● Range As an alternative to a start time, you can specify a range of times for which the event is active.
The event occurs between the start and end time specified. Frequency is determined by the specified
recurrence.
● Recurrence Each schedule can recur. The event is triggered on a frequency that can be given in hours,
minutes, or seconds on a set of days that can be specified as days of the week or days of the month.
Recurring events include an EVERY or ON clause.
You can define the schedule for an event in the CREATE EVENT statement, or using the Create Schedule
Wizard.
For information about adding a schedule when creating an event, see “CREATE EVENT statement” [SQL
Anywhere Server - SQL Reference].
To create a schedule for an event (Sybase Central)
1. Connect to your database as a user with DBA authority.
2. Double-click Events.
3. Double-click the event for which you want to create a schedule.
4. Click the Schedules tab.
5. From the File menu, choose New » Schedule.
6. Follow the instructions in the Create Schedule Wizard.
● GlobalAutoIncrement When the number of remaining values for a column defined with GLOBAL
AUTOINCREMENT is less than one percent of its range, the GlobalAutoIncrement event fires. This
can be used to request a new value for the global_database_id option based on the table and number of
remaining values that are supplied as parameters to this event. To get the remaining values for the table
within the event, use the EVENT_PARAMETER function with the RemainingValues and TableName
parameters. RemainingValues returns the number of remaining values that can be generated for the
column, while TableName returns the table containing the GLOBAL AUTOINCREMENT column that
is near the end of its range. See “EVENT_PARAMETER function [System]” [SQL Anywhere Server -
SQL Reference].
● RAISERROR error When a RAISERROR statement is executed, you can use the RAISERROR event
type to take actions. The error number used in the RAISERROR statement can be determined within the
event handler using the EVENT_CONDITION function (for example,
EVENT_CONDITION( 'ErrorNumber' )).
● Idle time The database server has been idle for a specified time (ServerIdle). You may want to use
this event type to perform routine maintenance operations at quiet times.
● Database mirroring When the connection from the primary server to a mirror server or arbiter server
is lost, the MirrorServerDisconnect event fires. To get the name of the server whose connection was lost,
use the EVENT_PARAMETER function with the MirrorServerName parameter. See
“EVENT_PARAMETER function [System]” [SQL Anywhere Server - SQL Reference].
The MirrorFailover event fires whenever a server takes ownership of the database. For example, it fires
when a server first starts and determines that it should own the database. It also fires when a server
previously acting as the mirror determines that the primary server has gone down and, after consulting
with the arbiter, determines that it should take ownership.
Events are not fired on a server that is currently acting as the mirror server since its copy of the database
is still being started. As well, mirroring events cannot be defined to execute on an arbiter, since events
only run in the context of the database in which they are defined, and the arbiter does not use a copy of
the database being mirrored. See “Database mirroring system events” on page 936.
The condition-name argument is one of a set of preset strings, which are appropriate for different event types.
For example, you can use DBSize (the database file size in megabytes) to build a trigger condition suitable
for the GrowDB system event. The database server does not check that the condition-name matches the
event type: it is your responsibility to ensure that the condition is meaningful in the context of the event type.
Examples
● Limit the transaction log size to 10 MB:
● Notify an administrator when free disk space on the device containing the database file falls below 10%,
but do not execute the handler more than once every five minutes (300 seconds):
● Run a process when the server has been idle for ten minutes. Do not execute more frequently than once
per hour:
Code sharing
It can be useful to use a single set of actions to handle multiple events. For example, you may want to take
a notification action if disk space is limited on any of the devices holding the database or log files. To do
this, create a stored procedure and call it in the body of each event handler, passing any needed context
information as parameters to the procedure.
a backup to take place every night at one o'clock, but regularly shut down the database server at the end of
each work day, the backup never takes place.
If the next scheduled execution of an event is more than one hour away, the database server will recalculate
its next scheduled time on an hourly basis. This allows events to fire when expected when the system clock
is adjusted because of a change to or from Daylight Savings Time.
If you are developing event handlers, you can add schedules or system events to control the triggering of an
event later, either using Sybase Central or the ALTER EVENT statement.
See also
● “Triggering an event handler” on page 911
● “ALTER EVENT statement” [SQL Anywhere Server - SQL Reference]
parameter=value,parameter=value
5. Click OK.
See also
● “Developing event handlers” on page 906
● “Debugging procedures, functions, triggers, and events” [SQL Anywhere Server - SQL Usage]
See also
● “ALTER EVENT statement” [SQL Anywhere Server - SQL Reference]
● “SYSEVENT system view” [SQL Anywhere Server - SQL Reference]
Contents
Introduction to database mirroring ............................................................................. 914
Tutorial: Using database mirroring ............................................................................ 921
Tutorial: Using database mirroring with multiple databases sharing an arbiter
server ......................................................................................................................... 925
Setting up database mirroring ................................................................................... 930
Using the SQL Anywhere Veritas Cluster Server agents .......................................... 940
Database mirroring is a configuration of either two or three database servers, running on separate
computers, that co-operate to maintain copies of the database and transaction log files.
The primary server and mirror server each maintain a copy of the database files and transaction log files,
while the third server, called the arbiter server, is used when it is necessary to determine which of the other
two servers can take ownership of the database. The arbiter does not maintain a copy of the database. The
configuration of three database servers (the primary, mirror, and arbiter servers) is called a mirroring
system, and the primary and mirror servers together are called the operational servers or partners.
Clients connect to the primary server to access the database. Any changes that are made to the database are
recorded in the transaction log on the primary server. When the changes are committed, the transaction log
pages are sent to the mirror server where they are applied to a mirror copy of the database. The copy of the
database on the mirror server can only be accessed in read-only mode while that server is acting as the mirror
server. See “Configuring read-only access to a database running on the mirror server” on page 932.
If the primary server becomes unavailable because of hardware or software failure, the mirror server
negotiates with the arbiter to take ownership of the database and assume the role of primary server. For an
ownership transfer, or role switch, to take place, the surviving operational server and the arbiter must agree
that the mirror was in a current, synchronized state at the time the role switch is attempted. Any clients that
were connected to the original primary server are disconnected, and any uncommitted transactions are lost.
Clients must then reconnect to the database on the new primary server to continue accessing the database.
When the original primary server becomes available again, it assumes the role of mirror server.
The database servers display status messages in the database server messages window on startup to indicate
which role the server is assuming and how far the startup process has progressed. A message appears if the
database must be restarted because of the loss of one or more of the other servers in the mirroring system,
or if its role changes from mirror to primary.
If an assertion failure occurs on a server that is part of a mirroring system, the server writes the error to the
database server message log and then exits. This notifies the other servers that it has failed so that they can
take appropriate action.
There are no special hardware or software requirements for database mirroring, and the database servers can
be running in separate geographical locations. Database servers that are participating in a database mirroring
system can run both mirrored and non-mirrored databases. As well, the arbiter server can be the arbiter for
multiple database mirroring systems.
Details about the state of each database in the database mirroring system are stored in a state information
file. See “State information files” on page 920.
Note
Database mirroring is not a replacement for a backup and recovery plan. You should always implement a
backup and recovery strategy for your database. See “Database mirroring and backups” on page 937 and
“Backup and data recovery” on page 847.
For information about upgrading SQL Anywhere or rebuilding a database involved in a database mirroring
system, see “Upgrading SQL Anywhere software and databases in a database mirroring system” [SQL
Anywhere 11 - Changes and Upgrading].
Quorum
Before a server can assume the role of primary server, it must have a quorum, which means that at least one
other server must agree that a server can own the database. If the mirror server becomes unavailable while
the primary server and arbiter are connected, the primary server continues to provide access to the database.
If the primary server loses quorum, it can no longer permit access to the database. At that point, it stops the
mirrored database, attempts to restart it, and then waits to regain quorum before making the database
available.
When you start a database mirroring system, the database servers go through a startup process to reach
quorum and accept client connections. The following steps describe a typical sequence of events for this
process:
1. The arbiter server waits for Server 1 and Server 2.
2. Server 1 looks for the arbiter server or Server 2.
Restrictions
● When running in asynchronous or asyncfullpage mode, you must determine what happens when failover
occurs and transactions are not committed to the database.
● Incomplete transactions must be rolled back when the mirror server takes ownership of the database, and
the longer a transaction is, the longer it takes to roll the transaction back. The recovery speed for failover
is affected by the number of clients and the length of their transactions that need to be rolled back. If
recovery speed is a concern, you may want to design your application to use short transactions whenever
possible.
available to clients. If the primary server loses communications with both the mirror and the arbiter, it must
shut down and wait for either one to become available.
An arbiter server can function as arbiter for more than one mirror system. It can also act as a database server
for other databases.
Synchronous mode is the default. These modes control when and how transactions are recorded on the mirror
server, and you set them with the -xp server option.
When choosing a synchronization mode for your database mirroring system, you must determine whether
recovery speed or the state of the data is more important when failover occurs.
You can check the database mirroring mode by querying the value of the MirrorMode database property:
SELECT DB_PROPERTY( 'MirrorMode' );
Synchronous mode
In synchronous mode, committed transactions are guaranteed to be recorded on the mirror server. Should a
failure occur on the primary server, no committed transactions are lost when the mirror server takes over.
In this mode, the primary server sends transaction log pages to the mirror when a transaction is committed.
The mirror server acknowledges that transmission when it has written those pages to its copy of the
transaction log. The primary server does not reply to the application until it receives this acknowledgement.
Using synchronous mode provides transaction safety because the operational servers are in a synchronized
state, and changes sent to the mirror must be acknowledged before the primary can proceed.
Asynchronous mode
In asynchronous mode, committed transactions are not guaranteed to be recorded on the mirror server. In
this mode, the primary server sends transaction log pages to the mirror when a transaction is committed. It
does not wait for an acknowledgement from the mirror before replying to the application that the COMMIT
has completed. Should a failure occur on the primary server, it is possible that some committed transactions
may be lost when the mirror server takes over.
Asyncfullpage mode
In asyncfullpage (or page) mode, pages are not sent on COMMIT; instead, they are sent when the page is
full. This reduces the amount of traffic between the two database servers and improves the performance of
the primary server. If the current log page has not been sent to the mirror for the number of seconds specified
by the pagetimeout parameter, it is sent even though it is not yet full. The default pagetimeout is 5 seconds.
Using this mode provides a limit on how long committed transactions are exposed to being lost if the primary
server goes down and the mirror server takes ownership of the database. Asyncfullpage mode implies
asynchronous operation, so the primary server does not wait for an acknowledgement from the mirror.
Asynchronous and asyncfullpage mode are faster than synchronous mode, but are less reliable for the above
reasons. In asynchronous or asyncfullpage mode, failover from the primary server to the mirror server is not
automatic because the mirror server may not have all committed transactions that were applied on the primary
server. For this reason, when using one of the asynchronous modes, a mirror server, by default, cannot take
ownership of a database when the primary fails. If automatic failover is desirable in this situation (despite
the likelihood of lost transactions), set the autofailover option to yes using the -xp server option. Otherwise,
when the failed server is restarted, it detects whether transactions were lost. If transactions were lost, it writes
a message to the database server message log and shuts down the database. The current database and
transaction log must then be replaced using a backup before mirroring can continue.
For information about bringing up a server after it fails in asynchronous or asyncfullpage mode, see
“Recovering from primary server failure” on page 935.
Note
It is recommended that you set the -xp autofailover option to yes if you are using asynchronous or
asyncfullpage mode. Then, if the primary server goes down, the mirror server automatically takes over as
the primary server.
The synchronize_mirror_on_commit option lets you control when database changes are guaranteed to have
been sent to a mirror server when running in asynchronous or asyncfullpage mode. When you set this option
to On, each COMMIT causes any changes recorded in the transaction log to be sent to the mirror server, and
an acknowledgement to be sent by the mirror server to the primary server once the changes are received by
the mirror server. The option can be set for specific transactions using SET TEMPORARY OPTION. It may
also be useful to set the option for specific applications by examining the APPINFO string in a login
procedure.
SQL Anywhere supports system events that fire when failover occurs in a database mirroring system,
regardless of which mode you are using. You can use these events for such tasks as notifying the administrator
when failover occurs. See “Database mirroring system events” on page 936.
See also
● “synchronize_mirror_on_commit option [database]” on page 523
● “-xp database option” on page 245
● “SET OPTION statement” [SQL Anywhere Server - SQL Reference]
Synchronization states
When a mirroring system is using synchronous mode, it can be in one of two states: synchronizing or
synchronized.
Once an operational server starts and determines that it will act as the mirror, it first requests any log pages
from the primary server that it does not already have. This may involve copying pages from log files other
than the current active log on the primary server. As it receives these pages, the mirror applies the changes
they contain to its copy of the database. Once all pages from the primary have been received, the primary
and mirror are in a synchronized state. From that point onward, any changes committed on the primary must
be sent to the mirror and acknowledged by the mirror.
In asynchronous and asyncfullpage mode, the mirror requests log pages as above; however, the two servers
never enter a synchronized state. Once the mirror has requested all log pages available at the primary, the
primary is notified that it must send any updated pages to the mirror.
Field Description
State Contains the synchronization state (one of synchronizing or synchronized) to indicate whether
the server is receiving log pages or is up to date. See “Synchronization states” on page 919.
Mode Specifies the synchronization mode (one of synchronous, asynchronous, or page). See
“Choosing a database mirroring mode” on page 918.
Se- Contains a value indicating how many times failover has occurred on the database mirroring
quence system. The sequence number is incremented on each role switch. It helps to determine
whether a server’s view of the state of the mirroring system is current. See “Introduction to
database mirroring” on page 914.
If a state information file does not exist, it is created automatically. State information files should only be
modified by the database server.
● -xp Provides information to the server that is being started so it can connect to its partner and the
arbiter server.
7. Run the following command (it must be typed on one line) to start server2:
dbsrv11 -n server2 -x tcpip(PORT=2637) -xf c:\server2\server2state.txt
-su sql c:\server2\demo.db -sn mirrordemo
-xp "partner=(ENG=server1;LINKS=tcpip(PORT=2638;TIMEOUT=1));auth=abc;
arbiter=(ENG=arbiter;LINKS=tcpip(PORT=2639;TIMEOUT=1));mode=sync"
If a warning message appears indicating that the database server still has one connection, click Yes to
shut it down.
The arbiter database server messages window displays a message indicating that the primary server is
disconnected.
The database server messages window for server2 displays a message indicating that it is the new primary
server:
12. Close Interactive SQL. If you receive an error message, click OK.
13. Restart Interactive SQL by running the following command:
dbisql -c "UID=DBA;PWD=sql;ENG=mirrordemo;LINKS=tcpip"
14. Execute the following statement to see that you are now connected to the mirror server:
SELECT PROPERTY ( 'ServerName' );
15. Execute the following statement to verify that all transactions were mirrored to the mirror database:
SELECT * FROM test;
16. Disconnect from Interactive SQL, and then click Shut Down on the database server messages window
for the arbiter and server2 database servers.
If the primary server becomes unavailable, then a role switch occurs and the mirror server takes ownership
of the databases. The mirror server becomes the primary server. The client must re-establish a connection
to the primary server. The alternate server name is all that needs to be specified to re-establish the connection
to the primary server. This configuration also has the ability to protect against failure of a single database.
If a database running on the primary server becomes unavailable, then a role switch occurs and the mirror
server takes ownership for the failed database. The mirror server becomes the primary server for only this
database. The client must re-establish a connection to the primary server for this database using the alternate
server name.
To set up a mirroring system with three databases and one arbiter server
1. Create the following directories:
● c:\server1
● c:\server2
● c:\arbiter
2. Run the following commands from the c:\server1 directory:
dbinit one.db
dbinit two.db
dbinit three.db
3. Create a transaction log for each database by running the following commands:
dbping -d -c "UID=DBA;PWD=sql;DBF=c:\server1\one.db"
dbping -d -c "UID=DBA;PWD=sql;DBF=c:\server1\two.db"
dbping -d -c "UID=DBA;PWD=sql;DBF=c:\server1\three.db"
4. Copy the databases from the c:\server1 directory to the c:\server2 directory.
5. Start the arbiter server:
dbsrv11
-x tcpip(port=2640)
-n arbiter
-xa "AUTH=abc,def,ghi;DBN=one,two,three"
-xf c:\arbiter\arbiterstate.txt
-su sql
6. Start the databases on server1:
dbsrv11
-n server1
-x tcpip(PORT=2638)
-xf c:\server1\server1state.txt
-su sql
c:\server1\one.db
-sn mirrortutorial_one
-xp "partner=(ENG=server2;LINKS=tcpip(PORT=2639;TIMEOUT=1));
auth=abc;arbiter=(ENG=arbiter;LINKS=tcpip(PORT=2640;TIMEOUT=1));
mode=sync"
c:\server1\two.db
-sn mirrortutorial_two
-xp "partner=(ENG=server2;LINKS=tcpip(PORT=2639;TIMEOUT=1));
auth=def;arbiter=(ENG=arbiter;LINKS=tcpip(PORT=2640;TIMEOUT=1));
mode=sync"
c:\server1\three.db
-sn mirrortutorial_three
-xp "partner=(ENG=server2;LINKS=tcpip(PORT=2639;TIMEOUT=1));
auth=ghi;arbiter=(ENG=arbiter;LINKS=tcpip(PORT=2640;TIMEOUT=1));
mode=sync"
7. Start the databases on server2:
dbsrv11
-n server2
-x tcpip(PORT=2639)
-xf c:\server2\server2state.txt
-su sql
c:\server2\one.db
-sn mirrortutorial_one
-xp "partner=(ENG=server1;LINKS=tcpip(PORT=2638;TIMEOUT=1));
auth=abc;arbiter=(ENG=arbiter;LINKS=tcpip(PORT=2640;TIMEOUT=1));
mode=sync"
c:\server2\two.db
-sn mirrortutorial_two
-xp "partner=(ENG=server1;LINKS=tcpip(PORT=2638;TIMEOUT=1));
auth=def;arbiter=(ENG=arbiter;LINKS=tcpip(PORT=2640;TIMEOUT=1));
mode=sync"
c:\server2\three.db
-sn mirrortutorial_three
-xp "partner=(ENG=server1;LINKS=tcpip(PORT=2638;TIMEOUT=1));
auth=ghi;arbiter=(ENG=arbiter;LINKS=tcpip(PORT=2640;TIMEOUT=1));
mode=sync"
After starting server2, the server1 database server messages window shows that server1 is the primary
server in the mirroring system for databases one, two, and three. The messages also indicate that the
mirror databases for one, two, and three (partners) are connected to server1.
The arbiter messages show that both server1 and server2 are connected.
8. Run the following command to start Interactive SQL and connect to database one on the primary server:
dbisql -c "UID=DBA;PWD=sql;ENG=mirrortutorial_one;LINKS=TCPIP"
9. Add sample data to the SQL Anywhere sample database by executing the following statements:
CREATE TABLE test (col1 INTEGER, col2 CHAR(32));
INSERT INTO test VALUES(1, 'Hello from server1');
COMMIT;
10. Determine which database server you are connected to by executing the following statement:
SELECT PROPERTY( 'ServerName' );
If a warning message appears indicating that the database server still has one connection, click Yes to
shut it down.
The arbiter database server messages window displays a message indicating that the primary server is
disconnected.
The database server messages window for server2 displays a message indicating that it is the new primary
server:
15. Execute the following statement to verify that all transactions were mirrored to the mirror database:
SELECT * FROM test;
16. Disconnect from Interactive SQL, and then click Shut Down on the database server messages window
for the arbiter and server2 database servers.
When connecting to a mirrored database, clients must use the server name that was specified by the -sn
option in the commands used to start the primary and mirror servers. Using the example above (database
servers were started with the option -sn mirrordemo), clients specify the connection parameter
ENG=mirrordemo in their connection string:
...UID=user12;PWD=x92H4pY;ENG=mirrordemo;LINKS=tcpip...
If the primary and mirror servers are running on different subnets, then you must specify a range of IP
addresses that the client should use to connect to the primary server. For example:
...UID=user12;PWD=x92H4pY;ENG=mirrordemo;LINKS=tcpip(HOST=ip1,ip2...)...
You may also want to specify the RetryConnectionTimeout connection parameter to control how long clients
keep retrying the connection attempt to the primary server. See “RetryConnectionTimeout connection
parameter [RetryConnTO]” on page 280.
If you are having trouble locating the server to which clients need to connect, try the following:
1. Specify the host name of the computers running the primary and mirror servers. For example, if they are
running on computers named MirrorServ1 and MirrorServ2, you can use
LINKS=tcpip(HOST=MirrorServ1,MirrorServ2) in the client connection string.
2. Register the servers with LDAP. See “Connecting using an LDAP server” on page 138.
3. Use the SQL Anywhere Broadcast Repeater utility (dbns11) to locate the servers. This utility listens for
broadcasts and responses on one subnet, and then re-broadcasts them on another subnet. See “Broadcast
Repeater utility (dbns11)” on page 677.
See also
● “State information files” on page 920
See also
● “-xp database option” on page 245
● “Initiating failover on the primary server” on page 934
● “Choosing a database mirroring mode” on page 918
Any attempt to make a change to the database results in an error, which is the same behavior as when a
database is started as read-only using the -r option. You can perform operations on temporary tables, but
events are not fired on the mirror database. Event firing only starts after failover from the primary server to
the mirror server takes place. The DatabaseStart and MirrorFailover events fire at that time, if they are
defined. For more information, see “Understanding system events” on page 902.
Connections to the mirror database are maintained if failover occurs and the mirror server becomes the
primary server. After failover, a connection can make changes to the database. You can query the value of
the ReadOnly database property to determine whether the database you are connected to is updatable:
SELECT DB_PROPERTY( 'ReadOnly' );
See also
● “-sm database option” on page 242
● ReadOnly property: “Database-level properties” on page 574
See also
● “-sm database option” on page 242
● “Snapshot isolation” [SQL Anywhere Server - SQL Usage]
● “allow_snapshot_isolation option [database]” on page 448
For more information, see “ALTER DATABASE statement” [SQL Anywhere Server - SQL Reference].
Forces a database server that is currently acting as the mirror server to take ownership of the database. This
statement can be executed from within a procedure or event, and must be executed while connected to the
utility database on the mirror server. See “Connecting to the utility database” on page 22.
This statement is an alternative to specifying a preferred server, and can be used with logic that controls
when ownership of the database is given to a specific database server. For example, you may want to initiate
failover based on the availability of the partner server (determined by the value of the PartnerState database
property), or the number of connections to the database (determined by the value of the ConnCount database
property).
When this statement is executed, any existing connections to the database are closed, including the
connection that executed the statement. Consequently, if the statement is contained in a procedure or event,
other statements that follow it may not be executed. The permissions required to execute this statement are
controlled by the -gk server option.
See also
● “Specifying a preferred database server” on page 932
● “ALTER DATABASE statement” [SQL Anywhere Server - SQL Reference]
● “-gk server option” on page 181
● ConnCount and PartnerState properties: “Database-level properties” on page 574
Events are not fired on a server that is currently acting as the mirror server. As well, mirroring events cannot
be defined to execute on an arbiter, since events only run in the context of the database in which they are
defined, and the arbiter does not use a copy of the database being mirrored.
You can use these events as a mechanism to send notification via email that action may be required on the
mirror database. These events may not fire in all situations that result in the database running on the primary
server becoming unavailable. For example, a power outage affecting both the primary and mirror servers
would prevent either of these events from being fired. If this type of monitoring is required, it can be
implemented on a separate computer via a scripting language by calling dbping to periodically connect to
the mirror database. See “Ping utility (dbping)” on page 736.
The following example creates an event that notifies an administrator when failover occurs:
CREATE EVENT mirror_server_unavailable
TYPE MirrorServerDisconnect
HANDLER
BEGIN
CALL xp_startmail ( mail_user ='George Smith',
mail_password ='mypwd' );
CALL xp_sendmail( recipient='DBAdmin',
subject='Database failover occurred',
"message"='The following server is unavailable in the mirroring system: '
|| event_parameter( 'MirrorServerName' ) );
CALL xp_stopmail ( );
END;
See also
● “Understanding system events” on page 902
operating in asynchronous mode has better performance than one in synchronous mode, but is still slower
than a database server that is not participating in a mirroring system. Performance is highly dependent on
the speed of the network connection between the operational servers.
See also
● “Backup and data recovery” on page 847
● “Ensuring your database is valid” on page 862
At any time, you can use the MirrorState, PartnerState, and ArbiterState database properties to determine
the status of the database servers in the mirroring system. See “Database-level properties” on page 574.
In this scenario, if you are running in asynchronous or asyncfullpage mode and did not specify that
autofailover should occur, then you may need to make a copy of the database and restart the server that is
still operational before clients can connect again.
For more information about recovering when the primary server becomes unavailable, see “Recovering from
primary server failure” on page 935.
Should Server 2 become unavailable before Server 1 has received all the transactions from Server 2, Server
1 will not be able to reach a synchronized state. It must wait for Server 2 to become available again so it can
obtain and apply the transactions it does not yet have.
For more information about recovering when the primary server becomes unavailable, see “Recovering from
primary server failure” on page 935.
A cluster is a group of computers, called nodes, that work together to run a set of applications. Clients
connecting to applications running on a cluster treat the cluster as a single system. If a node fails, other nodes
in the cluster can automatically take over the services provided by the failed node. Clients may see a slight
disruption in availability (the time it takes to resume the services on the remaining nodes), but are otherwise
unaware that the node has failed.
When you use clustering with SQL Anywhere, any uncommitted transactions are lost when a database or
database server fails over to another node in the cluster, and clients must reconnect to the database after
failover occurs.
SQL Anywhere supports a variety of cluster environments where the cluster software can make any
application into a generic resource subject to automatic failover so that high availability can be provided.
However, only the database server process can be failed over, and the monitoring and control processes are
limited.
For more information, see http://www.sybase.com/detail?id=1034743.
Most cluster software provides an API for creating custom resources tailored to a specific application. SQL
Anywhere includes two custom failover resources for Veritas Cluster Server: SAServer and SADatabase.
The SAServer agent is responsible for database server failover, while the SADatabase agent is responsible
for the failover of a specific database file. You can use one or both agents, depending on your application.
Your systems must be set up as follows to use the SQL Anywhere Veritas Cluster Server agents:
● You must use Veritas Cluster Server 4.1 or later.
● SQL Anywhere must be installed identically on each system node within the cluster.
● Database files must be stored on a shared storage device that is accessible to all systems within the cluster.
● The utility database password must be the same for all systems within the cluster.
The SADatabase agent uses the utility database to start and stop specific database files. All systems
participating in the cluster must have the same utility database password. You can set the utility database
password by specifying the -su server option when starting the database server.
On Unix, the VCS agent is installed in install-dir/vcsagent/saserver.
There are three ways to configure and add a new agent to Veritas Cluster Server:
1. Using the Cluster Manager.
2. Using command line utilities.
3. Using a text editor and editing the main.cf configuration files.
3. Copy the following files from the install-dir\SADatabase directory to the %VCS_HOME%\bin
\SADatabase directory you created in Step 2:
● Online.pl
● Offline.pl
● Monitor.pl
● Clean.pl
● SADatabase.xml
4. Copy the file %VCS_HOME%\bin\VCSdefault.dll into the %VCS_HOME%\bin\SADatabase directory
and rename it to SADatabase.dll.
5. Copy the file install-dir\SADatabase\SADatabaseTypes.cf into the %VCS_HOME%\conf\config
directory.
6. Repeat Steps 1-5 for all systems participating in the cluster.
7. Start the Veritas Cluster Server Manager and enter your user name and password to connect to the cluster.
8. Add the SADatabase agent:
a. From the File menu, choose Import Types.
b. Navigate to %VCS_HOME%\conf\config\, and click Import.
3. Right-click the service group, and choose Online » node-name, where node-name is the name of the
computer in the cluster on which you want the resource to run.
The service group is now online.
The database file on the first computer fails. There is a delay before Veritas Cluster Server recognizes
that the file has failed because Veritas Cluster Server monitors the health of its resource, every 60 seconds
by default (you can make this interval smaller in your resource configuration). The database file then
fails over to the second computer, and that database file will be started using the database server on the
second computer, which may have a different name than the original database server.
For example, if the new database server is called VCS2, then clients must specify the new database server
name in their connection strings:
"UID=DBA;PWD=sql;ENG=VCS2;DBN=DEMO;LINKS=tcpip"
4. Reconnect from Interactive SQL. You should be able to connect and execute the query successfully.
Contents
Introduction to security features ................................................................................ 948
Security tips ............................................................................................................... 950
Controlling database access ..................................................................................... 952
Auditing database activity .......................................................................................... 958
Running the database server in a secure fashion ..................................................... 964
Encrypting a database ............................................................................................... 965
Keeping your Windows Mobile database secure ....................................................... 975
Note
If you are concerned about other processes on the computer running the database server being able to
access the contents of your client/server communications, it is recommended that you use encryption.
● Secured features You can disable features for all databases running on a database server.
● SELinux support SELinux policies control an application's access to system resources. SQL
Anywhere includes a policy that secures it on Red Hat Enterprise Linux 5.
For information about compiling and installing the SQL Anywhere SELinux policy, see install-dir/
selinux/readme.
Database administrators are responsible for data security. In this chapter, unless otherwise noted, you require
DBA authority to perform the tasks described.
User IDs and permissions are security-related topics. See “Managing user IDs, authorities, and
permissions” on page 385.
Security tips
As database administrator, there are many actions you can take to improve the security of your data. For
example, you can:
● Choose passwords carefully Do not deploy databases that use the default user ID and password.
See “Increasing password security” on page 952.
● Restrict DBA authority You should restrict DBA authority only to users who absolutely require it
since it is very powerful. Users with DBA authority can see and do anything in the database.
You may consider giving users with DBA authority two user IDs: one with DBA authority and one
without, so they can connect as a DBA user only when necessary.
● Use secured database features The database server -sf option lets you enable and disable features
for all databases running on a database server. The features you can disable include the use of external
stored procedures, Java, remote data access, and the ability to change the request log settings. See “-sf
server option” on page 207 and “Specifying secured features” on page 956.
● Drop external system functions The following external functions present possible security risks:
xp_cmdshell, xp_startmail, xp_startsmtp, xp_sendmail, xp_stopmail, and xp_stopsmtp.
The xp_cmdshell procedure allows users to execute operating system commands or programs.
The email commands allow users to have the server send email composed by the user. Malicious users
could use either the email or command shell procedures to perform operating-system tasks with
authorities other than those they have been given by the operating system. In a security-conscious
environment, you should drop these functions.
For information about dropping procedures, see “DROP statement” [SQL Anywhere Server - SQL
Reference].
● Protect your database files You should protect the database file, log files, and dbspace files from
unauthorized access. Do not store them within a shared directory or volume.
● Protect your database software You should similarly protect SQL Anywhere software. Only give
users access to the applications, DLLs, and other resources they require.
● Run the database server as a service or a daemon To prevent unauthorized users from shutting
down or gaining access to the database or log files, run the database server as a Windows service. On
Unix, running the server as a daemon serves a similar purpose. See “Running the server outside the
current session” on page 52.
● Set SATMP to a unique directory To make the database server secure on Unix platforms, set
SATMP to a unique directory, and make the directory read, write, and execute protected against all other
users. Doing so forces all other connections to use TCP/IP, which is more secure than the shared memory
connection.
The shared memory buffers that are used between the client and server are removed from the directory
tree before any actual data is sent between the two sides. This means that another process cannot see any
of the communication data because the shared memory buffer/file is hidden, and so a process cannot get
a handle to it.
● Strongly encrypt your database Strongly encrypting your database makes it completely
inaccessible without the key. You cannot open the database, or view the database or transaction log files
using any other means.
For more information, see “-ep server option” on page 173 and “-ek database option” on page 239.
The user cannot access any database object that does not meet these criteria. In short, users can access only
the objects they own or objects to which they explicitly received access permissions.
For more information, see:
● “Managing user IDs, authorities, and permissions” on page 385
● “CONNECT statement [ESQL] [Interactive SQL]” [SQL Anywhere Server - SQL Reference]
● “GRANT statement” [SQL Anywhere Server - SQL Reference]
● “REVOKE statement” [SQL Anywhere Server - SQL Reference]
Use a login policy to control the frequency of user password changes and to specify the number of login
attempts allowed before an account is locked. See “Managing login policies overview” on page 386, or
“CREATE LOGIN POLICY statement” [SQL Anywhere Server - SQL Reference].
By default, passwords can be any length. For greater security, you can enforce a minimum length requirement
on all new passwords to disallow short (and therefore easily guessed) passwords. You do this by setting the
min_password_length database option to a value greater than zero. The following statement enforces
passwords to be at least 8 bytes long.
SET OPTION PUBLIC.min_password_length = 8;
By default, database passwords never expire. You can use a login policy to implement password expiry. See
“Managing login policies overview” on page 386.
You can use the verify_password_function option to specify a function that implements password rules. See
“verify_password_function option [database]” on page 532.
The following example defines a table and function and sets some login policy options. Together they
implement advanced password rules that include requiring certain types of characters in the password,
disallowing password reuse, and expiring passwords. The function is called by the database server with the
verify_password_function option when a user ID is created or a password is changed. The application can
call the procedure specified by the post_login_procedure option to report that the password should be
changed before it expires.
The code for this sample is also available in the following location: samples-dir\SQLAnywhere\SQL
\verify_password.sql. (For information about samples-dir, see “Samples directory” on page 336.)
ELSEIF num_lower_chars = 0
OR length( pwd_alpha_only ) - num_lower_chars = 0 THEN
RETURN 'password must contain both upper- and lowercase characters';
END IF;
RETURN( NULL );
END;
The REVOKE statement is the opposite of the GRANT statement—any permission that GRANT has
explicitly given, REVOKE can take away. Revoking CONNECT from a user removes the user from the
database, including all objects owned by that user.
See also
● “Managing user IDs, authorities, and permissions” on page 385
● “GRANT statement” [SQL Anywhere Server - SQL Reference]
● “REVOKE statement” [SQL Anywhere Server - SQL Reference]
For a complete list of features, see “-sf server option” on page 207.
You also have the option of including the -sk option when you start the database server. This option specifies
a key that can be used to re-enable secured features for a specific connection. You re-enable secured features
for a connection by setting the value of the secure_feature_key temporary option to the value specified by
-sk when the database server was started.
To modify the features or feature sets that are secured for the connection, specify a key with -sk and set the
secure_feature_key temporary option to the key value to use the sa_server_option system procedure. Any
changes you make to enable or disable features take effect immediately.
To secure database features
1. Start the database server using the -sf, and optionally -sk, options.
For example, the following command starts the database server and disables the use of remote data access.
However, it includes a key that can be used to re-enable the disabled features for a connection.
dbsrv11 -n secure_server -sf remote_data_access -sk ls64uwq15 c:\mydata.db
2. Connect to the database server.
For example:
dbisql -c "UID=DBA;PWD=sql;ENG=secure_server;DBN=demo"
3. Set the value of the temporary secure_feature_key option to the value specified by -sk when the database
server was started.
For example:
SET TEMPORARY OPTION secure_feature_key = 'ls64uwq15';
4. Change the secured features for the database server with the sa_server_option system procedure.
For example:
CALL sa_server_option( 'SecureFeatures', '-remote_data_access' );
See also
● “-sf server option” on page 207
● “-sk server option” on page 211
● “secure_feature_key [database]” on page 515
● “sa_server_option system procedure” [SQL Anywhere Server - SQL Reference]
You cannot stop using a transaction log while auditing is enabled for a database. If you want to turn off the
transaction log, you must first turn off auditing.
Controlling auditing
The database administrator can turn on auditing to add security-related information to the transaction log.
This can be done using Sybase Central or Interactive SQL.
Auditing is off by default. You must have DBA authority to enable and disable auditing.
To control auditing (Sybase Central)
1. Connect to the database as a user with DBA authority.
2. Right-click the database and choose Properties.
The Database Properties window appears.
3. Click the Auditing tab and specify which information to audit:
● Do Not Collect Audit Information For This Database No audit information is collected. This
option disables auditing by setting the auditing database option to Off. See “auditing option
[database]” on page 454.
● Collect All Audit Information For This Database All types of auditing information are
collected for the database. This option enables auditing by setting the auditing database option to
On. See “auditing option [database]” on page 454.
The transaction log can grow significantly when this option is selected.
● Collect The Following Type(s) Of Audit Information For This Database Allows you to
specify which auditing information to collect. For example, you can choose to collect only DDL
To specify which types of auditing information you want to enable, use the following system procedure:
You can control the type of auditing information that is collected by replacing all with the types of
auditing you want to enable. See “sa_enable_auditing_type system procedure” [SQL Anywhere Server
- SQL Reference].
3. Execute the following statement to turn off auditing:
To specify which types of auditing information you want to disable, use the following system procedure:
You can stop collecting specific types of auditing information by replacing all with the types of auditing
you want to disable. See “sa_disable_auditing_type system procedure” [SQL Anywhere Server - SQL
Reference].
Once you have enabled auditing for a database, you can set the temporary conn_auditing database option in
the database login procedure to enable connection-specific auditing. You can enable auditing based on
information such as the IP address of the client computer or the type of connection.
If you do not set the conn_auditing option in the login procedure, the option is on by default.
The following example shows an excerpt from a login procedure that enables auditing for all connections
to the database, except those made by the DBA user:
For more information, see “login_procedure option [database]” on page 483 and “conn_auditing option
[database]” on page 460.
See also
● “auditing option [database]” on page 454
You can access the dbtran utility from Sybase Central or from a command prompt. The dbtran utility uses
the specified transaction log to produce a SQL script that contains all of the transactions, along with some
information about what user executed each command. By using the -g option, dbtran includes more
comments containing the auditing information. The -g option is equivalent to specifying the following
options:
● -d Display output in chronological order.
● -t Include trigger-generated operations in the output.
● -a Include rolled back transactions in the output.
For more information about these options, see “Log Translation utility (dbtran)” on page 731.
You can run the dbtran utility against a running database server or against a database log file.
For example:
dbtran -g -c "UID=DBA;PWD=sql" -n demo.sql
A readable version of the transaction log is saved to your current directory. In the example, the auditing
information is saved to the demo.sql file, and the file contains information about the sample database.
For more information about connection strings, see “Connection parameters” on page 248.
For example:
dbtran -g demo.log demo.sql
In the example, the auditing information from the transaction log file demo.log is placed into the file
demo.sql.
For more information, see “Log Translation utility (dbtran)” on page 731.
Auditing example
This example shows how the auditing feature records attempts to access unauthorized information using
either Sybase Central or Interactive SQL.
Auditing example (Sybase Central)
1. Start Sybase Central and connect to the sample database using the SQL Anywhere 11 Demo data source.
This connects you as a DBA user.
2. Turn on auditing:
a. Right-click the database and choose Properties.
The Database Properties window appears.
b. On the Auditing tab, select Collect All Audit Information For This Database.
c. Click Apply.
d. Click OK.
3. Add a user named Test1 to the sample database, with the password welcome:
a. Right-click Users & Groups, and choose New » User.
b. When prompted, name the user Test1, and type welcome as their password.
c. Give the user Profile Authority.
d. Click Finish.
e. Disconnect from the sample database.
4. Using Sybase Central, connect to the sample database as Test1 and attempt to access confidential
information in the Employees table:
a. Select Tables, and then select the Employees table.
b. Click the Data tab.
An error message appears: Permission denied: you do not have permission to
select from "Employees".
c. Click OK.
d. Disconnect from the sample database.
5. View the auditing information for this activity:
a. Using Sybase Central, connect to the sample database as a user with DBA authority.
b. Select the database, and then click the Auditing tab in the right pane.
c. Click Retrieve Audit Messages.
d. Click Close.
Auditing information appears.
e. Use the filtering options to locate the error in the auditing information table. You can find the error
for BadUser by selecting the Only Errors option. Use the date and time information to pinpoint the
error. For example, if BadUser tried accessing the Employees table on November 6, 2007 at 10:07:14,
the corresponding audit entry resembles the following entry:
2007-11-06 10:07:14 | Permission
6. Restore the sample database to its original state:
a. Right-click the database, and then choose Properties.
b. On the Auditing tab, select Do Not Collect Audit Information For This Database.
c. Click OK.
d. Select Users & Groups.
Right-click Test1, and choose Delete.
You receive an error message: Permission denied: you do not have permission to
select from "Employees".
5. Run the following command to view the auditing information for this activity:
dbtran -g -c "DSN=SQL Anywhere 11 Demo" -n demo.sql
6. Restore the sample database to its original state:
● Use the DROP USER statement to remove the Test1 user from the database:
DROP USER Test1;
● Turn off auditing using the following SET OPTION statement:
SET OPTION PUBLIC.auditing = 'Off';
See also
● “auditing option [database]” on page 454
● “Log Translation utility (dbtran)” on page 731
● “Transaction Log utility (dblog)” on page 773
Encrypting a database
As a database administrator, you can use database encryption to make it more difficult for someone to
decipher the data in your database. You can choose to secure your database either with simple or with strong
encryption.
Simple encryption
Simple encryption is equivalent to obfuscation and makes it more difficult for someone using a disk utility
to look at the file to decipher the data in your database. Simple encryption does not require a key to encrypt
the database. Simple encryption technology is supported in previous versions of SQL Anywhere.
To use simple encryption
● Create a database using the dbinit -ea simple option.
The following example creates the database test.db using simple encryption:
dbinit -ea simple test.db
See also
● “Initialization utility (dbinit)” on page 703
● “CREATE DATABASE statement” [SQL Anywhere Server - SQL Reference]
Strong encryption
Strong database encryption technology makes a database inoperable and inaccessible without a key
(password). An algorithm encodes the information contained in your database and transaction log files so
they cannot be deciphered.
Caution
For strongly encrypted databases, be sure to store a copy of the key in a safe location. If you lose the
encryption key there is no way to access the data, even with the assistance of technical support. The database
must be discarded and you must create a new database.
databases encrypted with simple encryption. Unencrypted databases can also be started on the server when
-fips is specified. See “-fips server option” on page 176.
The SQL Anywhere security option must be installed on any computer used to run a database encrypted
with AES_FIPS or AES256_FIPS.
Note
FIPS is not available on all platforms. For a list of supported platforms, see SQL Anywhere Supported
Platforms and Engineering Support Status.
On Windows Mobile, the AES_FIPS and AES256_FIPS algorithms are only supported with ARM
processors.
Note
FIPS is not available on all platforms. For a list of supported platforms, see SQL Anywhere Supported
Platforms and Engineering Support Status.
For more information about the encryption key, see “DatabaseKey connection parameter
[DBKEY]” on page 260.
If you have a database you want to encrypt, you can do so using the CREATE ENCRYPTED FILE statement.
You are not actually overwriting the file; you are creating a copy of the file in encrypted form.
To encrypt a database after it has been created
1. Encrypt an unencrypted database using the CREATE ENCRYPTED FILE statement.
The following example takes the database file current.db, and creates an encrypted copy of it named
encrypted.db.
CREATE ENCRYPTED FILE 'encrypted.db'
FROM 'current.db'
KEY 'abc'
ALGORITHM 'AES';
2. Using the same encryption key information, and following the file name convention you used for the
database file, encrypt the associated transaction log file(s), dbspace file(s), and mirror log file (if any),
using the CREATE ENCRYPTED FILE statement. See “CREATE ENCRYPTED FILE
statement” [SQL Anywhere Server - SQL Reference].
You cannot encrypt a database if table encryption is enabled. Instead, you must recreate the database without
table encryption. Also, you cannot use the CREATE ENCRYPTED FILE statement to enable table
encryption for a database. To enable encryption on a database, you must recreate the database and enable
table encryption. See “Enabling table encryption” on page 972.
You can decrypt a database using the CREATE DECRYPTED FILE statement. As with the CREATE
ENCRYPTED FILE statement, you are creating a copy of the file (in this case, in decrypted form), and not
actually overwriting the file. You must remember to decrypt not only the database file, but also the associated
log files, and dbspaces. See “CREATE DECRYPTED FILE statement” [SQL Anywhere Server - SQL
Reference].
Caution
For strongly encrypted databases, be sure to store a copy of the key in a safe location. If you lose the
encryption key there is no way to access the data, even with the assistance of technical support. The database
must be discarded and you must create a new database.
You can change the encryption key for an encrypted database, or for a database for which table encryption
has been enabled, using the CREATE ENCRYPTED FILE statement. As with encrypting the database, you
are not overwriting the existing file, you are creating a copy of the file, encrypted with the new key.
To change the encryption key for a database
1. Change the encryption key for an encrypted database using the CREATE ENCRYPTED FILE statement.
The following example takes the database file currentkey.db, encrypted with key abc, and creates a copy
of it called newkey.db, encrypting it with the key abc123.
CREATE ENCRYPTED FILE newkey.db
FROM currentkey.db
KEY abc123
See also
● “Reloading databases” [SQL Anywhere Server - SQL Usage]
● “CREATE DATABASE statement” [SQL Anywhere Server - SQL Reference]
Performance issues
Performance of SQL Anywhere is somewhat slower when the database is encrypted. The performance impact
depends on how often pages are read from or written to disk, and can be minimized by ensuring that the
server is using an adequate cache size.
You can increase the starting size of the cache with the -c option when you start the server. For operating
systems that support dynamic resizing of the cache, the cache size that is used may be restricted by the
amount of memory that is available; to increase the cache size, increase the available memory.
See also
● “Use the cache to improve performance” [SQL Anywhere Server - SQL Usage]
● “-c server option” on page 158
Caution
For strongly encrypted databases, be sure to store a copy of the key in a safe location. If you lose the
encryption key there is no way to access the data, even with the assistance of technical support. The database
must be discarded and you must create a new database.
Encrypted values can be decrypted with the DECRYPT function. You must use the same key that was
specified in the ENCRYPT function. Both of these functions return LONG BINARY values. If you require
a different data type, you can use the CAST function to convert the value to the required data type. The
example below shows how to use the CAST function to convert a decrypted value to the required data type.
See “CAST function [Data type conversion]” [SQL Anywhere Server - SQL Reference].
If database users need to access the data in decrypted form, but you do not want them to have access to the
encryption key, you can create a view that uses the DECRYPT function. This allows users to access the
decrypted data without knowing the encryption key. If you create a view or stored procedure that uses the
table, you can use the SET HIDDEN parameter of the ALTER VIEW and ALTER PROCEDURE statements
to ensure that users cannot access the encryption key by looking at the view or procedure definition. See
“ALTER PROCEDURE statement” [SQL Anywhere Server - SQL Reference] and “ALTER VIEW
statement” [SQL Anywhere Server - SQL Reference].
Two triggers are added to the database to encrypt the value in the user_pwd column, either when a new user
is added or an existing user's password is updated.
● The encrypt_new_user_pwd trigger fires each time a new row is added to the user_info_table:
CREATE TRIGGER encrypt_new_user_pwd
BEFORE INSERT
ON user_info
REFERENCING NEW AS new_pwd
FOR EACH ROW
BEGIN
If you issue a SELECT statement to view the information in the user_info table, the value in the user_pwd
column is binary data (the encrypted form of the password) and not the value abc123 that was specified in
the INSERT statement.
If this user's password is changed:
UPDATE user_info
SET user_pwd='xyz'
WHERE employee_ID='1';
the encrypt_updated_pwd trigger fires and the encrypted form of the new password appears in the user_pwd
column.
The original password can be retrieved by issuing the following SQL statement. This statement uses the
DECRYPT function and the encryption key to decrypt the data, as well as the CAST function to convert the
value from a LONG BINARY to a CHAR value:
SELECT CAST (
DECRYPT( user_pwd, '8U3dkA' )
AS CHAR(100))
FROM user_info
WHERE employee_ID = '1';
See also
● “ENCRYPT function [String]” [SQL Anywhere Server - SQL Reference]
● “DECRYPT function [String]” [SQL Anywhere Server - SQL Reference]
Table encryption
Table encryption allows you to encrypt tables or materialized views with sensitive data without the
performance impact that encrypting the entire database might cause. When table encryption is enabled, table
pages for the encrypted table, associated index pages, and temporary file pages are encrypted, as well as the
transaction log pages that contain transactions on encrypted tables.
For information about encrypting materialized views, see “Encrypting and decrypting materialized
views” [SQL Anywhere Server - SQL Usage].
To encrypt tables in your database, you must have table encryption enabled. Enabling table encryption must
be done at database initialization. To see whether table encryption is enabled, query the EncryptionScope
database property using the DB_PROPERTY function, as follows:
For a list of supported encryption algorithms, see “Encrypting a database” on page 965.
For encrypted tables, each table page is encrypted when written to the disk, and is decrypted when read in
from the disk. This process is invisible to applications. However, there may be a slight negative impact on
performance when reading from, or writing to, encrypted tables. Encrypting or decrypting existing tables
can take a long time, depending on the size of the table.
Index pages for indexes on columns in an encrypted table are also encrypted, as are transaction log pages
containing transactions on the encrypted table, as well as all pages in the temporary file for the database. All
other database and transaction log pages are unencrypted.
Encrypted tables can contain compressed columns. In this case, the data is compressed before it is encrypted.
Encrypting tables does not impact storage requirements.
Later, when you encrypt a table in this database, the simple encryption algorithm is used.
Later, when you encrypt a table in this database, the AES256_FIPS algorithm is used, as well as the key
abc.
Later, when you encrypt a table in this database, the simple encryption algorithm is used.
Later, when you encrypt a table in this database, the AES256_FIPS algorithm is used, as well as the key
abc.
See also
● “Initialization utility (dbinit)” on page 703
● “CREATE DATABASE statement” [SQL Anywhere Server - SQL Reference]
● “Creating databases (Sybase Central)” on page 14
Encrypting tables
To encrypt tables in your database, table encryption must already be enabled in the database.
When you encrypt a table, the table encryption settings that were specified at database creation time, such
as simple, AES, FIPS, and so on, are applied to the table.
To encrypt a table at table creation
● Create a table using the ENCRYPTED clause of the CREATE TABLE statement.
The following command creates an encrypted table named MyEmployees:
See also
● “Encrypting a database” on page 965
● “Enabling table encryption” on page 972
● “CREATE TABLE statement” [SQL Anywhere Server - SQL Reference]
● “ALTER TABLE statement” [SQL Anywhere Server - SQL Reference]
If you are storing sensitive data on your Windows Mobile device, you may want to use the security features
provided for your Windows Mobile device.
For more information on available security features, see the User's Manual provided with your Windows
Mobile device.
Server options allow you to control who can perform certain operations on the server.
These options are set in the Options field of the Server Startup Options window when you start the database
on your Windows Mobile device.
For more information, see “Controlling permissions from the command line” on page 40.
For information on setting options on Windows Mobile, see “Specifying server options on Windows
Mobile” on page 1071.
Auditing
This feature uses the transaction log to maintain a detailed record of actions on the database.
The Log Translation utility (dbtran) is used to translate the information stored in the transaction log, including
auditing information. The dbtran utility is not supported on Windows Mobile, so you cannot translate a log
stored on a Windows Mobile device. Copy the transaction log file to your PC to use this utility.
For more information, see “Auditing database activity” on page 958.
Database encryption features allow you to choose the level of database encryption. You can choose to secure
your database either with simple encryption, or with strong encryption. SQL Anywhere supports both simple
and strong encryption on Windows Mobile.
Simple encryption This level of encryption is equivalent to obfuscation and makes it more difficult for
someone using a disk utility to look at the file to decipher the data in your database. Simple encryption does
not require a key to encrypt the database.
Simple encryption technology is supported in previous versions of SQL Anywhere.
Strong encryption This level of encryption scrambles the information contained in your database and
transaction log files so they cannot be deciphered simply by looking at the files using a disk utility. Strong
encryption renders the database completely inaccessible without the key. On Windows Mobile, the
AES_FIPS and AES256_FIPS algorithms are only supported with ARM processors.
For more information, see “Encrypting a database” on page 965.
You can encrypt client/server communications for greater security as they pass over the network. SQL
Anywhere provides two types of communication encryption: simple and strong.
Simple communication encryption accepts communication packets that are encrypted with simple
encryption. This level of communication encryption is supported on all platforms, including Windows
Mobile and on previous versions of SQL Anywhere.
Strong communication encryption is not available on Windows Mobile.
For more information about encrypting communications, see “Encryption connection parameter
[ENC]” on page 266.
Transport-layer security
Contents
Introduction to transport-layer security ...................................................................... 978
Setting up transport-layer security ............................................................................. 981
Creating digital certificates ........................................................................................ 983
Encrypting SQL Anywhere client/server communications ......................................... 989
Encrypting SQL Anywhere web services ................................................................... 994
Encrypting MobiLink client/server communications ................................................... 995
Certificate utilities .................................................................................................... 1002
Transport-layer security, an IETF standard protocol, secures client/server communications using digital
certificates and public-key cryptography. Transport-layer security enables encryption, tamper detection, and
certificate-based authentication.
You can use transport-layer security to:
● Secure communications between the SQL Anywhere database server and client applications.
● Secure communications between the MobiLink server and MobiLink clients.
● Set up a secure SQL Anywhere web server.
Efficiency
The transport-layer security protocol uses a combination of public-key and symmetric key encryption.
Public-key encryption provides better authentication techniques, but is computationally intensive. Once a
secure connection is established, the client and server use a highly efficient symmetric cipher with 128-bit
key size for the rest of their communication.
Certificates
SQL Anywhere includes a tool called createcert that allows you to create X.509 certificate files for transport-
layer security. However, if you need to verify the existence of third-party certificates, or if you need more
secure certificates, you can purchase the certificates from certificate authorities.
TLS support
This topic details the support for RSA, ECC, and FIPS encryption.
RSA encryption
RSA encryption is provided free with SQL Anywhere and can be used for client/server communication,
synchronization, and web services. The free version is not FIPS-certified. To implement FIPS-certified RSA
encryption, you need a separate license.
For a list of supported platforms for RSA, see SQL Anywhere Supported Platforms and Engineering Support
Status.
ECC encryption
To implement ECC encryption, you need a separate license.
For a list of supported platforms for ECC, see SQL Anywhere Supported Platforms and Engineering Support
Status.
FIPS-approved encryption
FIPS is only available for RSA encryption. (ECC is not yet covered by the FIPS program.)
FIPS technology requires a separate license. See “Separately licensed components” [SQL Anywhere 11 -
Introduction].
For a list of supported platforms for FIPS, see SQL Anywhere Supported Platforms and Engineering Support
Status.
Enforcing FIPS
Optionally, you can enforce the use of FIPS with a FIPS option. When you set the FIPS option to on, all
secure communications must be over FIPS-approved channels. If someone tries to use non-FIPS RSA, it is
automatically upgraded to FIPS RSA. If ECC is selected, an error is reported (ECC does not support FIPS).
You must set the FIPS option for each computer on which you want FIPS to be enforced. SQL Anywhere
and MobiLink servers have a -fips command line option, and clients have a fips option that can be set with
the encryption parameter.
For information about encrypting SQL Anywhere database files with FIPS technology, see “Strong
encryption” on page 965.
● sybase.public.sqlanywhere.ultralite
● ianywhere.public.sqlanywhere.qanywhere
Certificate configurations
The certificate can be self-signed or signed by a commercial or enterprise Certificate Authority.
● Self-signed certificates Self-signed server certificates can be used for simple setups. See “Self-
signed root certificates” on page 983.
● Enterprise root certificates An enterprise root certificate can be used to sign server certificates to
improve data integrity and extensibility for multi-server deployments.
○ You can store the private key used to sign server certificates in a secure central location.
○ For server authentication, you can add MobiLink or database servers without reconfiguring clients.
Tip
Use enterprise level certificate chains or commercial certificate authorities if you require multiple server
identity files. Certificate authorities provide extensibility and a higher level of certificate integrity with
dedicated facilities to store root private keys.
For more information about setting up certificate chains, see “Certificate chains” on page 984.
● Certificate For server authentication certificates, the self-signed certificate is distributed to clients.
It is an electronic document including identity information, the public key of the server, and a self-signed
digital signature.
● Identity file For server authentication certificates, the identity file is stored securely with a MobiLink
or database server. It is a combination of the self-signed certificate (that is distributed to clients) and the
corresponding private key. The private key gives the MobiLink or database server the ability to decrypt
messages sent by the client in the initial handshake.
See also
● “Server authentication” on page 997
● “Starting the database server with transport-layer security” on page 989
● “Certificate Creation utility (createcert)” on page 679
Certificate chains
If you require multiple identity files, you can improve security and extensibility by using certificate chains
instead of self-signed certificates. Certificate chains require a Certificate Authority or an enterprise root
certificate to sign identities.
See “Self-signed root certificates” on page 983.
The following diagram provides the basic enterprise root certificate architecture.
You can also use a third-party Certificate Authority to sign your server certificates. Commercial Certificate
Authorities have dedicated facilities to store private keys and create high-quality server certificates.
See also
● “Certificate Creation utility (createcert)” on page 679
● “Globally-signed certificates” on page 986
To set up enterprise root certificates, you create the enterprise root certificate and the enterprise private key
that you use to sign identities.
For information about creating server certificates, see “Signed identity files” on page 986.
For information about generating enterprise root certificates, see “Globally-signed
certificates” on page 986.
Globally-signed certificates
A commercial Certificate Authority is an organization that is in the business of creating high-quality
certificates and using these certificates to sign your certificate requests.
Globally-signed certificates have the following advantages:
● In the case of inter-company communication, common trust in an outside, recognized authority may
increase confidence in the security of the system. A Certificate Authority must guarantee the accuracy
of the identification information in any certificate that it signs.
● Certificate Authorities provide controlled environments and advanced methods to generate certificates.
● The private key for the root certificate must remain private. Your organization may not have a suitable
place to store this crucial information, whereas a Certificate Authority can afford to design and maintain
dedicated facilities.
You reference the server identity file and the password for the private key on the dbsrv11 or mlsrv11
command line.
See also
● SQL Anywhere: “Starting the database server with transport-layer security” on page 989
● MobiLink: “Starting the MobiLink server with transport-layer security” on page 996
For more information about configuring MobiLink clients to trust server certificates, see “Configuring
MobiLink clients to use transport-layer security” on page 997.
For more information about configuring the database server to use transport-layer security, see “Starting the
database server with transport-layer security” on page 989.
For more information about using globally-signed certificates to establish trust, see “Globally-signed
certificates” on page 986.
See also
● “Encrypting SQL Anywhere web services” on page 994
-ec tls(
tls_type=cipher;
identity=server-identity-filename;
identity_password=password )
-x tcpip
● cipher The cipher to use. The cipher can be rsa or ecc for RSA and ECC encryption, respectively.
For FIPS-approved RSA encryption, specify tls_type=rsa;fips=y. RSA FIPS uses a separate approved
library, but is compatible with SQL Anywhere 9.0.2 or later clients using RSA.
For a list of supported platforms for FIPS, see SQL Anywhere Supported Platforms and Engineering
Support Status.
The cipher must match the encryption (ECC or RSA) used to create your certificates.
For information about enforcing the FIPS-approved algorithm, see “-fips server option” on page 176.
● server-identity-filename The path and file name of the server identity file. If you are using FIPS-
approved RSA encryption, you must generate your certificates using the RSA cipher.
An identity file contains the public certificate and its private key. For certificates that are not self signed,
the identity file also contains all of the signing certificates.
For more information about creating the server certificate, which can be self-signed, or signed by a
Certificate Authority or enterprise root certificate, see “Creating digital certificates” on page 983.
● password The password for the server private key. You specify this password when you create the
server certificate.
You can also start the database server with simple encryption. Simple encryption makes it more difficult for
someone using a packet sniffer to read the network packets sent between the client and the server, but does
not assure data integrity or provide server authentication.
See “-ec server option” on page 170 and “-es server option” on page 174.
You specify the TCP/IP protocol using the -x server option. See “-x server option” on page 222.
Examples
The following example (entered all on one line) uses the -ec server option to specify ECC security, the server
identity file, and the password protecting the server's private key:
dbsrv11 -ec tls( tls_type=ecc;identity=c:\test
\serv1_ecc.id;identity_password=mypwd )
-x tcpip c:\test\secure.db
You can hide the command line options, including passwords, using a configuration file and the File Hiding
utility (dbfhide). See “File Hiding utility (dbfhide)” on page 698 and “@data server option” on page 156.
The following example (entered all on one line) uses the -ec server option to specify RSA security, the server
identity, and the password protecting the server's private key:
dbsrv11 -ec tls(tls_type=rsa;identity=c:\test
\serv1_rsa.id;identity_password=test)
-x tcpip c:\test\secure.db
Server authentication
Server authentication allows a remote client to verify the identity of a database server. Digital signatures
and certificate field verification work together to achieve server authentication.
Digital signatures
A database server certificate contains one or more digital signatures used to maintain data integrity and
protect against tampering. Following are the steps used to create a digital signature:
● An algorithm performed on a certificate generates a unique value or hash.
● The hash is encrypted using a signing certificate's or Certificate Authority's private key.
● The encrypted hash, called a digital signature, is embedded in the certificate.
A digital signature can be self-signed or signed by an enterprise root certificate or Certificate Authority.
When a client application contacts a database server, and each is configured to use transport-layer security,
the server sends the client a copy of its certificate. The client decrypts the certificate's digital signature using
the server's public key included in the certificate, calculates a new hash of the certificate, and compares the
two values. If the values match, this confirms the integrity of the server's certificate.
If you are using FIPS-approved RSA encryption, you must generate your certificates using RSA.
For more information about self-signed certificates, see “Self-signed root certificates” on page 983.
For more information about enterprise root certificates and Certificate Authorities, see “Certificate
chains” on page 984.
For more information about client-side encryption connection parameters, see “Encryption connection
parameter [ENC]” on page 266.
Encryption=tls(
tls_type=cipher;
[ fips={ y | n }; ]
trusted_certificates=public-certificate)
● cipher can be rsa or ecc for RSA and ECC encryption, respectively. For FIPS-approved RSA
encryption, specify tls_type=rsa;fips=y. RSA FIPS uses a separate approved library, but is compatible
with SQL Anywhere 9.0.2 or later servers using RSA.
The connection fails if the cipher does not match the encryption (RSA or ECC) used to create your
certificates.
● public-certificate is the path and file name of a file that contains one or more trusted certificates. If
you are using FIPS-approved RSA encryption, you must generate your certificates using RSA.
For more information about trusted_certificates and other client security parameters, see “Client security
options” on page 991.
For more information about creating or obtaining the certificate, see “Creating digital
certificates” on page 983.
For more information about the encryption connection parameter, see “Encryption connection parameter
[ENC]” on page 266.
Example
The following example uses the trusted_certificates encryption connection parameter to specify the
certificate, public_cert.crt.
"UID=DBA;PWD=sql;ENG=myeng;LINKS=tcpip;
ENC=tls(tls_type=ecc;trusted_certificates=public_cert.crt)"
The following example uses the trusted_certificates encryption connection parameter to specify the
certificate, public_cert.crt, and verifies certificate fields using the certificate_unit and certificate_name
encryption connection parameters.
"UID=DBA;PWD=sql;ENG=myeng;LINKS=tcpip;
ENC=tls(tls_type=ecc;trusted_certificates=public_cert.crt;
certificate_unit=test_unit;certificate_name=my_certificate)"
-xs protocol(
[ fips={ y | n }; ]
identity=server-identity-filename;
identity_password=password;... ) ...
○ protocol can be https, or https with fips=y for FIPS-approved RSA encryption. FIPS-approved
HTTPS uses a separate approved library, but is compatible with HTTPS.
Note
The Mozilla Firefox browser can connect when FIPS-approved HTTPS is used. However, the cipher
suite used by FIPS-approved HTTPS is not supported by most versions of the Internet Explorer,
Opera, or Safari browsers—if you are using FIPS-approved HTTPS, these browsers may not be able
to connect.
For information about enforcing the FIPS-approved algorithm, see “-fips server
option” on page 176.
○ server-identity-filename The path and file name of the server identity. For HTTPS, you must use
an RSA certificate.
○ password The password for the server private key. You specify this password when you create
the server certificate.
For more information about the -xs server option, see “-xs server option” on page 225.
For more information about the identity and identity_password parameters, see:
○ “Identity protocol option” on page 293
○ “Identity_Password protocol option” on page 294
● Configure web clients Configure browsers or other web clients to trust certificates. The trusted
certificate can be self-signed, an enterprise root, or a Certificate Authority certificate.
For general information about creating digital certificates, including information about using Certificate
Authorities, see “Creating digital certificates” on page 983.
End-to-end encryption
End-to-end encryption occurs when data is encrypted at the point of origin and decrypted at the final
destination. There is no point during transmission that the data is unencrypted.
MobiLink TLS is sometimes only used to encrypt data up to an intermediary (for example, encryption/
decryption hardware) between the client and server. At the intermediary, the data would be decrypted and
then encrypted again by the intermediary for the rest of the journey. Notably, this happens when
synchronizing via HTTPS through a Web server. The brief interval when the data is unencrypted in the
intermediary is sometimes called the Wireless Application Protocol gap or WAP Gap.
Within a corporation, a WAP gap is often acceptable when the intermediary is within corporate control.
However, in a third-party hosted environment where data from different corporations is going through the
same WAP gap, sensitive data may be exposed. End-to-end encryption prevents any intermediary from
accessing the data because the synchronization stream is encrypted from start to finish, and may optionally
be encrypted once more with TLS.
-x protocol(
tls_type=cipher;
fips={ y | n };
identity=identity-file;
identity_password=password;... )
● protocol The protocol to use. It can be https or tls. The tls protocol is TCP/IP with TLS.
● cipher The cipher to use. It can be rsa or ecc for RSA and ECC encryption, respectively. The cipher
must match the encryption used to create your identity.
● fips Indicates whether or not to use FIPS. FIPS can only be used with RSA encryption. RSA FIPS
uses separate FIPS 140-2 certified software from Certicom. Servers using FIPS are compatible with
clients not using FIPS and vice versa. RSA FIPS can be used for SQL Anywhere clients on any supported
32-bit Windows platform or Solaris, or for UltraLite clients on Unix or any supported 32-bit Windows
platform including Windows Mobile.
● identity-file The path and file name of the identity file, which contains the server's private key, the
server's certificate, and, optionally, the certificates signed by the Certificate Authority.
For information about creating the server certificate, which can be self-signed, or signed by a Certificate
Authority or enterprise root certificate, see “Creating digital certificates” on page 983.
● password The password for the server private key. You specify this password when you create the
server identity.
Examples
The following example specifies the type of security (RSA), the server identity file, and the identity password
protecting the server's private key on the mlsrv11 command line:
mlsrv11 -c "dsn=my_cons"
-x tls(tls_type=rsa;identity=c:\test\serv_rsa1.crt;identity_password=pwd)
The following example specifies an ECC identity on the mlsrv11 command line:
mlsrv11 -c "dsn=my_cons"
-x tls(tls_type=ecc;identity=c:\test\serv_ecc1.crt;identity_password=pwd)
The following example is similar to the previous, except that there is a space in the identity file name:
mlsrv11 -c "dsn=my_cons"
-x "tls(tls_type=rsa;identity=c:\Program Files\test
\serv_rsa1.crt;identity_password=pwd)"
For more information about the mlsrv11 -x option, see “-x option” [MobiLink - Server Administration].
For more information about creating the server identity file, in this case serv_ecc1.crt, see “Creating digital
certificates” on page 983.
You can hide the command line options using a configuration file and the File Hiding utility (dbfhide). See
“@data option” [MobiLink - Server Administration].
Server authentication
Server authentication allows a remote client to verify the identity of a server. Digital signatures and certificate
field verification work together to achieve server authentication.
Digital signatures
A server certificate contains one or more digital signatures used to maintain data integrity and protect against
tampering. Following are the steps used to create a digital signature:
● An algorithm performed on a certificate generates a unique value or hash.
● The hash is encrypted using a signing certificate's or Certificate Authority's private key.
● The encrypted hash, called a digital signature, is embedded in the certificate.
A digital signature can be self-signed or signed by an enterprise root certificate or Certificate Authority.
When a MobiLink client contacts a MobiLink server, and each is configured to use transport-layer security,
the server sends the client a copy of its certificate. The client decrypts the certificate's digital signature using
the server's public key included in the certificate, calculates a new hash of the certificate, and compares the
two values. If the values match, this confirms the integrity of the server's certificate.
For more information about self-signed certificates, see “Self-signed root certificates” on page 983.
For more information about enterprise root certificates and Certificate Authorities, see “Certificate
chains” on page 984.
For more information about creating digital certificates, see “Creating digital certificates” on page 983.
MobiLink clients use the trusted_certificates protocol option to specify trusted MobiLink server certificates.
The trusted certificate can be a server's self-signed certificate, a public enterprise root certificate, or the
certificate belonging to a commercial Certificate Authority.
See:
● “trusted_certificates” [MobiLink - Client Administration]
● “Creating digital certificates” on page 983
MobiLink transport-layer security is an inherent feature of the MobiLink HTTPS and TCP/IP protocols. To
use transport-layer security over HTTPS, specify the trusted_certificates connection parameter using the
ADR extended option. Following is the syntax for a partial dbmlsync command line.
-e "ctp=protocol;
adr=[ fips={ y | n }; ]
trusted_certificates=public-certificate;
..."
● protocol The protocol to use. It can be https or tls. The tls protocol is TCP/IP using transport-layer
security.
● fips Indicates whether or not to use FIPS. FIPS can only be used with RSA encryption. FIPS-approved
HTTPS uses separate FIPS 140-2 certified software from Certicom, but is compatible with version 9.0.2
or later MobiLink servers using HTTPS.
● public-certificate The path and file name of a trusted certificate.
For HTTPS or FIPS-approved HTTPS, you must use certificates created using RSA encryption.
See also
● “Client security options” on page 998
● “Creating digital certificates” on page 983
● “CommunicationAddress (adr) extended option” [MobiLink - Client Administration]
● “MobiLink client network protocol option summary” [MobiLink - Client Administration]
● “CREATE SYNCHRONIZATION SUBSCRIPTION statement [MobiLink]” [SQL Anywhere Server -
SQL Reference]
● “ALTER SYNCHRONIZATION SUBSCRIPTION statement [MobiLink]” [SQL Anywhere Server -
SQL Reference]
Examples
The following example specifies RSA security over HTTPS. It must all be written on one line:
dbmlsync -c "eng=rem1;uid=dba;pwd=mypwd"
-e "ctp=https;
adr='trusted_certificates=c:\temp\public_cert.crt;
certificate_company=Sybase, Inc.;
certificate_unit=IAS;
certificate_name=MobiLink'"
Alternatively, you can specify the CommunicationAddress extended option using the CREATE
SYNCHRONIZATION SUBSCRIPTION or ALTER SYNCHRONIZATION SUBSCRIPTION statement.
This method provides the same information, but stores it in the database.
The following example specifies RSA security and TCP/IP. It must all be written on one line:
dbmlsync -c "eng=rem1;uid=myuid;pwd=mypwd"
-e "ctp=tls;
adr='port=3333;
tls_type=rsa;
trusted_certificates=c:\test\public_cert.crt;
certificate_company=Sybase, Inc.;
certificate_unit=IAS;
certificate_name=MobiLink'"
Alternatively, you can specify the CommunicationAddress extended option using the CREATE
SYNCHRONIZATION SUBSCRIPTION or ALTER SYNCHRONIZATION SUBSCRIPTION statement:
● Using the trusted_certificates protocol option For details, see Step 3 of this procedure. This
option is not available on Palm OS.
2. Specify the TCP/IP or HTTPS protocol for synchronization. The keyword for secure TCP/IP is tls.
The following example is in C/C++ UltraLite. To specify tls, change https to tls.
auto ul_synch_info synch_info;
conn.InitSynchInfo( &synch_info );
synch_info.user_name = UL_TEXT( "50" );
synch_info.version = UL_TEXT( "ul_default" );
...
synch_info.stream = "https";
...
3. Specify TCP/IP or HTTPS protocol options.
The following example is in C/C++ UltraLite. To specify tls, change https to tls.
auto ul_synch_info synch_info;
...
synch_info.stream = "https";
synch_info.stream_parms = TEXT(
"port=9999;
certificate_company=Sybase, Inc.;
certificate_unit=IAS;
certificate_name=MobiLink");
The certificate_company, certificate_unit, and certificate_name protocol options are used to verify
certificate fields.
See “Verifying certificate fields” on page 998.
You can also specify the trusted_certificates HTTPS protocol option, which overrides any trusted
certificate information embedded in the UltraLite database (Step 1 of this procedure). The
trusted_certificates protocol option is not available on Palm OS.
auto ul_synch_info synch_info;
...
synch_info.stream = "https";
synch_info.stream_parms = TEXT(
"port=9999;
trusted_certificates=\rsaroot.crt;
certificate_company=Sybase, Inc.;
certificate_unit=IAS;
certificate_name=MobiLink");
For more information about HTTPS options, see “Network protocol options for UltraLite
synchronization streams” [UltraLite - Database Management and Reference].
Certificate utilities
Users may typically go to a third party to purchase certificates. These certificate authorities provide their
own tools for creating certificates. The following tools may be especially useful to create certificates for
development and testing purposes, and can also be used for production certificates.
See:
● “Certificate Creation utility (createcert)” on page 679
● “Certificate Viewer utility (viewcert)” on page 682
Contents
Open Clients, Open Servers, and TDS ................................................................... 1006
Setting up SQL Anywhere as an Open Server ........................................................ 1008
Configuring Open Servers ....................................................................................... 1010
Characteristics of Open Client and jConnect connections ...................................... 1016
Open Clients and Open Servers exchange information using an application protocol called the tabular data
stream (TDS). All applications built using the Sybase Open Client libraries are also TDS applications
because the Open Client libraries handle the TDS interface. However, some applications (such as jConnect)
are TDS applications even though they do not use the Sybase Open Client libraries—they communicate
directly using the TDS protocol.
While many Open Servers use the Sybase Open Server libraries to handle the interface to TDS, some
applications have a direct interface to TDS of their own. Sybase Adaptive Server Enterprise and SQL
Anywhere both have internal TDS interfaces. They appear to client applications as an Open Server, but do
not use the Sybase Open Server libraries.
OmniConnect support
Sybase OmniConnect provides a unified view of disparate data within an organization, allowing users to
access multiple data sources without having to know what the data looks like or where to find it. In addition,
OmniConnect performs heterogeneous joins of data across the enterprise, enabling cross-platform table joins
of targets such as DB2, Sybase Adaptive Server Enterprise, Oracle, and VSAM.
Using the Open Server interface, SQL Anywhere can act as a data source for OmniConnect.
System requirements
There are separate requirements at the client and server for using SQL Anywhere as an Open Server.
Server-side requirements
You must have the following elements at the server side to use SQL Anywhere as an Open Server:
● SQL Anywhere server components You must use the network server (dbsrv11.exe) if you want
to access an Open Server over a network. You can use the personal server (dbeng11.exe) as an Open
Server only for connections from the same computer.
● TCP/IP You must have a TCP/IP protocol stack to use SQL Anywhere as an Open Server, even if you
are not connecting over a network.
Client-side requirements
You need the following elements to use Sybase client applications to connect to an Open Server (including
SQL Anywhere):
● Open Client components The Open Client libraries provide the network libraries your application
needs to communicate via TDS if your application uses Open Client.
● jConnect If your application uses JDBC, you need jConnect and a Java runtime environment. SQL
Anywhere supports jConnect 5.5 and 6.0.5, both of which are available at: http://www.sybase.com/
products/informationmanagement/softwaredeveloperkit/jconnect.
● DSEdit You need DSEdit, the directory services editor, to make server names available to your Open
Client application. On Unix platforms, this utility is called sybinit.
DSEdit is not included with SQL Anywhere, but is included with Open Server software.
You can use the personal database server as an Open Server for communications on the same computer
because it supports the TCP/IP protocol.
The server can serve other applications through the TCP/IP protocol or other protocols using the SQL
Anywhere-specific application protocol at the same time as serving Open Client applications over TDS.
Port numbers
Every application using TCP/IP on a computer uses a distinct TCP/IP port so that network packets end up
at the right application. The default port for SQL Anywhere is port 2638. It is recommended that you use
the default port number as SQL Anywhere has been granted that port number by the Internet Assigned
Numbers Authority (IANA). If you want to use a different port number, you can specify which one using
the ServerPort (PORT) protocol option:
dbsrv11 -x tcpip(ServerPort=2629) -n myserver c:\mydata.db
You may also need to supply a ServerName if more than one local database server is running, or if you want
to connect to a network server.
Starting DSEdit
The DSEdit executable is located in the SYBASE\bin directory, which is added to your path on installation.
When you start DSEdit, the Select Directory Service window appears.
You can add, modify, or delete entries for servers, including SQL Anywhere servers, in the
InterfacesDriver window.
3. Click Add.
4. From the Protocol list, select NLWNSCK (this is the TCP/IP protocol).
5. In the Network Address field, type a valid network address. For TCP/IP addresses, use one of the
following two forms:
● computer name, port number
● IP-address, portnumber
The address or computer name is separated from the port number by a comma.
Computer name A name (or an IP address) identifies the computer on which the server is running.
On Windows operating systems, you can find the computer name in Network Settings, in the Control
Panel.
If your client and server are on the same computer, you must still enter the computer name. In this case,
you can use localhost to identify the current computer.
Port number The port number you enter must match the port number you used to start the SQL
Anywhere database server. See “Starting the database server as an Open Server” on page 1008.
The default port number for SQL Anywhere servers is 2638. This number has been assigned to SQL
Anywhere by the Internet Adapter Number Authority (IANA), and use of this port is recommended
unless you have good reasons for explicitly using another port.
The following are valid server address entries:
elora,2638
123.85.234.029,2638
6. Click OK.
To ping a server
1. Ensure that the database server is running.
2. In the Server box of the DSEdit session window, click the server entry.
3. From the Server Object menu, choose Ping Server.
4. Select the address you want to ping and click Ping.
A window appears, notifying you whether or not the connection is successful. A window for a successful
connection states that both open connection and close connection succeeded.
Default settings
The database options set on connection using TDS include:
Option Set to
allow_nulls_by_default Off
ansi_blanks On
ansinull Off
chained Off
close_on_endtrans Off
date_format YYYY-MM-DD
date_order MDY
escape_character Off
isolation_level 1
on_tsql_error Continue
quoted_identifier Off
time_format HH:NN:SS.SSS
tsql_variables On
The procedure sets options only for connections that use the TDS communications protocol. This includes
Open Client and JDBC connections using jConnect. Other connections (ODBC and embedded SQL) have
the default settings for the database.
You can change the options for TDS connections.
To change the option settings for TDS connections
1. Create a procedure that sets the database options you want. For example, you could use a procedure such
as the following:
CREATE PROCEDURE my_startup_procedure()
BEGIN
IF CONNECTION_PROPERTY('CommProtocol')='TDS' THEN
SET TEMPORARY OPTION quoted_identifier='Off';
END IF
END;
This particular procedure example changes only the quoted_identifier option from the default setting.
2. Set the login_procedure option to the name of a new procedure:
SET OPTION login_procedure= 'DBA.my_startup_procedure';
Future connections will use the procedure. You can configure the procedure differently for different user
IDs.
For more information about database options, see “Database options” on page 437.
Contents
Introduction to using SQL Anywhere with Replication Server ................................. 1020
Tutorial: Replicate data using Replication Server .................................................... 1023
Configuring databases for Replication Server ......................................................... 1032
Using the LTM ......................................................................................................... 1035
Note
SQL Anywhere includes components that allow you to use SQL Anywhere databases in a Replication Server
system. Replication Server is not included as part of your SQL Anywhere installation.
● Low latency Low latency means a short lag time between data being entered at one database and
being replicated to each database in the system. With Replication Server, replication messages are sent
typically within seconds of being entered at a primary site.
● High volume With near-continuous connections and high performance, Replication Server is
designed for a high volume of replication messages.
● Heterogeneous databases Replication Server supports several leading DBMSs, and allows
mapping of object names during replication, so that support for heterogeneous databases is provided.
dbinit primedb
dbinit repdb
What's next?
Next, you have to start database servers to run the databases.
What's next?
Next, you have to make entries for each of the SQL Anywhere servers in an interfaces file, so Replication
Server can communicate with these database servers.
● The LTM at the primary database This is necessary so you can shut down the LTM properly. Create
an entry named PRIMELTM with address as follows:
○ Protocol NLWNSCK
○ Network address localhost,2640
● Your Replication Server This tutorial assumes you already have the Replication Server Open Server
defined.
What's next?
Next, confirm that the Open Servers are configured properly.
Note
The Open Client isql utility is not the same as the SQL Anywhere Interactive SQL utility.
Alternatively, you can choose File » Run Script, and browse to the file.
Permissions
The rssetup.sql script performs a number of operations, including some permissions management. The
permissions changes made by rssetup.sql are outlined here. You do not have to make these changes yourself.
For replication, ensure that the dbmaint and sa users can access this table without explicitly specifying the
owner. To do this, the table owner user ID must have group membership permissions, and the dbmaint and
sa users must be members of the table owner group. To grant group permissions, you must have DBA
authority.
For example, if the user DBA owns the table, you should grant group permissions to DBA:
GRANT GROUP
TO DBA;
You should then grant the dbmaint and sa users membership in the DBA group. To grant group membership,
you must either have DBA authority or be the group ID.
GRANT MEMBERSHIP
IN GROUP "DBA"
TO dbmaint ;
GRANT MEMBERSHIP
IN GROUP "DBA"
TO sa;
For news to act as part of a replication primary site, you must set REPLICATE to ON for the table using an
ALTER TABLE statement:
ALTER TABLE news
REPLICATE ON
go
This is equivalent to running the sp_setreplicate or sp_setreptable procedure on the table in Adaptive Server
Enterprise. You cannot set REPLICATE ON in a CREATE TABLE statement.
Replication Server allows replication between tables and columns with different names. As a simple example,
however, create a table in the replicate database identical in definition to that in the primary database (except
for REPLICATE, which is not set to ON in the replicate database). The table creation statement for this is:
CREATE TABLE news (
ID INT,
AUTHOR CHAR( 40 ) DEFAULT CURRENT USER,
TEXT CHAR( 255 ),
PRIMARY KEY ( ID, AUTHOR )
)
go
For the tutorial, the CREATE TABLE statement must be exactly the same as that at the primary site.
You must ensure that the users dbmaint and sa can access this table without specifying the owner name.
Also, these user IDs must have SELECT and UPDATE permissions on the table.
If you have changed the dbmaint user ID and password in the rssetup.sql command file, make sure you
replace the dbmaint username and password in this command.
Replication Server does not actually use the primedb database name; instead, the database name is read from
the command line of the PRIMEDB Open Server. You must, however, include a database name in the
CREATE CONNECTION statement to conform to the syntax.
For a full description of the create connection statement, see the chapter "Replication Server Commands"
in Replication Server Reference Manual.
This statement differs from the primary site server statement in that there is no WITH LOG TRANSFER
ON clause in this statement.
If you have changed the dbmaint user ID and password in the rssetup.sql command file, make sure you
replace the dbmaint username and password in this command.
For a full description of the CREATE REPLICATION DEFINITION statement, see Replication Server
Reference Manual.
If you set the qualify_table_owners option to On in the LTM configuration file, you must specify the table
owner in the statement, for all replicating tables.
SQL_pw=sysadmin
RS_source_ds=PRIMEDB
RS_source_db=primedb
RS=your_rep_server_name_here
RS_user=sa
RS_pw=sysadmin
LTM_admin_user=DBA
LTM_admin_pw=sql
LTM_charset=cp850
scan_retry=2
APC_user=sa
APC_pw=sysadmin
SQL_log_files=C:\TUTORIAL
If you have changed the user ID and password in the rssetup.sql command file for sa and sysadmin, you
should use the new user ID and password in this configuration.
To start the SQL Anywhere LTM running on the primary site server, enter the following command:
dbltm -S PRIMELTM -C primeltm.cfg
The connection information is in primeltm.cfg. In this command, PRIMELTM is the server name of the
LTM.
You can find usage information about the SQL Anywhere LTM by typing the following statement:
dbltm -?
You have now completed your installation. Try replicating data to confirm that the setup is working properly.
COMMIT
go
The SQL Anywhere LTM sends only committed changes to the Replication Server. The data change is
replicated next time the LTM polls the transaction log.
Tutorial complete
You have now completed the tutorial.
For a list of language labels, see “Language label values” on page 360.
If you are using the SQL Anywhere Replication Agent with Replication Server 15.0 and Open Client/Open
Server 15.0, the Replication Agent supports table, column, procedure, function, and parameter names up to
128 bytes in length.
The maximum length for identifiers when using the Replication Agent with older versions of Replication
Server and Open Client/Open Server is 30 bytes.
Notes
SQL Anywhere supports data of zero length that is not NULL. However, non-null long varchar and long
binary data of zero length is replicated to a replicate site as NULL.
If a primary table has columns with unsupported data types, you can replicate the data if you create a
replication definition using a compatible supported data type. For example, to replicate a DOUBLE column,
you could define the column as FLOAT in the replication definition.
SQL Anywhere supports two dialects for stored procedures: the Watcom-SQL dialect, based on the draft
ISO/ANSI standard, and the Transact-SQL dialect. You must use Transact-SQL to write stored procedures
for replication.
The following statement prevents the procedure MyProc from acting as a replication source.
ALTER PROCEDURE MyProc
REPLICATE OFF;
You can also use the sp_setreplicate or sp_setrepproc system procedures to set up procedures for replication.
Asynchronous procedures
A procedure called at a replicate site database to update data at a primary site database is an asynchronous
procedure. The procedure performs no action at the replicate site, but rather, the call to the procedure is
replicated to the primary site, where a procedure of the same name executes. This is called an asynchronous
procedure call (APC). The changes made by the APC are then replicated from the primary to the replicate
database in the usual manner.
For information about APCs, see your Replication Server documentation.
ID with associated password, and this user ID (the APC_user) executes the procedure at the primary site.
The APC_user must, therefore, have appropriate permissions at the primary site for each APC that may be
called.
For the full list of available configuration file parameters, see “The LTM configuration file” on page 728.
For more information about character set issues in Replication Server, see the chapter "International
Replication Design Considerations" in the Replication Server Design Guide.
This section provides a brief overview of Open Client/Open Server character set support.
Internationalization files
Files that support data processing in a particular language are called internationalization files. Several types
of internationalization files come with Adaptive Server Enterprise and other Open Client/Open Server
applications.
There is a directory named charsets under your Sybase directory. Charsets has a set of subdirectories,
including one for each character set available to you. Each character set contains a set of files, as described
in the following table
File Description
Charset.loc Character set definition files that define the lexical properties of each character such as
alphanumeric, punctuation, operand, upper- or lowercase.
*.srt Defines the sort order for alphanumeric and special characters.
Notes
Character set In an Open Client/Open Server environment, an LTM should use the same character set
as the data server and Replication Server attached to it.
SQL Anywhere character sets are specified differently than Open Client/Open Server character sets.
Consequently, the requirement is that the SQL Anywhere character set be compatible with the LTM character
set.
Language The locales.dat file in the locales subdirectory of the Sybase release directory contains valid
map settings. However, the LTM output messages in the user interface are currently available in those
languages to which the LTM has been localized.
Sort order All sort orders in your replication system should be the same. You can find the default entry
for your platform in the locales.dat file in the locales subdirectory of the Sybase release directory.
Example
● The following settings are valid for a Japanese installation:
LTM_charset=SJIS
LTM_language=Japanese
After several backups, the directory d:\primelog contains a set of sequential transaction logs. The log
directory should not contain any transaction logs other than the sequence of logs generated by this backup
procedure.
or
For more information, see “delete_old_logs option [MobiLink client] [SQL Remote] [Replication
Agent]” on page 472.
You require DBA authority to change this and other PUBLIC option settings. You must restart the database
for the new setting to take effect. The replicate_all option has no effect on procedures. See “replicate_all
option [Replication Agent]” on page 510.
Example
The following statements connect isql to the LTM PRIMELTM, and shut it down:
isql -SPRIMELTM -UDBA -Psql
1> shutdown
2> go
Contents
Installing SQL Anywhere on a Windows Mobile device ........................................... 1048
Using the Windows Mobile sample applications ...................................................... 1052
Connecting to a database running on a Windows Mobile device ............................ 1057
Configuring Windows Mobile databases ................................................................. 1062
Running the database server on Windows Mobile .................................................. 1071
Using the administration utilities on Windows Mobile .............................................. 1072
SQL Anywhere feature support on Windows Mobile ............................................... 1079
Caution
It is recommended that you do not install SQL Anywhere on a storage card, such as an SD card.
For more information about ICU, see “Unicode Collation Algorithm (UCA)” on page 363 and “Character
set conversion” on page 356.
For more information about using ADO.NET, see “Tutorial: Using the SQL Anywhere .NET Data
Provider” [SQL Anywhere Server - Programming].
● Unload/reload is not supported You must rebuild the Windows Mobile database on another
platform and then copy the database to the Windows Mobile device. This is the recommended method
for rebuilding a Windows Mobile database. See:
○ “Rebuilding databases on Windows Mobile” on page 1067
○ “Rebuilding databases” [SQL Anywhere Server - SQL Usage]
You can use these applications to access the sample database and examine the capabilities of SQL Anywhere
for Windows Mobile.
You can now connect to the sample database running on your Windows Mobile device from a computer.
When you are finished using the sample database, you must shut down the database server.
Note
In the ADO.NET Sample user interface, SQL statements must be entered on a single line.
8. Type UPDATE Employees SET Surname = 'Jones' WHERE Surname = 'Cobb', and then tap Exec
SQL to execute the SQL statement.
9. Type SELECT * FROM Employees ORDER BY EmployeeID and tap Exec SQL.
Notice that Matthew's last name has been changed from Cobb to Jones.
10. Type UPDATE Employees SET Surname = 'Cobb' WHERE Surname = 'Jones' and then tap Exec
SQL to reverse the change you made to the sample database.
11. Verify that the changes were reversed by typing SELECT * FROM Employees ORDER BY
EmployeeID and then tapping Exec SQL.
Notice that Matthew's last name has been changed back to Cobb.
12. Access data from another table by typing SELECT * FROM Customers, and then tapping Exec
SQL.
All the data from the Customers table appears in the data window, replacing the data from the Employees
table.
13. Shut down the database server by tapping Disconnect.
The ADO.NET Sample disconnects, and the database server automatically shuts down.
14. Close the ADO.NET Sample by tapping x in the top right corner of the window.
Note
In the ESQL Sample user interface, SQL statements must be entered on a single line.
Note
In the ODBC Sample user interface, SQL statements must be entered on a single line.
See also
● “Using the administration utilities on Windows Mobile” on page 1072
4. In the Database field, type the name of the database file that you want to start or click Browse to locate
the database.
5. In the Server Name field, type the server name that you want to use.
6. Select Use TCP/IP.
A TCP/IP connection is necessary to connect from a computer to the database running on your Windows
Mobile device.
7. Tap OK to start the sample database running on the network database server.
Now you can create an ODBC data source to connect from the computer to your Windows Mobile device.
See also
● “Creating an ODBC data source to connect to your Windows Mobile device” on page 1058
For more information about ODBC data sources, see “Working with ODBC data sources” on page 90.
To create an ODBC data source to connect to your Windows Mobile device
1. From the Start menu, choose Programs » SQL Anywhere 11 » ODBC Administrator.
2. On the User DSN tab, click Add.
3. Select SQL Anywhere 11, and then click Finish.
4. On the ODBC tab, in the Data Source Name field, type MobileServer.
5. Click the Login tab, select Supply User ID And Password. Make sure the User ID and Password fields
are blank.
Each time you connect to a database, you must supply a user ID and password.
6. Click the Network tab, select TCP/IP and type the connection parameters.
For example, type Host=169.254.2.1;Port=2638;DoBroadcast=none.
● Host specifies the IP address that the Windows Mobile device listens on.
If you connected a Windows Mobile device using a USB connection, use the default IP address of
169.254.2.1.
For more information, see “Starting a server on your Windows Mobile device” on page 1057.
● Port specifies the port number that the Windows Mobile device listens on. This parameter is
optional.
The proxy port number that is assumed when not specified is 2638.
● DoBroadcast controls how the TCP/IP connection is made. This parameter is optional.
When DoBroadcast=none is specified, the TCP/IP connection is made directly with the port
specified. Use this setting if you created a proxy port to connect to your Windows Mobile device.
When DoBroadcast=direct is specified, no broadcast is performed to the local subnet to search for
a database server. Instead, the Host IP address is required.
For more information, see “DoBroadcast protocol option [DOBROAD]” on page 290.
7. Click OK.
You can now use this data source to connect from a computer to a database running on your Windows Mobile
device.
For more information, see “Using the administration utilities on Windows Mobile” on page 1072.
4. In the Database field, type the name of the database file that you want to start or click Browse to locate
the database.
5. In the Server Name field, type the server name that you want to use.
6. Select Use TCP/IP.
A TCP/IP connection is necessary to connect from a computer to the database running on your Windows
Mobile device.
7. In the Options field, type -z.
With the -z option, the server writes out its IP address during startup. The address may change if you
disconnect your Windows Mobile device from the network and then re-connect it.
For more information, see “-z server option” on page 227.
8. Tap OK to start the sample database running on the network database server.
Now you can create an ODBC data source to connect from the computer to your Windows Mobile device.
For more information, see “Creating an ODBC data source to connect to your Windows Mobile
device” on page 1058.
Note
Do not specify a locale or a sorttype in the tailoring options string when creating a database for use on
Windows Mobile. If you do, it is likely that the will not start on the Windows Mobile device. For more
information about collation tailoring options, see “Collation tailoring options” on page 366.
Because character set translation is not supported on Windows Mobile, you must use either the operating
system character set or UTF-8 for Windows Mobile databases.
You must choose whether you want to install the ICU library when creating your Windows Mobile
database. See “Installation considerations: Using ICU on Windows Mobile” on page 1048.
When you copy an existing database to your Windows Mobile device, you can copy both the database and
transaction log files. If you do not copy the transaction log file to the device, a new transaction log is created
when you start the database on your Windows Mobile device. The new transaction log does not contain the
information contained in the original transaction log. This can be problematic if the database was not shut
down properly the last time it was used, or if the database is involved in synchronization. The best practice
is to copy both the database and the transaction log file to the Windows Mobile device.
See also
● “The transaction log” on page 852
See also
● “Using the jConnect JDBC driver” [SQL Anywhere Server - Programming]
See also
● “Encrypting a database” on page 965
● “Keeping your Windows Mobile database secure” on page 975
● With the Initialization utility (dbinit) to create a database that can be copied manually to your Windows
Mobile device.
● With the CREATE DATABASE statement in Interactive SQL to create a database that can be copied
manually to your Windows Mobile device.
Note
When you run a database on Windows Mobile, the database server automatically turns on checksums. This
helps to provide early detection if the database file becomes corrupt.
For information about decisions you need to make creating a Windows Mobile database, see:
● “Using a transaction log on Windows Mobile” on page 1062
● “Installation considerations: Using ICU on Windows Mobile” on page 1048
● “Installation considerations: Using the .NET Compact Framework on Windows Mobile” on page 1049
Tip
Copy the database to the My Documents directory of your Windows Mobile device to make it simpler
to start the database.
When starting a database on your Windows Mobile device using the Server Startup Options window,
you can only use Browse to search for the database file in the My Documents directory.
If the database is not stored in the My Documents directory, you must type the path of the database in
the Database field of the Server Startup Options window.
Optionally, you can select the Delete The Desktop Database After Copying option.
If you choose not to delete the computer copy, a copy of the database file is stored on your computer in
the directory that you specified in Step 5. Click Next.
9. Specify if you would like to copy the database to your Windows Mobile device.
10. Specify the directory where you want to save the transaction log file. Click Next.
On your Windows Mobile device, the transaction log file is created in the same directory as the database
file when the database is started on the network database server for the first time.
11. Specify whether you want to use a transaction log mirror. Click Next.
12. Clear the Install jConnect Metadata Support option and then click Next.
13. Set the level of encryption for your database by selecting the appropriate option and then click Next.
If you select strong encryption, you must specify an encryption key. It is recommended that you choose
a value for your key that is at least 16 characters long, contains a mix of upper and lowercase, and includes
numbers, letters, and special characters.
Caution
Be sure to store a copy of your key in a safe location. You require the key each time you want to start
or modify the database. A lost key will result in a completely inaccessible database, from which there is
no recovery.
Tip
You can also configure database properties such as encryption and page size using the Initialization
utility. See “Initialization utility (dbinit)” on page 703.
Tip
You can also configure database properties such as encryption and page size using the CREATE
DATABASE statement. See “CREATE DATABASE statement” [SQL Anywhere Server - SQL
Reference].
For information about copying the database to your Windows Mobile device, see “Copying a database
to your Windows Mobile device” on page 1067.
Tip
When starting a database on your Windows Mobile device using the Server Startup Options window,
you can only use Browse to search for the database file in the My Documents directory.
If the database is not stored in the My Documents directory, you must type the path of the database in
the Database field of the Server Startup Options window.
7. Right-click an open area of the Windows Explorer window for your Windows Mobile device and then
choose Paste.
The file is copied to the Windows Mobile device.
The first three options are recommended when upgrading a Windows Mobile database. However, if these
options are not available to you, you can use dbunload on Windows Mobile. Before deciding to use dbunload
on Windows Mobile, you should consider the following implications of using dbunload on Windows Mobile:
● the size of the database server's temporary file (both the unload and reload can cause this file to grow to
several megabytes)
● the extra space required for dbunload and related components
● the extra cost of having multiple copies of a database on the Windows Mobile device
Because running dbunload on a Windows Mobile device can require more resources than some devices have
available, upgrading the database on a different platform is recommended whenever possible.
Note
If you want to run dbunload on a Windows Mobile device, you must choose the Unload/Reload Support
option in the Deploy SQL Anywhere 11 for Windows Mobile Wizard. You can modify your SQL
Anywhere installation to add this support if you did not select this option when you first installed SQL
Anywhere for Windows Mobile.
The following steps can be embedded into third-party Windows Mobile applications so that the process is
automated for the end user. If you choose to do this, then you should consider using the -qc and/or -q dbunload
and dbrunsql options or calling the DBUnload function in dbtool11.dll.
To unload a database on Windows Mobile (dbunload)
1. On a platform other than Windows Mobile, create a new, empty SQL Anywhere 11 database.
The CHAR collation sequence should match that of the existing database. If NCHAR UCA sorting is
not required, the NCHAR collation sequence should be UTF8BIN. In this way, the ICU libraries
(dbicu11.dll, dbicudt11.dll) are not required by the database server.
2. Copy the SQL Anywhere 11 software and the empty SQL Anywhere 11 database file to the Windows
Mobile device. See “Notes about using dbunload on Windows Mobile” on page 1068.
3. Ensure there are no database servers running on the device.
4. Run the following command:
dbunload-path\dbunload -c "UID=DBA;PWD=DBA-
password;CHARSET=none;DBF=existing-database" unload-directory
5. Ensure that dbunload succeeded, and then close the dbunload window.
6. Run the following command:
dbrunsql-path\dbrunsql -c "UID=DBA;PWD=sql;CHARSET=none;DBF=new-empty-
SQLAnywhere11databasefile" -g- \reload.sql
7. Ensure that dbrunsql succeeded, and then close the dbrunsql window.
8. Remove the reload.sql file and unload-directory from the Windows Mobile device.
3. Tap Delete.
4. Tap Yes to confirm the deletion.
For more information, see “Using the administration utilities on Windows Mobile” on page 1072.
The Windows Mobile database server does not start the TCP/IP network link unless it is explicitly requested.
For more information about starting a database server on Windows Mobile, see “Tutorial: Running Windows
Mobile databases from Sybase Central” on page 1072.
On Windows Mobile, attempting to start a second SQL Anywhere database server while a first database
server is already running brings the first server to the foreground. This is standard behavior for Windows
Mobile applications. Because of this behavior, you cannot run two database servers at the same time on a
Windows Mobile device. However, SQL Anywhere supports running multiple databases on a single database
server.
Requirements
● Complete all the tasks in the following sections before you begin the tutorial:
○ “Connecting to a database running on a Windows Mobile device” on page 1057
○ “Creating an ODBC data source to connect to your Windows Mobile device” on page 1058
● Connect your Windows Mobile device to a computer.
Once the wizard finishes copying the Beta.db database file to your Windows Mobile device, you are ready
to begin the tutorial.
4. In the Database field, type the name of the database file that you want to start or tap Browse and locate
the Alpha.db file in the My Documents directory.
Tip
For the purposes of this tutorial, the default cache size is sufficient. However, a larger cache size can
help improve performance for larger databases. See “Use the cache to improve performance” [SQL
Anywhere Server - SQL Usage].
When the message Now accepting requests appears in the database server messages window, you
are ready to proceed to the next lesson.
What's next?
Next, you will learn how to start multiple databases on the network database server on Windows Mobile.
Now that you have started the database server and connected to the Alpha database, you can start additional
databases on your Windows Mobile device.
To start a second database on the network database server
1. In the left pane of Sybase Central, right-click MobileServer and choose Start Database.
2. In the Database File field, type \My Documents\Beta.db.
3. Click OK to start the database on the network database server.
The database is loaded on the network database server. Now you must initiate a connection from your
computer.
To connect to the second database
1. In the right pane of Sybase Central, select the Beta database icon.
2. From the File menu, choose Connect.
3. Click the Identification tab, and complete the following fields:
● User ID DBA
● Password sql
4. Click the Database tab and type Beta in the Database File field.
5. Click OK to connect to the Beta database running on your Windows Mobile device.
You can now view and manipulate the data in the Alpha and Beta databases using Sybase Central.
What's next?
Next, you will learn how to disconnect from the databases and shut down the database server on Windows
Mobile.
Now that you have disconnected from the Windows Mobile databases in Sybase Central, you can shut down
the network database server.
To shut down the server
1. Tap the Database Server icon located in the bottom right corner of the Today screen.
2. Tap Shut Down.
4. In the Database field, type the path of the sample database. The default location is \Program Files
\SQLAny11\demo.db. If you installed the software to a different location, use the Browse button to
locate the database.
5. In the Server Name field, type MobileServer.
6. In the Cache field, type 5MB.
The default cache size on Windows Mobile is 600 KB. However, a larger cache size is recommended
because it can help improve performance.
7. Select Use TCP/IP. This tutorial assumes that you will use the default proxy port number, 2638.
8. Click OK to start the sample database running on the network database server.
The database server messages window appears briefly, then closes.
9. Navigate to the Today screen on your device.
10. Tap the Server icon located in the bottom right corner of the screen.
The database server messages window appears.
When the message Now accepting requests appears in the database server messages window,
you are ready to move on to the next lesson.
What's next?
Next you will learn how to connect from Interactive SQL to the database running on your Windows Mobile
device.
What's next?
You can now view and manage the data in the sample database from Interactive SQL.
Application profiling When you create a tracing session for a database run-
ning on Windows Mobile, you must configure tracing
using the Database Tracing Wizard (you cannot use
the Application Profiling Wizard). As well, you must
trace data from the Windows Mobile device to a copy
of the Windows Mobile database running on a database
server on a desktop computer. You cannot automati-
cally create a tracing database from a Windows Mobile
device, and you cannot trace to the local database on a
Windows Mobile device. See “Application profil-
ing” [SQL Anywhere Server - SQL Usage].
iAnywhere JDBC driver Unsupported on Windows Mobile. You can use jCon-
nect on Windows Mobile.
Personal database server (dbeng11) Only the network database server (dbsrv11) is suppor-
ted on Windows Mobile. This executable supports
local connections and client/server communications
across a network.
This section describes SQL statements that are not supported on Windows Mobile, as well as those that have
altered or limited functionality.
For a complete list of SQL statements, see “SQL statements” [SQL Anywhere Server - SQL Reference].
BACKUP statement Only the BACKUP DATABASE DIRECTORY clause is supported on Win-
dows Mobile.
CREATE DATA- The CREATE DATABASE statement can be used to initialize a database on a
BASE statement computer, which can later be copied to a Windows Mobile device. See “Creating
a Windows Mobile database” on page 1063.
CREATE EVENT DiskSpace event types are not supported on Windows Mobile. However, you
statement can use this statement to define the GlobalAutoIncrement event type or the
ServerIdle event type.
CREATE FUNCTION The CREATE FUNCTION statement can be used on Windows Mobile to create
statement user-defined SQL functions for use in the database. Note that the EXTERNAL
NAME clause is not supported on Windows Mobile.
CREATE TABLE The AT clause of the CREATE TABLE statement for creating proxy tables is
statement not supported on Windows Mobile.
This section describes those database server options that are not supported or have altered functionality on
Windows Mobile.
Option Considerations
Option Considerations
-ec server option Strong communication encryption (TLS) is not supported on Windows Mobile. Only
the none and simple settings are supported. See “-ec server option” on page 170.
-qi server option When running, the network database server appears as an icon in the bottom right
corner of the Today screen on your Windows Mobile device. This feature cannot be
disabled.
The following table lists the Sybase Central wizards that are not supported or have altered functionality on
Windows Mobile and provides alternatives where possible.
Wizard Considerations
Backup Archive backups are not supported on Windows Mobile. The Backup Database Wizard is
Database not supported. See “Types of backup” on page 855.
Wizard
As an alternative on Windows Mobile, you can use the Create Backup Images Wizard,
which makes a separate backup of the database and transaction log files. See “Making a
backup, continuing to use the original transaction log” on page 878.
Create This wizard provides options for creating database on Windows Mobile, provided Windows
Database Mobile services are installed on the computer running Sybase Central. See “Creating a
Wizard Windows Mobile database” on page 1063.
Unload This wizard cannot map to the Windows Mobile directory where the database files are stored.
Database However, you can unload a Windows Mobile database by copying it to your computer and
Wizard using the Unload Database Wizard.
Wizard Considerations
Upgrade This wizard is not supported on Windows Mobile. However, you can upgrade a Windows
Database Mobile database by copying it to your computer and using this wizard before copying the
Wizard database back to your Windows Mobile device. See “Upgrading SQL Anywhere” [SQL
Anywhere 11 - Changes and Upgrading].
Extraction utility (dbxtract) Windows Mobile does not support this utility. If necessary, a Windows
Mobile database can be copied to a computer so that the Extraction utility
can be used.
Glossary
Adaptive Server Anywhere (ASA)
The relational database server component of SQL Anywhere Studio, intended for use in mobile and
embedded environments or as a server for small and medium-sized businesses. In version 10.0.0, Adaptive
Server Anywhere was renamed SQL Anywhere Server, and SQL Anywhere Studio was renamed SQL
Anywhere.
agent ID
article
In MobiLink or SQL Remote, an article is a database object that represents a whole table, or a subset of the
columns and rows in a table. Articles are grouped together in a publication.
See also:
● “replication” on page 1108
● “publication” on page 1105
atomic transaction
A transaction that is guaranteed to complete successfully or not at all. If an error prevents part of an atomic
transaction from completing, the transaction is rolled back to prevent the database from being left in an
inconsistent state.
base table
Permanent tables for data. Tables are sometimes called base tables to distinguish them from temporary
tables and views.
See also:
● “temporary table” on page 1112
● “view” on page 1114
bit array
A bit array is a type of array data structure that is used for efficient storage of a sequence of bits. A bit array
is similar to a character string, except that the individual pieces are 0s (zeros) and 1s (ones) instead of
characters. Bit arrays are typically used to hold a string of Boolean values.
business rule
A guideline based on real-world requirements. Business rules are typically implemented through check
constraints, user-defined data types, and the appropriate use of transactions.
See also:
● “constraint” on page 1090
● “user-defined data type” on page 1114
carrier
A MobiLink object, stored in MobiLink system tables or a Notifier properties file, that contains information
about a public carrier for use by server-initiated synchronization.
See also: “server-initiated synchronization” on page 1110.
character set
A character set is a set of symbols, including letters, digits, spaces, and other symbols. An example of a
character set is ISO-8859-1, also known as Latin1.
See also:
● “code page” on page 1089
● “encoding” on page 1094
● “collation” on page 1089
check constraint
checkpoint
The point at which all changes to the database are saved to the database file. At other times, committed
changes are saved only to the transaction log.
checksum
The calculated number of bits of a database page that is recorded with the database page itself. The checksum
allows the database management system to validate the integrity of the page by ensuring that the numbers
match as the page is being written to disk. If the counts match, it's assumed that page was successfully written.
In QAnywhere, a SQL Anywhere database on the remote device that stores messages.
client/server
A software architecture where one application (the client) obtains information from and sends information
to another application (the server). The two applications often reside on different computers connected by
a network.
code page
A code page is an encoding that maps characters of a character set to numeric representations, typically an
integer between 0 and 255. An example of a code page is Windows code page 1252. For the purposes of this
documentation, code page and encoding are interchangeable terms.
See also:
● “character set” on page 1088
● “encoding” on page 1094
● “collation” on page 1089
collation
A combination of a character set and a sort order that defines the properties of text in the database. For SQL
Anywhere databases, the default collation is determined by the operating system and language on which the
server is running; for example, the default collation on English Windows systems is 1252LATIN1. A
collation, also called a collating sequence, is used for comparing and sorting strings.
See also:
● “character set” on page 1088
● “code page” on page 1089
● “encoding” on page 1094
command file
A text file containing SQL statements. Command files can be built manually, or they can be built
automatically by database utilities. The dbunload utility, for example, creates a command file consisting of
the SQL statements necessary to recreate a given database.
communication stream
In MobiLink, the network protocol used for communication between the MobiLink client and the MobiLink
server.
concurrency
The simultaneous execution of two or more independent, and possibly competing, processes. SQL Anywhere
automatically uses locking to isolate transactions and ensure that each concurrent application sees a
consistent set of data.
See also:
● “transaction” on page 1112
● “isolation level” on page 1098
conflict resolution
In MobiLink, conflict resolution is logic that specifies what to do when two users modify the same row on
different remote databases.
connection ID
A unique number that identifies a given connection between a client application and the database. You can
determine the current connection ID using the following SQL statement:
SELECT CONNECTION_PROPERTY( 'Number' );
connection-initiated synchronization
A form of MobiLink server-initiated synchronization in which synchronization is initiated when there are
changes to connectivity.
See also: “server-initiated synchronization” on page 1110.
connection profile
A set of parameters that are required to connect to a database, such as user name, password, and server name,
that is stored and used as a convenience.
consolidated database
In distributed database environments, a database that stores the master copy of the data. In case of conflict
or discrepancy, the consolidated database is considered to have the primary copy of the data.
See also:
● “synchronization” on page 1112
● “replication” on page 1108
constraint
A restriction on the values contained in a particular database object, such as a table or column. For example,
a column may have a uniqueness constraint, which requires that all values in the column be different. A table
may have a foreign key constraint, which specifies how the information in the table relates to data in some
other table.
See also:
● “check constraint” on page 1088
● “foreign key constraint” on page 1096
● “primary key constraint” on page 1105
● “unique constraint” on page 1113
The act of competing for resources. For example, in database terms, two or more users trying to edit the
same row of a database contend for the rights to edit that row.
correlation name
The name of a table or view that is used in the FROM clause of a query—either its original name, or an
alternate name, that is defined in the FROM clause.
creator ID
cursor
A named linkage to a result set, used to access and update rows from a programming interface. In SQL
Anywhere, cursors support forward and backward movement through the query results. Cursors consist of
two parts: the cursor result set, typically defined by a SELECT statement; and the cursor position.
See also:
● “cursor result set” on page 1091
● “cursor position” on page 1091
cursor position
The set of rows resulting from a query that is associated with a cursor.
See also:
● “cursor” on page 1091
● “cursor position” on page 1091
data cube
A multi-dimensional result set with each dimension reflecting a different way to group and sort the same
results. Data cubes provide complex information about data that would otherwise require self-join queries
and correlated subqueries. Data cubes are a part of OLAP functionality.
The subset of SQL statements for defining the structure of data in the database. DDL statements create,
modify, and remove database objects, such as tables and users.
The subset of SQL statements for manipulating data in the database. DML statements retrieve, insert, update,
and delete data in the database.
data type
The format of data, such as CHAR or NUMERIC. In the ANSI SQL standard, data types can also include a
restriction on size, character set, and collation.
See also: “domain” on page 1094.
database
A collection of tables that are related by primary and foreign keys. The tables hold the information in the
database. The tables and keys together define the structure of the database. A database management system
accesses this information.
See also:
● “foreign key” on page 1095
● “primary key” on page 1105
● “database management system (DBMS)” on page 1092
● “relational database management system (RDBMS)” on page 1107
The user with the permissions required to maintain the database. The DBA is generally responsible for all
changes to a database schema, and for managing users and groups. The role of database administrator is
automatically built into databases as user ID DBA with password sql.
database connection
A communication channel between a client application and the database. A valid user ID and password are
required to establish a connection. The privileges granted to the user ID determine the actions that can be
carried out during the connection.
database file
A database is held in one or more database files. There is an initial file, and subsequent files are called
dbspaces. Each table, including its indexes, must be contained within a single database file.
See also: “dbspace” on page 1093.
The name given to a database when it is loaded by a server. The default database name is the root of the
initial database file.
See also: “database file” on page 1092.
database object
A component of a database that contains or receives information. Tables, indexes, views, procedures, and
triggers are database objects.
A special user that owns the system objects not owned by SYS.
See also:
● “database administrator (DBA)” on page 1092
● “SYS” on page 1112
database server
A computer program that regulates all access to information in a database. SQL Anywhere provides two
types of servers: network servers and personal servers.
DBA authority
The level of permission that enables a user to do administrative activity in the database. The DBA user has
DBA authority by default.
See also: “database administrator (DBA)” on page 1092.
dbspace
An additional database file that creates more space for data. A database can be held in up to 13 separate files
(an initial file and 12 dbspaces). Each table, together with its indexes, must be contained in a single database
file. The SQL command CREATE DBSPACE adds a new file to the database.
See also: “database file” on page 1092.
deadlock
A state where a set of transactions arrives at a place where none can proceed.
device tracking
Functionality in MobiLink server-initiated synchronization that allows you to address messages using the
MobiLink user name that identifies a remote device.
See also: “server-initiated synchronization” on page 1110.
In MobiLink, a way to synchronize table data to sources other than the MobiLink-supported consolidated
databases. You can implement both uploads and downloads with direct row handling.
See also:
● “consolidated database” on page 1090
● “SQL-based synchronization” on page 1110
domain
Aliases for built-in data types, including precision and scale values where applicable, and optionally
including DEFAULT values and CHECK conditions. Some domains, such as the monetary data types, are
pre-defined in SQL Anywhere. Also called user-defined data type.
See also: “data type” on page 1092.
download
The stage in synchronization where data is transferred from the consolidated database to a remote database.
dynamic SQL
SQL that is generated programmatically by your program before it is executed. UltraLite dynamic SQL is
a variant designed for small-footprint devices.
EBF
Express Bug Fix. An express bug fix is a subset of the software with one or more bug fixes. The bug fixes
are listed in the release notes for the update. Bug fix updates may only be applied to installed software with
the same version number. Some testing has been performed on the software, but the software has not
undergone full testing. You should not distribute these files with your application unless you have verified
the suitability of the software yourself.
embedded SQL
A programming interface for C programs. SQL Anywhere embedded SQL is an implementation of the ANSI
and IBM standard.
encoding
Also known as character encoding, an encoding is a method by which each character in a character set is
mapped onto one or more bytes of information, typically represented as a hexadecimal number. An example
of an encoding is UTF-8.
See also:
● “character set” on page 1088
● “code page” on page 1089
● “collation” on page 1089
In MobiLink, the sequence of events that make up a synchronization, such as begin_synchronization and
download_cursor. Events are invoked if a script is created for them.
external login
An alternate login name and password used when communicating with a remote server. By default, SQL
Anywhere uses the names and passwords of its clients whenever it connects to a remote server on behalf of
those clients. However, this default can be overridden by creating external logins. External logins are
alternate login names and passwords used when communicating with a remote server.
extraction
In SQL Remote replication, the act of unloading the appropriate structure and data from the consolidated
database. This information is used to initialize the remote database.
See also: “replication” on page 1108.
failover
Switching to a redundant or standby server, system, or network on failure or unplanned termination of the
active server, system, or network. Failover happens automatically.
FILE
In SQL Remote replication, a message system that uses shared files for exchanging replication messages.
This is useful for testing and for installations without an explicit message-transport system.
See also:“replication” on page 1108
file-based download
In MobiLink, a way to synchronize data in which downloads are distributed as files, allowing offline
distribution of synchronization changes.
file-definition database
In MobiLink, a SQL Anywhere database that is used for creating download files.
See also: “file-based download” on page 1095.
foreign key
One or more columns in a table that duplicate the primary key values in another table. Foreign keys establish
relationships between tables.
See also:
● “primary key” on page 1105
● “foreign table” on page 1096
A restriction on a column or set of columns that specifies how the data in the table relates to the data in some
other table. Imposing a foreign key constraint on a set of columns makes those columns the foreign key.
See also:
● “constraint” on page 1090
● “check constraint” on page 1088
● “primary key constraint” on page 1105
● “unique constraint” on page 1113
foreign table
full backup
A backup of the entire database, and optionally, the transaction log. A full backup contains all the information
in the database and thus provides protection in the event of a system or media failure.
See also: “incremental backup” on page 1097.
gateway
A MobiLink object, stored in MobiLink system tables or a Notifier properties file, that contains information
about how to send messages for server-initiated synchronization.
See also: “server-initiated synchronization” on page 1110.
A restriction on join results that is automatically generated. There are two types: key and natural. Key joins
are generated when you specify KEY JOIN or when you specify the keyword JOIN but do not use the
keywords CROSS, NATURAL, or ON. For a key join, the generated join condition is based on foreign key
relationships between tables. Natural joins are generated when you specify NATURAL JOIN; the generated
join condition is based on common column names in the two tables.
See also:
● “join” on page 1099
● “join condition” on page 1099
generation number
In MobiLink, a mechanism for forcing remote databases to upload data before applying any more download
files.
See also: “file-based download” on page 1095.
A type of temporary table for which data definitions are visible to all users until explicitly dropped. Global
temporary tables let each user open their own identical instance of a table. By default, rows are deleted on
commit, and rows are always deleted when the connection is ended.
See also:
● “temporary table” on page 1112
● “local temporary table” on page 1100
grant option
The level of permission that allows a user to grant permissions to other users.
hash
A hash is an index optimization that transforms index entries into keys. An index hash aims to avoid the
expensive operation of finding, loading, and then unpacking the rows to determine the indexed value, by
including enough of the actual row data with its row ID.
histogram
The most important component of column statistics, histograms are a representation of data distribution.
SQL Anywhere maintains histograms to provide the optimizer with statistical information about the
distribution of values in columns.
The iAnywhere JDBC driver provides a JDBC driver that has some performance benefits and feature benefits
compared to the pure Java jConnect JDBC driver, but which is not a pure-Java solution. The iAnywhere
JDBC driver is recommended in most cases.
See also:
● “JDBC” on page 1099
● “jConnect” on page 1099
identifier
A string of characters used to reference a database object, such as a table or column. An identifier may
contain any character from A through Z, a through z, 0 through 9, underscore (_), at sign (@), number sign
(#), or dollar sign ($).
incremental backup
A backup of the transaction log only, typically used between full backups.
See also: “transaction log” on page 1113.
index
A sorted set of keys and pointers associated with one or more columns in a base table. An index on one or
more columns of a table can improve performance.
InfoMaker
A reporting and data maintenance tool that lets you create sophisticated forms, reports, graphs, cross-tabs,
and tables, as well as applications that use these reports as building blocks.
inner join
A join in which rows appear in the result set only if both tables satisfy the join condition. Inner joins are the
default.
See also:
● “join” on page 1099
● “outer join” on page 1103
integrated login
A login feature that allows the same single user ID and password to be used for operating system logins,
network logins, and database connections.
integrity
Adherence to rules that ensure that data is correct and accurate, and that the relational structure of the database
is intact.
See also: “referential integrity” on page 1107.
Interactive SQL
A SQL Anywhere application that allows you to query and alter data in your database, and modify the
structure of your database. Interactive SQL provides a pane for you to enter SQL statements, as well as panes
that return information about how the query was processed and the result set.
isolation level
The degree to which operations in one transaction are visible to operations in other concurrent transactions.
There are four isolation levels, numbered 0 through 3. Level 3 provides the highest level of isolation. Level
0 is the default setting. SQL Anywhere also supports three snapshot isolation levels: snapshot, statement-
snapshot, and readonly-statement-snapshot.
See also: “snapshot isolation” on page 1110.
JAR file
Java archive file. A compressed file format consisting of a collection of one or more packages used for Java
applications. It includes all the resources necessary to install and run a Java program in a single compressed
file.
The main structural unit of code in Java. It is a collection of procedures and variables grouped together
because they all relate to a specific, identifiable category.
jConnect
A Java implementation of the JavaSoft JDBC standard. It provides Java developers with native database
access in multi-tier and heterogeneous environments. However, the iAnywhere JDBC driver is the preferred
JDBC driver for most cases.
See also:
● “JDBC” on page 1099
● “iAnywhere JDBC driver” on page 1097
JDBC
Java Database Connectivity. A SQL-language programming interface that allows Java applications to access
relational data. The preferred JDBC driver is the iAnywhere JDBC driver.
See also:
● “jConnect” on page 1099
● “iAnywhere JDBC driver” on page 1097
join
A basic operation in a relational system that links the rows in two or more tables by comparing the values
in specified columns.
join condition
A restriction that affects join results. You specify a join condition by inserting an ON clause or WHERE
clause immediately after the join. In the case of natural and key joins, SQL Anywhere generates a join
condition.
See also:
● “join” on page 1099
● “generated join condition” on page 1096
join type
SQL Anywhere provides four types of joins: cross join, key join, natural join, and joins using an ON clause.
See also: “join” on page 1099.
Listener
A program, dblsn, that is used by MobiLink server-initiated synchronization. Listeners are installed on
remote devices and configured to initiate actions on the device when they receive information from a Notifier.
A type of temporary table that exists only for the duration of a compound statement or until the end of the
connection. Local temporary tables are useful when you need to load a set of data only once. By default,
rows are deleted on commit.
See also:
● “temporary table” on page 1112
● “global temporary table” on page 1097
lock
A concurrency control mechanism that protects the integrity of data during the simultaneous execution of
multiple transactions. SQL Anywhere automatically applies locks to prevent two connections from changing
the same data at the same time, and to prevent other connections from reading data that is in the process of
being changed.
You control locking by setting the isolation level.
See also:
● “isolation level” on page 1098
● “concurrency” on page 1089
● “integrity” on page 1098
log file
A log of transactions maintained by SQL Anywhere. The log file is used to ensure that the database is
recoverable in the event of a system or media failure, to improve database performance, and to allow data
replication using SQL Remote.
See also:
● “transaction log” on page 1113
● “transaction log mirror” on page 1113
● “full backup” on page 1096
logical index
A reference (pointer) to a physical index. There is no indexing structure stored on disk for a logical index.
LTM
Log Transfer Manager (LTM) also called Replication Agent. Used with Replication Server, the LTM is the
program that reads a database transaction log and sends committed changes to Sybase Replication Server.
See: “Replication Server” on page 1108.
A maintenance release is a complete set of software that upgrades installed software from an older version
with the same major version number (version number format is major.minor.patch.build). Bug fixes and other
changes are listed in the release notes for the upgrade.
materialized view
A materialized view is a view that has been computed and stored on disk. Materialized views have
characteristics of both views (they are defined using a query specification), and of tables (they allow most
table operations to be performed on them).
See also:
● “base table” on page 1087
● “view” on page 1114
message log
A log where messages from an application such as a database server or MobiLink server can be stored. This
information can also appear in a messages window or be logged to a file. The message log includes
informational messages, errors, warnings, and messages from the MESSAGE statement.
message store
In QAnywhere, databases on the client and server device that store messages.
See also:
● “client message store” on page 1088
● “server message store” on page 1110
message system
In SQL Remote replication, a protocol for exchanging messages between the consolidated database and a
remote database. SQL Anywhere includes support for the following message systems: FILE, FTP, and
SMTP.
See also:
● “replication” on page 1108
● “FILE” on page 1095
message type
In SQL Remote replication, a database object that specifies how remote users communicate with the publisher
of a consolidated database. A consolidated database may have several message types defined for it; this
allows different remote users to communicate with it using different message systems.
See also:
● “replication” on page 1108
● “consolidated database” on page 1090
metadata
Data about data. Metadata describes the nature and content of other data.
See also: “schema” on page 1109.
mirror log
MobiLink
A session-based synchronization technology designed to synchronize UltraLite and SQL Anywhere remote
databases with a consolidated database.
See also:
● “consolidated database” on page 1090
● “synchronization” on page 1112
● “UltraLite” on page 1113
MobiLink client
There are two kinds of MobiLink clients. For SQL Anywhere remote databases, the MobiLink client is the
dbmlsync command line utility. For UltraLite remote databases, the MobiLink client is built in to the
UltraLite runtime library.
MobiLink Monitor
MobiLink server
System tables that are required by MobiLink synchronization. They are installed by MobiLink setup scripts
into the MobiLink consolidated database.
MobiLink user
A MobiLink user is used to connect to the MobiLink server. You create the MobiLink user on the remote
database and register it in the consolidated database. MobiLink user names are entirely independent of
database user names.
network protocol
A database server that accepts connections from computers sharing a common network.
See also: “personal server” on page 1104.
normalization
The refinement of a database structure to eliminate redundancy and improve organization according to rules
based on relational database theory.
Notifier
A program that is used by MobiLink server-initiated synchronization. Notifiers run on the same computer
as the MobiLink server. They poll the consolidated database for push requests, and then send notifications
to Listeners.
See also:
● “server-initiated synchronization” on page 1110
● “Listener” on page 1099
object tree
In Sybase Central, the hierarchy of database objects. The top level of the object tree shows all products that
your version of Sybase Central supports. Each product expands to reveal its own sub-tree of objects.
See also: “Sybase Central” on page 1112.
ODBC
Open Database Connectivity. A standard Windows interface to database management systems. ODBC is
one of several interfaces supported by SQL Anywhere.
ODBC Administrator
A Microsoft program included with Windows operating systems for setting up ODBC data sources.
A specification of the data a user wants to access via ODBC, and the information needed to get to that data.
outer join
A join that preserves all the rows in a table. SQL Anywhere supports left, right, and full outer joins. A left
outer join preserves the rows in the table to the left of the join operator, and returns a null when a row in the
right table does not satisfy the join condition. A full outer join preserves all the rows from both tables.
See also:
● “join” on page 1099
● “inner join” on page 1098
package
parse tree
PDB
performance statistic
A value reflecting the performance of the database system. The CURRREAD statistic, for example,
represents the number of file reads issued by the engine that have not yet completed.
personal server
A database server that runs on the same computer as the client application. A personal database server is
typically used by a single user on a single computer, but it can support several concurrent connections from
that user.
physical index
plug-in module
In Sybase Central, a way to access and administer a product. Plug-ins are usually installed and registered
automatically with Sybase Central when you install the respective product. Typically, a plug-in appears as
a top-level container, in the Sybase Central main window, using the name of the product itself; for example,
SQL Anywhere.
See also: “Sybase Central” on page 1112.
policy
In QAnywhere, the way you specify when message transmission should occur.
polling
In MobiLink server-initiated synchronization, the way the Notifier detects push requests on the consolidated
database.
See also: “server-initiated synchronization” on page 1110.
PowerDesigner
predicate
A conditional expression that is optionally combined with the logical operators AND and OR to make up
the set of conditions in a WHERE or HAVING clause. In SQL, a predicate that evaluates to UNKNOWN
is interpreted as FALSE.
primary key
A column or list of columns whose values uniquely identify every row in the table.
See also: “foreign key” on page 1095.
A uniqueness constraint on the primary key columns. A table can have only one primary key constraint.
See also:
● “constraint” on page 1090
● “check constraint” on page 1088
● “foreign key constraint” on page 1096
● “unique constraint” on page 1113
● “integrity” on page 1098
primary table
proxy table
A local table containing metadata used to access a table on a remote database server as if it were a local
table.
See also: “metadata” on page 1102.
publication
In MobiLink or SQL Remote, a database object that identifies data that is to be synchronized. In MobiLink,
publications exist only on the clients. A publication consists of articles. SQL Remote users can receive a
publication by subscribing to it. MobiLink users can synchronize a publication by creating a synchronization
subscription to it.
See also:
● “replication” on page 1108
● “article” on page 1087
● “publication update” on page 1106
publication update
In SQL Remote replication, a list of changes made to one or more publications in one database. A publication
update is sent periodically as part of a replication message to the remote database(s).
See also:
● “replication” on page 1108
● “publication” on page 1105
publisher
In SQL Remote replication, the single user in a database who can exchange replication messages with other
replicating databases.
See also: “replication” on page 1108.
push notification
In QAnywhere, a special message delivered from the server to a QAnywhere client that prompts the client
to initiate a message transmission.
See also: “QAnywhere” on page 1106.
push request
In MobiLink server-initiated synchronization, a row in a SQL result set or table on the consolidated database
that contains a notification and information about how to send the notification.
See also: “server-initiated synchronization” on page 1110.
QAnywhere
Application-to-application messaging, including mobile device to mobile device and mobile device to and
from the enterprise, that permits communication between custom programs running on mobile or wireless
devices and a centrally located server application.
QAnywhere agent
In QAnywhere, a process running on the client device that monitors the client message store and determines
when message transmission should occur.
query
A SQL statement or group of SQL statements that access and/or manipulate data in a database.
See also: “SQL” on page 1110.
Redirector
A web server plug-in that routes requests and responses between a client and the MobiLink server. This
plug-in also implements load-balancing and failover mechanisms.
In MobiLink, a SQL Anywhere database used in the development of UltraLite clients. You can use a single
SQL Anywhere database as both reference and consolidated database during development. Databases made
with other products cannot be used as reference databases.
referencing object
An object, such as a view, whose definition directly references another object in the database, such as a table.
See also: “foreign key” on page 1095.
referenced object
An object, such as a table, that is directly referenced in the definition of another object, such as a view.
See also: “primary key” on page 1105.
referential integrity
Adherence to rules governing data consistency, specifically the relationships between the primary and
foreign key values in different tables. To have referential integrity, the values in each foreign key must
correspond to the primary key values of a row in the referenced table.
See also:
● “primary key” on page 1105
● “foreign key” on page 1095
regular expression
A regular expression is a sequence of characters, wildcards, and operators that defines a pattern to search
for within a string.
A type of database management system that stores data in the form of related tables.
See also: “database management system (DBMS)” on page 1092.
remote database
In MobiLink or SQL Remote, a database that exchanges data with a consolidated database. Remote databases
may share all or some of the data in the consolidated database.
See also:
● “synchronization” on page 1112
● “consolidated database” on page 1090
In SQL Remote, a level of permission required by the Message Agent. In MobiLink, a level of permission
required by the SQL Anywhere synchronization client (dbmlsync). When the Message Agent or
synchronization client connects as a user who has this authority, it has full DBA access. The user ID has no
additional permissions when not connected through the Message Agent or synchronization client.
See also: “DBA authority” on page 1093.
remote ID
A unique identifier in SQL Anywhere and UltraLite databases that is used by MobiLink. The remote ID is
initially set to NULL and is set to a GUID during a database's first synchronization.
replication
The sharing of data among physically distinct databases. Sybase has three replication technologies:
MobiLink, SQL Remote, and Replication Server.
Replication Agent
replication frequency
In SQL Remote replication, a setting for each remote user that determines how often the publisher's message
agent should send replication messages to that remote user.
See also: “replication” on page 1108.
replication message
In SQL Remote or Replication Server, a communication sent between a publishing database and a subscribing
database. Messages contain data, passthrough statements, and information required by the replication system.
See also:
● “replication” on page 1108
● “publication update” on page 1106
Replication Server
A Sybase connection-based replication technology that works with SQL Anywhere and Adaptive Server
Enterprise. It is intended for near-real time replication between a small number of databases.
See also: “LTM” on page 1100.
role
In conceptual database modeling, a verb or phrase that describes a relationship from one point of view. You
can describe each relationship with two roles. Examples of roles are "contains" and "is a member of."
The name of a foreign key. This is called a role name because it names the relationship between the foreign
table and primary table. By default, the role name is the table name, unless another foreign key is already
using that name, in which case the default role name is the table name followed by a three-digit unique
number. You can also create the role name yourself.
See also: “foreign key” on page 1095.
rollback log
A record of the changes made during each uncommitted transaction. In the event of a ROLLBACK request
or a system failure, uncommitted transactions are reversed out of the database, returning the database to its
former state. Each transaction has a separate rollback log, which is deleted when the transaction is complete.
See also: “transaction” on page 1112.
row-level trigger
schema
The structure of a database, including tables, columns, and indexes, and the relationships between them.
script
In MobiLink, code written to handle MobiLink events. Scripts programmatically control data exchange to
meet business needs.
See also: “event model” on page 1095.
script-based upload
In MobiLink, a way to customize the upload process as an alternative to using the log file.
script version
In MobiLink, a set of synchronization scripts that are applied together to create a synchronization.
secured feature
A feature specified by the -sf option when a database server is started, so it is not available for any database
running on that database server.
server-initiated synchronization
A QAnywhere message that is formatted as XML and sent to the QAnywhere system queue as a way to
administer the sever message store or monitor QAnywhere applications.
In QAnywhere, a relational database on the server that temporarily stores messages until they are transmitted
to a client message store or JMS system. Messages are exchanged between clients via the server message
store.
service
In Windows operating systems, a way of running applications when the user ID running the application is
not logged on.
session-based synchronization
A type of synchronization where synchronization results in consistent data representation across both the
consolidated and remote databases. MobiLink is session-based.
snapshot isolation
A type of isolation level that returns a committed version of the data for transactions that issue read requests.
SQL Anywhere provides three snapshot isolation levels: snapshot, statement-snapshot, and readonly-
statement-snapshot. When using snapshot isolation, read operations do not block write operations.
See also: “isolation level” on page 1098.
SQL
The language used to communicate with relational databases. ANSI has defined standards for SQL, the latest
of which is SQL-2003. SQL stands, unofficially, for Structured Query Language.
SQL Anywhere
The relational database server component of SQL Anywhere that is intended for use in mobile and embedded
environments or as a server for small and medium-sized businesses. SQL Anywhere is also the name of the
package that contains the SQL Anywhere RDBMS, the UltraLite RDBMS, MobiLink synchronization
software, and other components.
SQL-based synchronization
A message-based data replication technology for two-way replication between consolidated and remote
databases. The consolidated and remote databases must be SQL Anywhere.
SQL statement
statement-level trigger
stored procedure
A program comprised of a sequence of SQL instructions, stored in the database and used to perform a
particular task.
string literal
subquery
A SELECT statement that is nested inside another SELECT, INSERT, UPDATE, or DELETE statement,
or another subquery.
There are two types of subquery: correlated and nested.
subscription
In MobiLink synchronization, a link in a client database between a publication and a MobiLink user, allowing
the data described by the publication to be synchronized.
In SQL Remote replication, a link between a publication and a remote user, allowing the user to exchange
updates on that publication with the consolidated database.
See also:
● “publication” on page 1105
● “MobiLink user” on page 1102
Sybase Central
A database management tool that provides SQL Anywhere database settings, properties, and utilities in a
graphical user interface. Sybase Central can also be used for managing other Sybase products, including
MobiLink.
synchronization
SYS
A special user that owns most of the system objects. You cannot log in as SYS.
system object
system table
A table, owned by SYS or dbo, that holds metadata. System tables, also known as data dictionary tables, are
created and maintained by the database server.
system view
A type of view, included in every database, that presents the information held in the system tables in an
easily understood format.
temporary table
A table that is created for the temporary storage of data. There are two types: global and local.
See also:
● “local temporary table” on page 1100
● “global temporary table” on page 1097
transaction
A sequence of SQL statements that comprise a logical unit of work. A transaction is processed in its entirety
or not at all. SQL Anywhere supports transaction processing, with locking features built in to allow
concurrent transactions to access the database without corrupting the data. Transactions end either with a
COMMIT statement, which makes the changes to the data permanent, or a ROLLBACK statement, which
undoes all the changes made during the transaction.
A file storing all changes made to a database, in the order in which they are made. It improves performance
and allows data recovery in the event the database file is damaged.
An optional identical copy of the transaction log file, maintained simultaneously. Every time a database
change is written to the transaction log file, it is also written to the transaction log mirror file.
A mirror file should be kept on a separate device from the transaction log, so that if either device fails, the
other copy of the log keeps the data safe for recovery.
See also: “transaction log” on page 1113.
transactional integrity
In MobiLink, the guaranteed maintenance of transactions across the synchronization system. Either a
complete transaction is synchronized, or no part of the transaction is synchronized.
transmission rule
In QAnywhere, logic that determines when message transmission is to occur, which messages to transmit,
and when messages should be deleted.
trigger
A special form of stored procedure that is executed automatically when a user runs a query that modifies the
data.
See also:
● “row-level trigger” on page 1109
● “statement-level trigger” on page 1111
● “integrity” on page 1098
UltraLite
A database optimized for small, mobile, and embedded devices. Intended platforms include cell phones,
pagers, and personal organizers.
UltraLite runtime
An in-process relational database management system that includes a built-in MobiLink synchronization
client. The UltraLite runtime is included in the libraries used by each of the UltraLite programming interfaces,
as well as in the UltraLite engine.
unique constraint
A restriction on a column or set of columns requiring that all non-null values are different. A table can have
multiple unique constraints.
See also:
● “foreign key constraint” on page 1096
● “primary key constraint” on page 1105
● “constraint” on page 1090
unload
Unloading a database exports the structure and/or data of the database to text files (SQL command files for
the structure, and ASCII comma-separated files for the data). You unload a database with the Unload utility.
In addition, you can unload selected portions of your data using the UNLOAD statement.
upload
The stage in synchronization where data is transferred from a remote database to a consolidated database.
validate
view
A SELECT statement that is stored in the database as an object. It allows users to see a subset of rows or
columns from one or more tables. Each time a user uses a view of a particular table, or combination of tables,
it is recomputed from the information stored in those tables. Views are useful for security purposes, and to
tailor the appearance of database information to make data access straightforward.
window
The group of rows over which an analytic function is performed. A window may contain one, many, or all
rows of data that has been partitioned according to the grouping specifications provided in the window
definition. The window moves to include the number or range of rows needed to perform the calculations
for the current row in the input. The main benefit of the window construct is that it allows additional
opportunities for grouping and analysis of results, without having to perform additional queries.
Windows
The Microsoft Windows family of operating systems, such as Windows Vista, Windows XP, and Windows
200x.
Windows CE
See “Windows Mobile” on page 1114.
Windows Mobile
plan viewer file extension, 627 SQL Anywhere SNMP Extension Agent OID, 816
1254TRK collation ActiveSync
differences from 1254TRKALT, 382 required version for SQL Anywhere for Windows
1254TRKALT collation Mobile, 1048
using, 382 adding
@data option ECC and RSA certificates, 679
about, 669 new rows in Interactive SQL, 630
backup [dbbackup] utility, 672 Address Windowing Extensions
broadcast repeater [dbns11] utility, 677 limiting cache size, 166
data source [dbdsn] utility, 684 administration tools
database server, 156 features not supported on Windows Mobile, 1079
erase [dberase] utility, 696 Interactive SQL, 612
histogram [dbhist] utility, 700 Sybase Central, 594
information [dbinfo] utility, 702 administration utilities
initialization [dbinit] utility, 703 (see also database administration utilities)
Interactive SQL [dbisql] utility, 716 using on Windows Mobile, 1072
log transfer manager utility [dbltm] syntax, 726 ADO
log translation [dbtran] utility, 731 connecting, 101
ping [dbping] utility, 736 ADO.NET sample
server enumeration [dblocate] utility, 742 using, 1054
server licensing [dblic] utility, 745 AES encryption algorithm
spawn [dbspawn] utility, 760 about, 965
SQL Anywhere console [dbconsole] utility, 758 initialization [dbinit] utility, 703
stop [dbstop] utility, 762 unload [dbunload] utility, 776
support [dbsupport] syntax, 764 AES256 encryption algorithm
transaction log [dblog] utility, 773 initialization [dbinit] utility, 703
unload [dbunload] utility, 776 unload [dbunload] utility, 776
unsupported on Windows Mobile, 1081 AES256_FIPS encryption algorithm
upgrade [dbupgrad] utility, 790 -fips server option, 177
validation [dbvalid] utility, 793 initialization [dbinit] utility, 703
Windows service [dbsvc] utility, 748 unload [dbunload] utility, 776
@environment-variable option (see @data option) AES_FIPS encryption algorithm
@filename option (see @data option) -fips server option, 177
initialization [dbinit] utility, 703
A unload [dbunload] utility, 776
agent IDs
accent sensitivity
glossary definition, 1087
databases, 703
Agent table
using French rules, 703
SQL Anywhere MIB, 813
AccentSensitive property
agents
database property description, 575
about, 801
SQL Anywhere SNMP Extension Agent OID, 828
AIX
access plans
IPv6 support, 135
controlling optimizer's use of, 500
LIBPATH environment variable, 316
accessing databases
Alias property
security features, 948
database property description, 575
ActiveReq property
SQL Anywhere SNMP Extension Agent OID, 828
server property description, 562
ALL
database property description, 575 SQL Anywhere SNMP Extension Agent OID, 825
server property description, 562 CheckpointLogSize property
SQL Anywhere SNMP Extension Agent OID, 819, database property description, 575
828 SQL Anywhere SNMP Extension Agent OID, 825
CHECK constraints CheckpointLogWrites property
glossary definition, 1088 database property description, 575
unloading databases, 786 SQL Anywhere SNMP Extension Agent OID, 825
check for updates checkpoints
about, 665 about, 869
check for updates tab backups, 852
Sybase Central, 665 checkpoint_time option, 457
using, 665 glossary definition, 1088
checking for software updates interval between, 179
about, 665 urgency, 872
checking in CheckpointUrgency property
files from Interactive SQL, 637 database property description, 575
checking out SQL Anywhere SNMP Extension Agent OID, 825
files from Interactive SQL, 636 Checksum property
checkpoint logs database property description, 575
about, 869 SQL Anywhere SNMP Extension Agent OID, 828
checkpoint only mode checksums
database server, 189 about, 863
checkpoint_time option automatically enabled for Windows Mobile
connection property description, 539 databases, 864
description, 457 enabled for Windows Mobile databases, 1064
SQL Anywhere SNMP Extension Agent OID, 831 glossary definition, 1088
using, 872 initialization [dbinit] utility, 703
CheckpointLogBitmapPagesWritten property validation [dbvalid] utility, 793
database property description, 575 Chkpt property
SQL Anywhere SNMP Extension Agent OID, 825 database property description, 575
CheckpointLogBitmapSize property SQL Anywhere SNMP Extension Agent OID, 825
database property description, 575 ChkptFlush property
SQL Anywhere SNMP Extension Agent OID, 825 database property description, 575
CheckpointLogCommitToDisk property SQL Anywhere SNMP Extension Agent OID, 825
database property description, 575 ChkptPage property
SQL Anywhere SNMP Extension Agent OID, 825 database property description, 575
CheckpointLogPageInUse property SQL Anywhere SNMP Extension Agent OID, 825
SQL Anywhere SNMP Extension Agent OID, 825 choosing a database mirroring mode
CheckpointLogPagesInUse property about, 918
database property description, 575 choosing collations
CheckpointLogPagesRelocated property about, 365
database property description, 575 ciphers
SQL Anywhere SNMP Extension Agent OID, 825 transport-layer security, 977
CheckpointLogPagesWritten property cis_option option
database property description, 575 description, 458
SQL Anywhere SNMP Extension Agent OID, 825 obtaining property value, 539
CheckpointLogSavePreimage property SQL Anywhere SNMP Extension Agent OID, 831
database property description, 575 cis_rowset_size option
SQL Anywhere SNMP Extension Agent OID, 819 CompressionThreshold connection parameter
comparing description, 257
TIMESTAMP, 470 COMPTH connection parameter
compatibility description, 257
ANSI, 442 computed columns
SQL, 442 adding to new rows in Interactive SQL, 630
Transact-SQL, 442 recalculating in Interactive SQL, 631
compatibility options recalculating when unloading databases, 776
allow_nulls_by_default, 447 unloading databases, 786
ansi_blanks, 450 updating in Interactive SQL, 631
ansi_close_cursors_on_rollback, 451 CON connection parameter
ansi_permissions, 451 description, 258
ansi_update_constraints, 452 concurrency
ansinull, 453 glossary definition, 1089
ASE compatibility options, 443 concurrent connections
chained, 457 setting maximum, 182
classification, 436 conditional parsing
close_on_endtrans, 459 configuration files, 670
continue_after_raiserror, 462 configuration files
conversion_error, 463 (see also @data option)
date_format, 466 about, 669
date_order, 467 adding simple encryption with dbfhide, 698
escape_character, 472 conditional parsing, 670
fire_triggers, 474 creating LTM, 1038
initial settings, 436 for the LTM, 728
isolation_level, 478 format for LTM, 1038
non_keywords, 494 hiding, 698
on_tsql_error, 498 log transfer manger [dbltm] utility, 726
quoted_identifier, 509 LTM, 1038
sql_flagger_error_level, 517 LTM command line, 726
sql_flagger_warning_level, 518 option, 156
string_rtruncation, 521 configuring
time_format, 525 databases for Windows Mobile, 1062
timestamp_format, 526 Interactive SQL, 616
Transact-SQL compatibility options, 443 interfaces file, 1010
tsql_outer_joins, 528 LTM, 1038
tsql_variables, 529 MobiLink SQL Anywhere clients to use transport-
Compress connection parameter layer security, 999
description, 256 ODBC data sources, 92
compressing SQL Anywhere Console [dbconsole] utility, 663
packets, 201 SQL Anywhere database users for Replication
compression Server, 1033
performance, 141 SQL Anywhere databases for Replication Server,
compression option 1032
description, 460 sql.ini, 1010
replication option, 446 text completion, 659
Compression property using dbconsole, 758
connection property description, 539 configuring data sources
login as a service privilege SQL Anywhere SNMP Extension Agent OID, 825
Linux service [dbsvc] utility, 755 long server names
Windows service [dbsvc] utility, 749 viewing with dblocate, 742
login mappings looking up
integrated logins, 113 columns in Interactive SQL, 623
Kerberos, 121 procedures in Interactive SQL, 623
login policies tables in Interactive SQL, 623
about, 386 LOPT protocol option
altering, 389 description, 298
assigning to existing users, 388 lower code page
assigning when creating new users, 388 about, 354
creating, 387 LSIZE protocol option
dropping, 388, 390 description, 298
inheriting from the root policy, 386 LTM
on read only databases, 390 (see also LTM utility)
overriding policy options in the root policy, 386 character set configuration, 1040
root login policy, 386 character sets, 1039
login policies assigned to individual users collations, 1039, 1040
unload [dbunload] utility, 785 configuration, 1024, 1038
login_mode option configuration file, 728, 1029
connection property description, 539 glossary definition, 1100
description, 482 interfaces file, 726
integrated logins, 114 Open Client/Open Server character sets, 1039
SQL Anywhere SNMP Extension Agent OID, 831 Open Client/Open Server collations, 1039
login_procedure option starting, 1029
connection property description, 539 supported operations, 1035
description, 483 transaction log management, 1042
disallowing connections with RAISERROR, 483 transaction log options, 775
implementing password expiration, 953 LTM configuration files
SQL Anywhere SNMP Extension Agent OID, 831 about, 1038
logins character sets, 1040
integrated, 113 creating, 1038
Kerberos, 121 format, 1038
LoginTime property LTM utility
connection property description, 539 (see also LTM)
LogMaxSize protocol option identifiers, 1034
description, 298 supported operating systems, 1022
LogMirrorName property syntax, 726
database property description, 575 LTM_admin_pw parameter
SQL Anywhere SNMP Extension Agent OID, 828 LTM configuration file, 728
LogName property starting the LTM, 1029
database property description, 575 LTM_admin_user parameter
SQL Anywhere SNMP Extension Agent OID, 828 LTM configuration file, 728
LogOptions protocol option starting the LTM, 1029
description, 298 LTM_charset parameter
LogWrite property LTM configuration file, 728, 1040
connection property description, 539 starting the LTM, 1029
database property description, 575 LTM_language parameter
start server in background [dbspawn] utility, 760 verifying in MobiLink transport-layer security, 998
startup settings, 1016 os_charset alias
stop server [dbstop] utility, 762 about, 374
string_rtruncation, 521 OSUser property
subscribe_by_remote, 521 connection property description, 539
subsume_row_locks, 522 outer joins
support [dbsupport] syntax, 764 glossary definition, 1103
suppress_tds_debugging, 522 output_format option
synchronize_mirror_on_commit, 523 description, 655
tds_empty_string_is_null, 523 Interactive SQL settings, 642
temp_space_limit_check, 524 output_length option
time_format, 525 description, 656
time_zone_adjustment, 525 Interactive SQL settings, 642
timestamp_format, 526 output_nulls option
Transact-SQL compatibility options, 443 description, 656
transaction log [dblog] utility, 773 Interactive SQL settings, 642
truncate_timestamp_values, 527 Override-Magic
truncation_length, 656 user_estimates option, 530
tsql_outer_joins, 528 overview tab
tsql_variables, 529 SQL Anywhere, 610
unload [dbunload] utility, 776 owners
updatable_statement_isolation, 529 about, 399
update_statistics, 530
upgrade [dbupgrad] utility, 790 P
user_estimates, 530
packages
validation [dbvalid] utility, 793
glossary definition, 1104
verify_all_columns, 531
packet size
verify_password_function, 532
limiting, 200, 201
verify_threshold, 535
PacketSize property
viewcert utility, 682
connection property description, 539
wait_for_commit, 535
PacketsReceived property
webservice_namespace_host, 536
connection property description, 539
Windows service [dbsvc] utility, 748
server property description, 562
options watch list
SQL Anywhere SNMP Extension Agent OID, 816
about, 435
PacketsReceivedUncomp property
OptionWatchAction property
connection property description, 539
about, 435
server property description, 562
database property description, 575
SQL Anywhere SNMP Extension Agent OID, 816
server property description, 562
PacketsSent property
SQL Anywhere SNMP Extension Agent OID, 828
connection property description, 539
OptionWatchList property
server property description, 562
about, 435
SQL Anywhere SNMP Extension Agent OID, 816
database property description, 575
PacketsSentUncomp property
server property description, 562
connection property description, 539
SQL Anywhere SNMP Extension Agent OID, 828
server property description, 562
Oracle driver
SQL Anywhere SNMP Extension Agent OID, 816
creating data sources, 685
page mode
organization unit
copying database files, 130 SQL Anywhere SNMP Extension Agent OID, 828
creating databases, 964 sensitivity
database server, 950, 964 accent, 366
DatabaseKey [DBKEY] connection parameter, 260 case, 366
deleting databases, 964 punctuation, 366
disabling database features, 515, 956 server address
encrypting database files, 965 DSEdit, 1012
Encryption [ENC] connection parameter, 266 server authentication
event example, 904 MobiLink transport-layer security, 997
file access, 182 SQL Anywhere transport-layer security, 990
file hiding [dbfhide] utility, 698 server certificates
FIPS, 979 using global certificates in transport-layer security,
integrated logins, 130, 952 987
loading data, 964 server enumeration utility [dblocate]
minimum password length, 493 exit codes, 744
overview, 948 syntax, 742
passwords, 952 server information
procedures, 407, 422 sasrv.ini, 110
server command line, 948 server licensing utility [dblic]
services, 59 exit codes, 746
SQL Anywhere, 947 syntax, 745
system functions, 950 server location utility (see server enumeration utility
temporary file, 325 [dblocate])
tips, 950 server management requests
unloading data, 964 glossary definition, 1110
utility database, 24 server message log
views, 422 configuring for database servers, 34
Windows Mobile, 975 server message stores
SELECT permission glossary definition, 1110
about, 398 server messages
SELECT permissions cache warming, 165
granting, 404 displaying, 204
selectivity estimates displaying on Linux, 217, 218
user_estimates option, 530 displaying on Mac OS X, 219
self-signed certificates displaying on Solaris, 217
making for transport-layer security, 983 limiting size of log file, 199
transport-layer security, 983 logging startup errors, 198
SELinux policies output to file, 197, 200
using SQL Anywhere policy, 948 renaming and restarting log file, 198
semicolons viewing on Linux, 217, 218, 220
using in connection strings, 76 viewing on Mac OS X, 219
SendBufferSize protocol option viewing on Solaris, 217
description, 302 server messages and executed SQL pane
SendFail property about, 35
server property description, 562 server name
SQL Anywhere SNMP Extension Agent OID, 816 -n option, 196
SendingTracingTo property case sensitivity, 38
database property description, 575 server enumeration [dblocate] utility, 742