Connecting to SQL Server
Alpha Anywhere AlphaDAO provides an extension driver for SQL Server to simplify building connections using any of the SQL Server ODBC drivers provided by Microsoft. You must first install the appropriate driver for the version of your SQL Server database. In the connection string dialog, select the version of the database you are connecting to. Alpha Anywhere will select the installed driver that is the best fit for the target version.
When you select SQL Server as your connection type in the connection string dialog, the dialog below will be displayed. Select the version of your database, enter the 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 installed and configured your SQL Server server and installed the appropriate client side driver. For more information on installing and configuring SQL Server, see https://www.microsoft.com/en-us/sql-server/sql-server-downloads.
Alpha Anywhere is a 32-bit executable. You must install the 32-bit ODBC client driver for your database. To view those drivers, you will need to run the 32-bit ODBC Data Source Administrator found at c:\windows\syswow64\odbcad32.exe.
Microsoft documentation now identifies "ODBC Driver 18 for SQL Server" as the current driver for "all supported versions" of SQL Server.
With the exception of some of the oldest database servers, you should be able to install this driver and successfully connect to and query your database.
If you get errors or unexpected results when executing SQL, try downloading and installing one of the older drivers as shown in the table below.
ODBC Driver 18 for SQL Server changes the default behavior for encryption. Previously it was disabled by default. In ODBC Driver 18 for SQL Server it is enabled by default.
When connecting to a test database, be sure to set the Trust Server Certificate to checked ('A5TrustServerCertificate=Y') if you have not installed a certificate or are running with a self-signed certificate.
For production systems, especially those which you connect to on a public network, you should always purchase and install a certificate that can be publicly validated, set Encrypt to checked and set Trust Server Certificate to unchecked.
- Pay attention to the security of your SQL Server environment and the connection from your client to the server. Modern network communication is generally done with TLS (previously called SSL), and SQL Server fully suports this.
When running any version of SQL Server, be sure to update the database software to keep current with Microsoft bug fixes and security patches.
Because secure connections to the database rely on Windows infrastructure, you should also keep your version and patch level of Windows as current as possible.
In the past, it was acceptable, if not advisable to skip applying patches to a working system. This is no longer the case because of the need for constant security updates. Instead, you will need to watch for frequent updates and test them on your system.
The list below shows the database version and the previously recommended driver for that database. The version that you see in the Microsoft ODBC administrator dialog is for the client driver of that name specifically. It is independent of the database server version. You may need to update your client driver from time to time as updates are made available from Microsoft.
Again, the client driver name is the one that you want to match the database version.
As of this writing the following client drivers are available for the various versions of the SQL Server database.
- SQL Server Version
- Client Driver Name
ODBC Driver 18 for SQL Server
ODBC Driver 17 for SQL Server
ODBC Driver 13 for SQL Server
ODBC Driver 11 for SQL Server
SQL Server Native Client 11.0
SQL Server Native Client 10.0
SQL Native Client
- Older Versions
Consult the documentation for Microsoft SQL Server for more information about downloading and installing client drivers.
The SQL Server connection string dialog has tab pages for general properties, timeouts, SSH tunneling, and advanced properties. Each of the properties are described below.Click the Refresh button to see a list of databases, or leave the entry blank and click Test Connection. Once you have made an initial connection, you can click the Create Database button to create a new database on the server.
The Timeouts tab page lets you override default timeouts for login, the lifetime of the connection and for each query.
The SSH tab is used to enable a connection to a database using an SSH2 tunnel. These connections are made from a local tunnel that is connected to a remote server and then finally to the actual database, typically behind a firewall. Alpha Anywhere will create and manage the tunnel for you based on the values you provide on this page.
The Advanced tab is used to set up a secure connection, enable column encryption, enter additional parameters and provide an initial command to be executed at connect time.
To set SQL server parameters that are not directly supported by the SQL Server connection string dialog, enter them as comma separated key=value entries. They will be passed directly to the connection string provided to SQL Server.
To execute one or more commands immediately after connecting to the database, enter native SQL Server commands separated by a semi-colon.
- Connection Property
Setting the connection property A5API to 'SQLServer' will load the SQL Server driver when you open a connection.
The version number of SQL Server your server is running. This will assure that your client connects using the driver best matched to your SQL Server server.
Enter the DNS name or IP address of your server.
SQL Server defaults to an IP address of 1433. It is a good practice to set the server port to a different value so that it is not as obvious what port SQL Server is running on. This is not a substitute for using secure connections.
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'
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.
Enter or select the name of the database you are targeting.
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.
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.
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.
Set this value to control the timeout for new connections in seconds. Omit this setting to use the SQL Server ODBC driver default value.
Set this value to control the timeout for the lifetime of a connection in seconds. Omit this setting to use the SQL Server ODBC driver default value.
Set this value to control the timeout for a single query in seconds. Omit this setting to use the SQL Server ODBC driver default value.
The conection string properties for SSH connections are discussed separately in Connecting Securely with SSH.
Set this value to 'Y' to encrypt connections to the server. The default value of this parameter is 'N'.
Set this value to 'Y' if you are using a self-signed certificate and do not want to check the server identity against a certificate authority. This value should never be set to 'Y' on a production server, but can be useful in testing out secure connections on a development server. The default value of this parameter is 'N'.
Set this value to 'Y' to enable column encryption for the Always Encrypted feature of SQL Server. This will add the string "ColumnEncryption=Enabled" to the SQL Server connection string. For more information on this feature see https://docs.microsoft.com/en-us/sql/relational-databases/security/encryption/always-encrypted-database-engine. The default value of this parameter is 'N'.
Set this value to 'Y' to disable functions that send data to the database as wide characters (16-bit Unicode). Data will instead be bound and passed as multi-byte characters. The default value of this parameter is 'N'.
This property is obsolete.
Set this value to the semi-colon delimited list of commands you want to execute after a connection is opened.
A SQL Server connection automatically selects SQL Server as it's syntax. The SQL Server 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.
- The SQL Server syntax handler may be used with the ODBC and ADO.Net drivers as well.