| 5.0 |
Connecting
to the Database.
The demo site uses an OLE DB connection,
perhaps you are already familiar with ODBC DSN connections and
are wondering why we have chosen to use OLE DB.
Firstly OLE DB offers a performance benefit over ODBC
DSN connections. For more information about the performance
gains take a look at this article at 4GuysFromRolla.com.
This benefit will not be noticeable on our small demo site,
which is running locally and not handling 1000's of transactions.
However, if you have not yet used OLE DB, it's a good opportunity
to familiarise yourself with the technique for future reference.
The second reason may be of much more real world benefit to
some people. Many budget Web Hosting plans only allow you to
set up a limited number of DSN's either directly through a control
panel or by requesting that one is set up for you by the Hosting
company, which may then take a couple of days to process your
request.
Using OLE DB you can have as many databases, websites and connections
as you can fit into your webspace, the connection file is created
locally and simply uploaded to your web space along with the
database and web pages with an FTP program. So even if you don't
have a control panel you can set up a connection immediately.
You will of course need to confirm that your Web Host has the
Microsoft Jet 4.0 OLE DB Provider
driver installed on the server. However if they are using Windows
NT4 or NT5 servers it's pretty safe to assume that it will be.
OK that's the why, here's the how. |
| 5.1 |
Open Windows
Explorer and navigate to the Connections folder inside the TDSFdemoSite
folder, which should now be in your wwwroot folder. So if your
PC is configured as standard this should be C:\Inetpub\wwwroot\TDSFdemoSite\Connection.
Open the connections folder,
it should be empty, in the right hand pane of Explorer click
the right mouse button, point to New and then click on Text
Document in the pop up menu.
By default windows will name the file New
Text Document.txt
If you cannot see the .txt file extension in the Explorer
window, click on tools then on folder options, this will open
the Folder Options dialogue box, click on the View Tab now uncheck
the box next to Hide file extensions for known file types. Click
Apply and close the Folder Options dialogue box. You should
now be able to see the three or four character file extension
on all your files in Windows Explorer. |
| 5.2 |
Now
right click on the New
Text Document.txt and click
on Rename in the pop up menu. Rename the file TDSFdemoOLE.udl
when you press enter or click away from the file you will get
a message warning of impending doom and catastrophe should you
change file extensions, are you sure? YES of course we're sure,
we're professionals. Click yes.
You will now see that the Icon has changed on our renamed
file, you should have a little picture of a database table with
a PC in front of it. |
| 5.3 |
Double click
on the TDSFdemoOLE.udl
file, instead of a text document, Windows opens a datalink properties
dialogue box. |
| 5.4 |
Select Microsoft
Jet 4.0 OLE DB Provider then click next.  |
| 5.5 |
Now click
the button to the right of the top text field and browse to
the TDSFdemo.mdb database
and select it and click Open to close the browser window.
Click on the Test Connection button, if all is well an information
box will appear saying Test connection succeeded. Click OK to
close the information box, then click OK on the Data Link Properties
dialogue box and close that as well.
|