The connection string is really just a string inside the application you pass on to the connection object. The property is passed through the Open function of the connection object.
As a string, there are no built in checks or constraints on how to format the connection string. A few rules to follow taken from www.connectionstrings.com
- All blank characters, except those placed within a value or within quotation marks, are ignored
- Blank characters will though affect connection pooling mechanism, pooled connections must have the EXACT same connection string
- If a semicolon (;) is part of a value it must be delimited by quotation marks (")
- Use a single-quote (') if the value begins with a double-quote (")
- Conversely, use the double quote (") if the value begins with a single quote (')
- No escape sequences are supported
- The value type is NOT relevant
- Names are case iNsEnSiTiVe
- If a KEYWORD=VALUE pair occurs more than once in the connection string, the value associated with the LAST occurrence is used. But!... if the PROVIDER keyword occurs multiple times in the string, the FIRST occurrence is used.
- If a keyword contains an equal sign (=), it must be preceded by an additional equal sign to indicate that it is part of the keyword.
A connection string consists of a list of argument/value pairs (that is, parameters), separated by semi-colons. For example: "arg1=val1; arg2=val2; ... argN=valN;" All the parameters must be recognized by either ADO or the specified provider. ADO recognizes the following five arguments in a connection string.
|Provider||Specifies the name of a provider to use for the connection.|
|File Name||Specifies the name of a provider-specific file (for example, a persisted data source object) containing preset connection information.|
|URL||Specifies the connection string as an absolute URL identifying a resource, such as a file or directory.|
|Remote Provider||Specifies the name of a provider to use when opening a client-side connection (Remote Data Service only).|
|Remote Server||Specifies the path name of the server to use when opening a client-side connection (Remote Data Service only).|
Other arguments are passed to the provider named in the Provider argument, without any processing by ADO.
Depending on the data source you want to connect to the connection string varies.
The following pages document connection strings for OLEDB providers only.
- IBM DB2
- Microsoft Access
- Microsoft Excel
- Microsoft Project
- Microsoft SQL Server
- Oracle Database Server
- Text files
REMARK: Please remember that list of Providers/Drivers could differ for x86 and x64, so you should take care about which AutoIt version you are using.
For example you can use this following directive: