| << 12.4.0- Testing our Data Store | Chapter12 | 12.5.1- Describing the Connection >> |
What is a Connection?
This might seem pretty obvious, but a connection is the thing that links the ADO objects (in your code) to the data store. We can understand it by comparing it to the way your telephone works. You can use the same telephone (at different times) to call your bank, or the local cinema, or the Weatherline service – and get information on your bank details, the current film releases, and your local weather. Each time, you're just creating a connection from your telephone to the service in question – and when you've finished you cut off the connection by terminating the phone call.
A database connection works in much the same way. At one end, replacing the telephone, we have the ADO objects – specifically the ADO Connection object. At the other end, replacing the bank teller or the Weather Office's recorded message, we have one or other data store. In between, we have a connection that ties them together for as long as they need to communicate.
When the Connection object has finished communicating with one data store, you can disconnect (using the Close method as we did in the previous example). Then, if you like and as long as you don't remove the object from memory, you can use the same Connection object to connect to another data store (just as we can use the same telephone to call different services at different times).
Of course, if you had lots of telephones (and telephone lines) then you could call lots of different services at the same time (although you'd probably need to ask some of your office-mates to help with all the ensuing conversations!). You can do the same with Connection objects. You can have lots of Connection objects in your code, with each one connected to a different data store.
| << 12.4.0- Testing our Data Store | Chapter12 | 12.5.1- Describing the Connection >> |

RSS
