1) In telecommunication and computing in general, a connection is the successful completion of necessary arrangements so that two or more parties (for example, people or programs) can communicate at a long distance. In this usage, the term has a strong physical (hardware) connotation although logical (software) elements are usually involved as well.Content Continues Below
A dialup (sometimes called a switched) connection is a telephonic arrangement that is set up only when needed, using shared, circuit-switched communication lines (as in "plain old telephone service"). A dedicated (sometimes called a nonswitched) connection is a continuous, always available connection (familiar to users of Digital Subscriber Line or DSL service). A leased line is a line rented from a telephone company that provides dedicated connection between two points (such as a headquarters office and a manufacturing plant).
2) In computer programming, a connection is the setting up of resources (such as computer memory and buffers) so that a particular object such as a database or file can be read or written to. Typically, a programmer encodes an OPEN or similar request to the operating system that ensures that system resources such as memory are set up, encodes READs and WRITES or similar requests, and then encodes a CLOSE when a connection is no longer needed so that the resources are returned to the system for other users.
A closely related term is session, which is sometime used to distinguish the ability to communicate for some duration in a logical sense. In this usage, the connection is regarded as the physical setup and the session is regarded as the logical setup. A session could be terminated and the connection maintained with the expectation of a new session later.