Connecting to SQL Anywhere

Description

Alpha Anywhere AlphaDAO includes a SQL Anywhere extension driver built on the SQL Anywhere ODBC driver. SQL Anywhere connections in Alpha Anywhere do not require a DNS to be configured, but the SQL Anywhere ODBC driver must be installed.

Using the SQL Anywhere Connection String Dialog

When you select SQL Anywhere as your connection type in the connection string dialog, the dialog below will be displayed. Enter your host and server name and provide any authentication information required to connect to your database. The values you select will be generated into the connection string at the top of the dialog for you as you make changes. Before you begin, make sure you have install the SQL Anywhere ODBC driver. For more information on obtaining the driver, see https://wiki.scn.sap.com/wiki/display/SQLANY/SAP+SQL+Anywhere+Database+Client+Download

  • The SQL Anywhere connection string dialog has tab pages for general properties, timeout values and TLS/SSL connections. Each of the properties are described below.

    images/SQLAnywhereConnectionStringDialogGeneral.png
  • The Timeouts tab page lets you override default timeouts for login, the lifetime of the connection and for each query.

    images/SQLAnywhereConnectionStringDialogTimeouts.png
  • The TLS tab is used to enable TLS (also called SSL) connections. These connections are encrypted between Alpha Anywhere and the database. The database presents a certificate to the client and the client verifies that it trusts the certificate. You will need to provide a certificate file with trusted certificates (and possibly the certificate being provided by the server). You can also require that the server certificate match a name, company and/or unit values that you provide.

    images/SQLAnywhereConnectionStringDialogTLS.png
  • Creating a New Database in the SQL Anywhere Connection String Dialog

    You can create a database from the connection string dialog once you have successfully connected to your server by clicking on the "Create Database" button. You will be prompted for the name. Type a valid database name. Click 'OK' to create a new database file.

SQL Anywhere Connection String Properties

Connection Property
Description
A5API

Setting the connection property A5API to 'SQLAnywhere' will load the SQL Anywhere driver when you open a connection.

A5DBVersion

The version number of SQL Anywhere your server is running. This will assure that your client connects using the driver best matched to your SQL Anywhere server.

Host

Enter the DNS name or IP address of your server.

Port

SQL Anywhere defaults to an IP address of 2638. It is a good practice to set the server port to a different value so that it is not as obvious that SQL Anywhere is being served. This is not a substitute for using secure connections.

Server

The specific SQL Anywhere server running on the target host. Note that the server is NOT the DNS name or IP. Enter that value as the host.

Database

Enter or select the name of the database you are targeting.

trusted_connection

Set this value to 'yes' to use Windows authentication.

UserName

Set this value to the user name you wish to connect to the database with. This is only needed if trusted_connection is not set to 'yes'

Password

Set this value to the password value you wish to connect to the database with. This is only needed if trusted_connection is not set to 'yes' Using the connection string dialog will obscure the password within the connection string. Publish functions encrypt the connection string.

A5LoginTimeout

Set this value to control the timeout for new connections in seconds. Omit this setting to use the SQL Anywhere ODBC driver default value.

A5ConnectionTimeOut

Set this value to control the timeout for the lifetime of a connection in seconds. Omit this setting to use the SQL Anywhere ODBC driver default value.

A5QueryTimeOut

Set this value to control the timeout for a query in seconds. Omit this setting to use the SQL Anywhere ODBC driver default value.

A5TraceSQL

Set this value to Y to trace SQL statements. Within Alpha Anywhere messages are written to the trace pane. For Application Servers the output is written to a file. The actual location varies by server.

A5TraceSQLLevel

Set this value to determine how much detail will be written to the trace log. When set to "Errors", only errors will be reported. When set to "SQL" a summary of each statement and the results will be reported, including errors. When set to "Complete" all errors and SQL will be reported as well as key function calls and translated queries with argument markers as well as any caller context provided. When set to "Diagnostic", all of the previous output will be included along with the user thread name, the argument values and bind mappings. All other values are treated as if "SQL" was set.

A5TraceSQLFormat

Set this value to indicate the output format desired. When set to "JSON", information will be written in JSON format with a trailing comma. Parsing a file in JSON format can be done by stripping the last trailing comma and wrapping the text in square brackets "[]". When set to "Text", the output is written as formatted text. This is the default format.

A5SSL

Setting this value to Y requests that connections made to SQL Anywhere be done using TLS (Transport Level Security). The predecessor to TLS is SSL (Secure Sockets Level) and is no longer the current protocol, but you will often see SSL in documentation and common usage.

A5TLSTrustedCertificateFile

Enter the file name or complete path to a file with trusted certificates, server certificates and any local certificates. If the file is for an IIS installation (including Alpha Cloud) you can omit the path and Alpha Anywhere wll look for the file in a subfolder of the deployed application. You will need to install the file into your web project in the same location.

A5TLSCertificateName

You can (optionally) set this field to the name of the certificate you expect for tighter security.

A5TLSCertificateCompany

You can (optionally) set this field to the name of the company you expect in the certificate for tighter security.

A5TLSCertificateUnit

You can (optionally) set this field to the name of the unit you expect in the certificate for tighter security.

A5InitialCommand

A string of commands (separated by semicolons ';') to be executed each time the connection is opened.

Using Portable SQL with SQL Anywhere

  • A SQL Anywhere connection automatically selects SQLAnywhere as it's syntax. The SQLAnywhere syntax handler reads table information, and generates DDL (Data Definition Language) such as CREATE TABLE, DROP TABLE and DML (Data Manipulation Language) such as SELECT, INSERT, UPDATE, DELETE. It is also responsible for translating AlphaDAO Portable SQL functions into native implementations. Although geography functions are not currently supported, the syntax handler has been extended to support all other portable SQL functions.

  • The SQLAnywhere syntax handler may be used with the ODBC and ADO.Net drivers as well.