Jump to content

Connection string: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
m no hyphen
 
(45 intermediate revisions by 38 users not shown)
Line 1: Line 1:
In computing, a '''connection string''' is a [[String (computer science)|string]] that specifies information about a data source and the means of connecting to it. It is passed in code to an underlying [[software driver|driver]] or provider in order to initiate the connection.
In computing, a '''connection string''' is a [[String (computer science)|string]] that specifies information about a data source and the means of connecting to it. It is passed in code to an underlying [[software driver|driver]] or provider in order to initiate the connection. Whilst commonly used for a [[database connection]], the data source could also be a [[spreadsheet]] or text file.


The connection string may include attributes such as the name of the driver, [[server (computing)|server]] and [[database]], as well as security information such as user name and password.
The connection string may include attributes such as the name of the driver, [[server (computing)|server]] and [[database]], as well as security information such as user name and password.


==Examples==
Whilst commonly used for a [[database connection]], the data source could also be a [[spreadsheet]] or text file.
This example shows a [[Postgres]] connection string for connecting to wikipedia.com with SSL and a connection timeout of 180 seconds:

==Example==
This is a example of a Postgres Connection string that will try to connect to wikipedia.com with SSL and a Connection timeout of 180 sec.<br />
<blockquote>
<blockquote>
DRIVER={PostgreSQL Unicode};SERVER=www.wikipedia.com;SSL=true;SSLMode=require;DATABASE=wiki;UID=wikiuser;Connect Timeout=180;PWD=ashiknoor

DRIVER={PostgreSQL Unicode};SERVER=www.wikpedia.com;SSL=true;SSLMode=require;DATABASE=wiki;UID=wikiuser;Connect Timeout=180;PWD=ashiknoor
</blockquote>
</blockquote>

Users of [[Oracle database]]s can specify connection strings:

* on the [[command line]] (as in: <code>sqlplus scott/tiger@connection_string</code> )
* via [[environment variable]]s (<code>$TWO_TASK</code> in Unix-like environments; <code>%TWO_TASK%</code> in Microsoft Windows environments)<ref name=":0">
{{cite web
| url = http://download.oracle.com/docs/cd/B19306_01/server.102/b14357/ch2.htm#sthref360
| title = Configuring SQL*Plus
| first = Simon
| last = Watt
|date=June 2005
| work = SQL*Plus User's Guide and Reference: Release 10.2
| publisher = [[Oracle Corporation]]
| location = Redwood City
| accessdate = 2010-08-26
| quote = LOCAL [:] Windows environment variable to specify a connection string. Performs the same function as TWO_TASK on UNIX.
|display-authors=etal}}
</ref>
* in local [[configuration file]]s (such as the default <code>$ORACLE_HOME/network/admin.tnsnames.ora</code>)<ref>
{{cite book
|last= Kyte
|first= Thomas
|title= Expert Oracle database architecture: 9i and 10g programming techniques and solutions
|url= https://archive.org/details/expertoracledata0000kyte
|url-access= registration
|accessdate= 2010-08-26
|series= Apress series
|year= 2005
|publisher= Apress
|isbn= 978-1-59059-530-5
|page= [https://archive.org/details/expertoracledata0000kyte/page/60 60]
|quote= The TNS connection string tells the Oracle software how to connect to the remote database. Generally, the client software [...] will read a file called <code>tnsnames.ora</code>. This is a plaint-text configuration file commonly found in the [ORACLE_HOME]\network\admin directory ([ORACLE_HOME] represents the full path to your Oracle installation directory).
}}
</ref>
* in [[LDAP]]-capable [[directory service]]s


==References==
==References==
{{reflist}}
* [http://www.datadirect.com/developer/odbc/definitions/index.ssp Connection String definition at datadirect.com]


==External links==
==External links==
* {{Cite web|url=https://docs.microsoft.com/en-us/sql/odbc/microsoft/connection-string-format-and-attributes?view=sql-server-2017|title=Connection strings in SQL Server 2017|accessdate = 15 June 2019}}
* [http://ConnectionStringExamples.com ConnectionStringExamples.com]
{{Use dmy dates|date=June 2019}}
* [http://ConnectionStrings.com ConnectionStrings.com]
* [http://www.sqlmaestro.com/resources/all/anysql_maestro_connection_strings/ Connection strings examples] from [[SQL Maestro]]

{{comp-sci-stub}}


{{DEFAULTSORT:Connection String}}
[[Category:Databases]]
[[Category:Databases]]
[[Category:SQL data access]]
[[Category:String (computer science)]]


{{comp-sci-stub}}

Latest revision as of 16:28, 17 September 2023

In computing, a connection string is a string that specifies information about a data source and the means of connecting to it. It is passed in code to an underlying driver or provider in order to initiate the connection. Whilst commonly used for a database connection, the data source could also be a spreadsheet or text file.

The connection string may include attributes such as the name of the driver, server and database, as well as security information such as user name and password.

Examples

[edit]

This example shows a Postgres connection string for connecting to wikipedia.com with SSL and a connection timeout of 180 seconds:

DRIVER={PostgreSQL Unicode};SERVER=www.wikipedia.com;SSL=true;SSLMode=require;DATABASE=wiki;UID=wikiuser;Connect Timeout=180;PWD=ashiknoor

Users of Oracle databases can specify connection strings:

References

[edit]
  1. ^ Watt, Simon; et al. (June 2005). "Configuring SQL*Plus". SQL*Plus User's Guide and Reference: Release 10.2. Redwood City: Oracle Corporation. Retrieved 26 August 2010. LOCAL [:] Windows environment variable to specify a connection string. Performs the same function as TWO_TASK on UNIX.
  2. ^ Kyte, Thomas (2005). Expert Oracle database architecture: 9i and 10g programming techniques and solutions. Apress series. Apress. p. 60. ISBN 978-1-59059-530-5. Retrieved 26 August 2010. The TNS connection string tells the Oracle software how to connect to the remote database. Generally, the client software [...] will read a file called tnsnames.ora. This is a plaint-text configuration file commonly found in the [ORACLE_HOME]\network\admin directory ([ORACLE_HOME] represents the full path to your Oracle installation directory).
[edit]