ADO ConnectionString: Difference between revisions
mNo edit summary |
|||
(3 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
= Connection string = | = Connection string = | ||
The connection string is really just a string inside the application you pass on to the connection object. The property | 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. | As a string, there are no built in checks or constraints on how to format the connection string. | ||
Line 46: | Line 46: | ||
* SQLite | * SQLite | ||
* [[ADO_ConnectionString_TextFile|Text files]] | * [[ADO_ConnectionString_TextFile|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: | |||
<syntaxhighlight lang="autoit"> | |||
#AutoIt3Wrapper_UseX64=N | |||
</syntaxhighlight> | |||
= External links = | = External links = | ||
*[http://www.connectionstrings.com/ Database connection strings] | *[http://www.connectionstrings.com/ Database connection strings] | ||
*[https://msdn.microsoft.com/en-us/library/windows/desktop/ms722656(v=vs.85).aspx MSDN: Connection String Syntax] | |||
*[http://www.carlprothman.net/Technology/ConnectionStrings/ODBCDSNLess/tabid/90/Default.aspx ODBC DSN-Less connection strings] | *[http://www.carlprothman.net/Technology/ConnectionStrings/ODBCDSNLess/tabid/90/Default.aspx ODBC DSN-Less connection strings] | ||
[[Category:ADO]] | [[Category:ADO]] |
Latest revision as of 10:46, 9 November 2020
Connection string
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.
Argument | Description |
---|---|
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
- MySQL
- Oracle Database Server
- SQLite
- 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:
#AutoIt3Wrapper_UseX64=N